question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[BUG] C tests fail with Python 3.11

See original GitHub issue

Describe the bug In shards 1 and 6 of the C tests some of the test don’t pass on Python 3.11 (3.11.0-beta.1). See the full log below.

To Reproduce Run Tools/ci-run.sh as defined in the CI configuration with Python 3.11. See this test run.

Expected behavior All CI tests pass, as on other Python versions.

Environment (please complete the following information):

  • OS: Linux (Ubuntu 18.04)
  • Python version: 3.11.0-beta.1
  • Cython version: 812585935131125f8988c38417bb73bfd5a81c05
Full error log
Sharded tests run in 590 seconds (9.8 minutes)
Errors found in shards 1, 6

Errors from shard 1:
======================================================================
FAIL: fail_on_line_trace (line_trace)
Doctest: line_trace.fail_on_line_trace
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/doctest.py", line 2217, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Failed doctest test for line_trace.fail_on_line_trace
  File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line unknown line number, in fail_on_line_trace

----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result = fail_on_line_trace(None, py_add, py_add_with_nogil)
Expected nothing
Got:
    unsupported operand type(s) for -: 'NoneType' and 'int'
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    len(result)
Expected:
    17
Got:
    3
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result[:5]  # py
Expected:
    ['NO ERROR', ('call', 0), ('line', 1), ('line', 2), ('return', 2)]
Got:
    ['NO ERROR', ('call', 2), ('line', 2)]
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result[5:10]  # py
Expected:
    [('call', 0), ('line', 1), ('line', 2), ('line', 3), ('line', 4)]
Got:
    []
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result[10:14]  # py
Expected:
    [('call', 0), ('line', 1), ('line', 2), ('return', 2)]
Got:
    []
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result[14:]  # py
Expected:
    [('line', 2), ('line', 5), ('return', 5)]
Got:
    []
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result = fail_on_line_trace('py_add_with_nogil', py_add, py_add_with_nogil)  # py
Expected:
    failing line trace!
Got:
    unsupported operand type(s) for -: 'NoneType' and 'int'
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result  # py
Expected:
    ['py_add_with_nogil', ('call', 0), ('line', 1), ('line', 2), ('return', 2), ('call', 0)]
Got:
    ['NO ERROR', ('call', 2), ('line', 2)]
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result = fail_on_line_trace('py_add', py_add, py_add_with_nogil)  # py
Expected:
    failing line trace!
Got:
    unsupported operand type(s) for -: 'NoneType' and 'int'
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result[:5]  # py
Expected:
    ['py_add', ('call', 0), ('line', 1), ('line', 2), ('return', 2)]
Got:
    ['NO ERROR', ('call', 2), ('line', 2)]
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.fail_on_line_trace
Failed example:
    result[5:]  # py
Expected:
    [('call', 0), ('line', 1), ('line', 2), ('line', 3), ('line', 4), ('call', 0)]
Got:
    []


======================================================================
FAIL: run_trace (line_trace)
Doctest: line_trace.run_trace
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/doctest.py", line 2217, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Failed doctest test for line_trace.run_trace
  File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line unknown line number, in run_trace

----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.run_trace
Failed example:
    run_trace(py_add, 1, 2)
Exception raised:
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/doctest.py", line 1346, in __run
        exec(compile(example.source, filename, "single",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<doctest line_trace.run_trace[2]>", line 1, in <module>
        run_trace(py_add, 1, 2)
        ^^^^^^^^^^^^^^^^^^^^^^^
      File "tests/run/line_trace.pyx", line 231, in line_trace.run_trace (line_trace.c:7047)
        func(*args)
      File "tests/run/line_trace.pyx", line 60, in line_trace.trace_trampoline (line_trace.c:3507)
        raise
      File "tests/run/line_trace.pyx", line 54, in line_trace.trace_trampoline (line_trace.c:3406)
        result = callback(frame, what, arg)
      File "tests/run/line_trace.pyx", line 81, in line_trace._create_trace_func._trace_func (line_trace.c:3974)
        trace.append((map_trace_types(event, event), frame.f_lineno - frame.f_code.co_firstlineno))
    TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'
----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/1/run/c/line_trace/line_trace.cpython-311-x86_64-linux-gnu.so", line ?, in line_trace.run_trace
Failed example:
    run_trace(py_add, 1, 2, with_sys=True)
Exception raised:
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/doctest.py", line 1346, in __run
        exec(compile(example.source, filename, "single",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<doctest line_trace.run_trace[4]>", line 1, in <module>
        run_trace(py_add, 1, 2, with_sys=True)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "tests/run/line_trace.pyx", line 231, in line_trace.run_trace (line_trace.c:7047)
        func(*args)
      File "<doctest line_trace.run_trace[0]>", line 3, in py_add
        return x
        ^^^^^^^^
      File "tests/run/line_trace.pyx", line 81, in line_trace._create_trace_func._trace_func (line_trace.c:3974)
        trace.append((map_trace_types(event, event), frame.f_lineno - frame.f_code.co_firstlineno))
    TypeError: unsupported operand type(s) for -: 'NoneType' and 'int'



Errors from shard 6:
======================================================================
FAIL: test_deduplicated_args (tuple_constants)
Doctest: tuple_constants.test_deduplicated_args
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/doctest.py", line 2217, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Failed doctest test for tuple_constants.test_deduplicated_args
  File "/home/runner/work/cython/cython/TEST_TMP/6/run/c/tuple_constants/tuple_constants.cpython-311-x86_64-linux-gnu.so", line unknown line number, in test_deduplicated_args

----------------------------------------------------------------------
File "/home/runner/work/cython/cython/TEST_TMP/6/run/c/tuple_constants/tuple_constants.cpython-311-x86_64-linux-gnu.so", line ?, in tuple_constants.test_deduplicated_args
Failed example:
    test_deduplicated_args()
Exception raised:
    Traceback (most recent call last):
      File "/opt/hostedtoolcache/Python/3.11.0-beta.1/x64/lib/python3.11/doctest.py", line 1346, in __run
        exec(compile(example.source, filename, "single",
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "<doctest tuple_constants.test_deduplicated_args[0]>", line 1, in <module>
        test_deduplicated_args()
        ^^^^^^^^^^^^^^^^^^^^^^^^
      File "tests/run/tuple_constants.pyx", line 40, in tuple_constants.test_deduplicated_args (tuple_constants.c:3004)
        assert func1.__code__.co_varnames is func2.__code__.co_varnames
    AssertionError

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
da-woodscommented, Jun 19, 2022

Line tracing tests should be fixed in https://github.com/cython/cython/pull/4851

1reaction
EwoutHcommented, Jun 19, 2022

Thanks for looking into this! Should a issue be filed over at python/cpython?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Possible bug with py.exe launcher in 3.11 - Python Help
I noticed a change with py.exe for Windows in Python 3.11. Example test script - “myscript1.py”: #!/usr/bin/env python3 import sys ...
Read more >
2046668 – numpy fails to build with Python 3.11: error
Bug 2046668 - numpy fails to build with Python 3.11: error: _PyErr_StackItem{aka struct _err_stackitem} has no member named exc_type.
Read more >
pyct: FTBFS - dh_auto_test: error: pybuild --test - Google Groups
Bug #1026740: pyct: FTBFS: dh_auto_test: error: pybuild --test --test-pytest -i python{version} -p "3.11 3.10" returned exit code 13.
Read more >
Python 3.11 Preview: Even Better Error Messages
Explore third-party packages offering enhanced error messages; Test smaller improvements in Python 3.11, including new math functions and more ...
Read more >
SciPy 1.9.0 Release Notes — SciPy v1.9.3 Manual
This release requires Python 3.8-3.11 and NumPy 1.18.5 or greater. For running on PyPy, ... #15575: BUG: Tests failing for initial build [arm64...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found