MatthieuDartiailh / bytecode

Python module to modify bytecode
https://bytecode.readthedocs.io/
MIT License
302 stars 38 forks source link

Remove `Compare.EXC_MATCH` on Python>=3.9 #93

Closed P403n1x87 closed 2 years ago

P403n1x87 commented 2 years ago

Python 3.9 introduced the JUMP_IF_NOT_EXC_MATCH opcode, and the use of Compare.EXC_MATCH produces bad code that results in

TypeError: 'UH��H��]�l�' not supported between instances of 'type' and 'type'

therefore I would like to suggest that the attribute Compare.EXC_MATCH be defined only under the condition sys.version_info[:2] < (3, 9)

MatthieuDartiailh commented 2 years ago

Sounds perfectly reasonable. Please make a PR.