Cyberbrain icon indicating copy to clipboard operation
Cyberbrain copied to clipboard

Support Python 3.10

Open laike9m opened this issue 3 years ago • 4 comments

Python 3.10 changelog

Bytecode changes can be found by viewing magic number change history image

  • [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 using code.co_lines internally (see https://bugs.python.org/issue44875). So we're good.
  • [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:

laike9m avatar May 23 '21 19:05 laike9m

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

victorjzsun avatar May 23 '21 21:05 victorjzsun

Currently the code does not use co_lnotab directly.

laike9m avatar May 24 '21 05:05 laike9m

I tried running the test suite under Python 3.10 rc2. Many tests failed as expected. Will try to fix them.

laike9m avatar Sep 12 '21 09:09 laike9m

~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.

laike9m avatar Oct 10 '21 05:10 laike9m