New submission from Xinmeng Xia <xi...@smail.nju.edu.cn>:

The following program 1 can crash in Python 3. We have reproduce it in the 
Python version 3.5, 3.6, 3.7, 3.8, 3.9, 3.10. This bug seems to be similar to 
issue 36272, however, the tracking system shows issue 36272 has been fixed and 
the program 2, which triggers issue 36272, will not cause crash (“core dump”) 
in Python 3.8, 3.9, 3.10.
We have attached the stack trace in the end of this report.

Program 1: 
========================
import logging

def rec():
        try:
                logging.error("foo")
        except:
                pass
        rec()
rec()
========================

Program 2: 
========================
import logging

def rec():
        logging.error("foo")
        rec()
rec()
======================
The error message is like following:
“
ERROR:root:foo
ERROR:root:foo
ERROR:root:foo
ERROR:root:foo
…
ERROR:root:foo
ERROR:root:foo
ERROR:root:foo
Fatal Python error: _Py_CheckRecursiveCall: Cannot recover from stack overflow.
Python runtime state: initialized

Current thread 0x00007f0fa440b700 (most recent call first):
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 420 in 
usesTime
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 643 in 
usesTime
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 675 in 
format
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 938 in 
format
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1094 in 
emit
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 963 in 
handle
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1673 in 
callHandlers
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1611 in 
handle
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1601 in 
_log
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 1483 in 
error
  File "/usr/local/python310/lib/python3.10/logging/__init__.py", line 2080 in 
error
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 8 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
….
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  File "/home/xxm/Desktop/methodfuzzer/error/loggingtest.py", line 12 in rec
  ...
Aborted (core dumped)”

----------
components: Interpreter Core
messages: 382111
nosy: xxm
priority: normal
severity: normal
status: open
title: Recursive calls crash interpreter when checking exceptions
type: crash
versions: Python 3.10

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42509>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to