[ANN] Docker image for early testing Numba on Python 3.11

Docker image for early testing Numba on Python 3.11

The addition of Python 3.11 support to Numba has been a challenging effort due to significant changes in the CPython bytecode and interpreter internals. Since the start of 2022, the Numba team has plans to upgrade our bytecode analysis frontend to reduce the reliance of heuristics based on CPython implementation details but the new code will need more time to be fully implemented. To avoid delay of Python 3.11 support, we extended the current bytecode frontend which at times require complicated transformation to restore structures of the old bytecode. One of the major changes in CPython that greatly affected Numba is bpo-40222 “zero-cost” exception handling, which also removed the concept of blockstack. This makes the support of try-except and with-lifting very challenging.

Nonetheless, the Numba team has nearly completed the support of Python 3.11. The current testsuite has 8 failures and 10,099 passing tests. Details of the test failures are listed at the end of this post.

To facility more Numba users in testing against Python 3.11, the Numba team is providing a docker setup at Release py3.11testing-1 · numba/numba-hatchery · GitHub. It provides a AMD64 Linux docker image based on python:3.11.1-bullseye with scripts that will automatically fetch the appropriate commit from llvmlite and numba, and setup a working environment that can execute numba. For details please see the readme at GitHub - numba/numba-hatchery at py3.11testing-1.

Appendix: Test Failures Details

Test failures with trivial fix or overly strict tests:

  • numba.tests.test_operators.TestMixedIntsOperatorModule.test_pow

    The test checks behavior that is not guaranteed—numerical differences in int to float cast

  • numba.tests.test_import.TestNumbaImport.test_no_accidental_warnings

    The test checks for warnings during Numba import. There’s a llvmlite Deprecation warning from importlib-resources that is failing this test.

Test failures due to not yet implemented support:

  • numba.tests.test_profiler.TestProfiler.test_profiler
    The test checks profiler support, which has not been fixed for py3.11 changes.

Non-trivial with-lifting failures that is caused by py3.11 bytecode changes:

  • numba.tests.test_try_except.TestTryExceptOtherControlFlow.test_objmode_output_type

    The test checks with-lifting compatibility with try-except but it is broken for the following case due to changes in bytecode:

    try:
        with ...:
            ...
    except:
        ...
    
  • numba.tests.test_withlifting.TestLiftCall.test_liftcall5

    The test checks with-lifting support but it is broken for the following case due to changes in bytecode:

    for ...
      with ...
        break
    
  • numba.tests.test_withlifting.TestLiftObj.test_case19_recursion

    The test checks with-lifting support but it is broken for the following case due to changes in bytecode:

    with ...
      return
    

(ping @RC_Testers)