New submission from Thomas Caswell: Code to reproduce:
def import_in_finally_fail(): try: print('yo') finally: import asyncio.queues as aq Results in: In [68]: import_in_finally_fail() yo --------------------------------------------------------------------------- SystemError Traceback (most recent call last) <ipython-input-68-4a6d2efcb22b> in <module>() ----> 1 import_in_finally_fail() /tmp/py2661VBj in import_in_finally_fail() SystemError: 'finally' pops bad exception The exact import does matter, but it needs to be at least 2 modules deep and be aliased. By patching cpython to put what finally pops off the stack in the error message it looks like it is the parent module of the import. This was found via the Matplotlib test suite (ex https://travis-ci.org/matplotlib/matplotlib/jobs/262907186 ) and reported to pytest (https://github.com/pytest-dev/pytest/issues/2674) ---------- components: Interpreter Core messages: 300911 nosy: tcaswell priority: normal severity: normal status: open title: import in finally results in SystemError type: crash versions: Python 3.7 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31286> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com