[issue33849] Caught infinite recursion resets the trace function

Alexander Belopolsky report at bugs.python.org
Tue Jun 12 18:24:35 EDT 2018


New submission from Alexander Belopolsky <alexander.belopolsky at gmail.com>:

Consider the following code:

import sys

def trace(frame, event, arg):
    pass

def f():
    f()
sys.settrace(trace)
print(sys.gettrace())
try:
    f()
except RuntimeError:
    pass
print(sys.gettrace())

When I run it, I get

<function trace at 0x108865158>
None

Apparently, the infinite recursion somehow resets the trace function.  This interferes with the coverage tools.

----------
messages: 319409
nosy: belopolsky
priority: normal
severity: normal
stage: needs patch
status: open
title: Caught infinite recursion resets the trace function
type: behavior
versions: Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33849>
_______________________________________


More information about the Python-bugs-list mailing list