[issue47185] code.replace(co_code=new_code) no longer catch exceptions on Python 3.11

STINNER Victor report at bugs.python.org
Fri Apr 1 13:47:13 EDT 2022


STINNER Victor <vstinner at python.org> added the comment:

> How would you compute the exception table from the bytecode? There are no clues in the bytecode about where the try and except blocks are.

Disassemble the bytecode to rebuild basic blocks and detect which ones are except blocks. I don't know how the exception table works :-) It's just a guess.

Or do you think that this job should be done by the caller?

----------

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


More information about the Python-bugs-list mailing list