Python 3.13 and the NOP opcode
Closed this issue · 2 comments
stefanor commented
=================================== FAILURES ===================================
______________________________ test_assumed_noop _______________________________
def test_assumed_noop():
"""
We are assuming the NOP code is 9.
Double check that it is.
"""
import opcode
NOP_VALUE: int = opcode.opmap['NOP']
> assert NOP_VALUE == 9
E assert 30 == 9
tests/test_assumptions.py:9: AssertionError
=========================== short test summary info ============================
FAILED tests/test_assumptions.py::test_assumed_noop - assert 30 == 9
========================= 1 failed, 33 passed in 6.28s =========================
https://docs.python.org/3.13/whatsnew/3.13.html
Looks like the relevant change was: python/cpython#105481
Erotemic commented
Ah, the hard coded value finally came back to bite us!
It looks like this might be as simple as throwing:
import opcode
NOP_VALUE: int = opcode.opmap['NOP']
into the globals of the pyx module.
I made a PR to fix this. #286
Probably also need to think about adding 3.13 to the CI soon.