Author blueyed
Recipients blueyed
Date 2019-03-29.19:11:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1553886678.98.0.673623780459.issue36474@roundup.psfhosted.org>
In-reply-to
Content
A RecursionError causes the trace function set via `sys.settrace` to get removed/unset.

Given the following script:

```
import sys


def trace(*args):
    print("trace", args)
    return trace

sys.settrace(trace)


def f():
    f()


print(sys.gettrace())
try:
    f()
except Exception as exc:
    print(exc)
print(sys.gettrace())
```

Running it will output:
```
<function trace at 0x7f848594f6c0>
trace (<frame at 0x7f84859a5d98, file 't-settrace-recursionerror.py', line 11, code f>, 'call', None)
trace (<frame at 0x7f84859a5d98, file 't-settrace-recursionerror.py', line 12, code f>, 'line', None)
trace (<frame at 0x7f84858f73a0, file 't-settrace-recursionerror.py', line 11, code f>, 'call', None)
trace (<frame at 0x7f84858f73a0, file 't-settrace-recursionerror.py', line 12, code f>, 'line', None)
…
trace (<frame at 0x7f84857f0c80, file 't-settrace-recursionerror.py', line 11, code f>, 'call', None)
trace (<frame at 0x7f84857f0c80, file 't-settrace-recursionerror.py', line 12, code f>, 'line', None)
trace maximum recursion depth exceeded while getting the repr of an object
None

```
History
Date User Action Args
2019-03-29 19:11:18blueyedsetrecipients: + blueyed
2019-03-29 19:11:18blueyedsetmessageid: <1553886678.98.0.673623780459.issue36474@roundup.psfhosted.org>
2019-03-29 19:11:18blueyedlinkissue36474 messages
2019-03-29 19:11:18blueyedcreate