[issue22898] segfault during shutdown attempting to log ResourceWarning

STINNER Victor report at bugs.python.org
Thu Mar 24 11:20:41 EDT 2016


STINNER Victor added the comment:

I tried the following script on Python 3.5 and Python 3.6 and I failed to reproduce the bug:
---
import sys, traceback

class MyException(Exception):
    def __init__(self, *args):
        1/0

def gen():
    f = open(__file__, mode='rb', buffering=0)
    yield

g = gen()
next(g)
recursionlimit = sys.getrecursionlimit()
sys.setrecursionlimit(len(traceback.extract_stack())+3)
try:
    g.throw(MyException)
finally:
    sys.setrecursionlimit(recursionlimit)
    print('Done.')
---

Note: I had to add "+3" to the sys.setrecursionlimit() call, otherwise the limit is too low and you get a RecursionError (it's a recent bugfix, issue #25274).

Can somone else please confirm that the bug is fixed?

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22898>
_______________________________________


More information about the Python-bugs-list mailing list