Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 3.11: Tests fail due to "Trace function changed, data is likely wrong" #2949

Closed
imphil opened this issue Apr 24, 2022 · 3 comments
Closed
Labels
upstream An issue with an upstream simulator

Comments

@imphil
Copy link
Member

imphil commented Apr 24, 2022

In Python 3.11 (pre-release) we get a test failure in CI:

ERROR: called callback function threw exception
Traceback (most recent call last):
  File "/home/runner/work/cocotb/cocotb/cocotb/scheduler.py", line 385, in _react
    self._is_reacting = False
    ^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cocotb/cocotb/.nox/dev_test/lib/python3.11/site-packages/coverage/pytracer.py", line 216, in _trace
    self.data_stack.pop()
    ^^^^^^^^^^^^^^^^^^^^^
IndexError: pop from empty list
Exception ignored in atexit callback: <bound method Coverage._atexit of <coverage.control.Coverage object at 0x7f21f17b1b10>>
Traceback (most recent call last):
  File "/home/runner/work/cocotb/cocotb/.nox/dev_test/lib/python3.11/site-packages/coverage/control.py", line 607, in _atexit
    self.stop()
    ^^^^^^^^^^^
  File "/home/runner/work/cocotb/cocotb/.nox/dev_test/lib/python3.11/site-packages/coverage/control.py", line 599, in stop
    self._collector.stop()
    ^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/cocotb/cocotb/.nox/dev_test/lib/python3.11/site-packages/coverage/collector.py", line 353, in stop
    self.pause()
    ^^^^^^^^^^^^
  File "/home/runner/work/cocotb/cocotb/.nox/dev_test/lib/python3.11/site-packages/coverage/collector.py", line 364, in pause
    tracer.stop()
    ^^^^^^^^^^^^^
  File "/home/runner/work/cocotb/cocotb/.nox/dev_test/lib/python3.11/site-packages/coverage/pytracer.py", line 269, in stop
    self.warn(
    ^^^^^^^^^^
  File "/home/runner/work/cocotb/cocotb/.nox/dev_test/lib/python3.11/site-packages/coverage/control.py", line 388, in _warn
    warnings.warn(msg, category=CoverageWarning, stacklevel=2)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
coverage.exceptions.CoverageWarning: Trace function changed, data is likely wrong: None != <bound method PyTracer._trace of <PyTracer at 0x7f21f15c02d0: 1711 lines in 18 files>> (trace-changed)

A CI log: https://github.com/cocotb/cocotb/runs/6147105555?check_suite_focus=true#step:25:976.

See also the comment by @ktbarrett in #2947 (comment)_

@ktbarrett ktbarrett added the upstream An issue with an upstream simulator label Apr 24, 2022
@ktbarrett
Copy link
Member

This is due to a bug in Python 3.11. It has already been fixed upstream. Not sure when we will see it flow downstream. nedbat/coveragepy#1270.

@imphil
Copy link
Member Author

imphil commented Apr 24, 2022

Good find, thanks for looking into it @ktbarrett!

@imphil
Copy link
Member Author

imphil commented Sep 1, 2022

This issue is now resolved upstream, and our CI passes with Python 3.11 rc1.

@imphil imphil closed this as completed Sep 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream An issue with an upstream simulator
Projects
None yet
Development

No branches or pull requests

2 participants