Cyberbrain
Cyberbrain copied to clipboard
Support Python 3.10
Bytecode changes can be found by viewing magic number change history
- [x] Make 'annotations' future by default bpo-38605
Undo making 'annotations' future by default bpo-38605 - [x] New line number table format -- PEP 626 https://github.com/python/cpython/pull/23245
- We rely on
dis.findlinestarts
to determine lineno, which is already usingcode.co_lines
internally (see https://bugs.python.org/issue44875). So we're good.
- We rely on
- [x] Function annotation for MAKE_FUNCTION is changed from dict to tuple bpo-42202
- This should not affect Cb. It only changes how annotation is stored (from map to tuple), which are are all consts.
- [x] ❓ RERAISE restores f_lasti if oparg != 0 bpo-42246
- Not sure if this affects anything, for now assume no. Will come to it if we hit any issues.
- [ ] PEP 634: Structural Pattern Matching bpo-42128
- [x] Use instruction offsets (as opposed to byte offsets)
- [x] Add GEN_START bytecode bpo-43683
- [x] Safer line number table handling bpo-42739
Other bytecode related changes:
Note: Python3.10 uses co_lines
instead of co_lnotab
for source code line numbers
There might be changes to source code linenos for events
Currently the code does not use co_lnotab directly.
I tried running the test suite under Python 3.10 rc2. Many tests failed as expected. Will try to fix them.
~Right now blocked by https://github.com/ultrajson/ultrajson/issues/482. We need ujson 4.2.0 to support 3.10, but ujson 4.2.0 needs installer 0.3.0 (released in a few days) to be successfully installed. So we can just wait.~
~To be more specific, we need a pre-built ujson wheel for Python 3.10, otherwise GitHub Actions will fail to build it.~
This is fixed.