-
-
Notifications
You must be signed in to change notification settings - Fork 31.7k
Assertion failure when running "test_ast" tests with coverage. #71781
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
Comments
This is with a build of the default branch on OS X 10.11.6: $ hg identify
fada654c5f72 tip
$ ./python.exe --version
Python 3.6.0a3+
$ The "test_ast" tests appear to run fine without coverage tracking enabled: $ ./python.exe -m test test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
1 test OK.
Total duration: 0:00:07
$ But when coverage tracking is enabled, an assertion fails: $ ./python.exe -m test --coverage -D`pwd`/coverage_data test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
Assertion failed: (line > 0), function _PyCode_CheckLineNumber, file Objects/codeobject.c, line 717.
Fatal Python error: Aborted Current thread 0x00007fff76279000 (most recent call first): |
Cannot reproduce this on Linux |
You could try changing this line in compile.c (in function 'assemble') if (entryblock && entryblock->b_instr) to if (entryblock && entryblock->b_instr && entryblock->b_instr->i_lineno) Does this help? |
Thanks levkivskyi, it fixed the issue for me! |
Thanks, Ivan, that change fixes it for me, too. I checked with a more recent revision and build: $ hg identify
265644bad99e+ tip
$ ./python.exe --version
Python 3.6.0a4+
$ Confirmed that it still exhibited the same behaviour as before: $ ./python.exe -m test test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
1 test OK.
Total duration: 0:00:06
$
$ ./python.exe -m test --coverage -D`pwd`/coverage_data test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
Assertion failed: (line > 0), function _PyCode_CheckLineNumber, file Objects/codeobject.c, line 717.
Fatal Python error: Aborted Current thread 0x00007fff7b5a7000 (most recent call first): I applied the change you suggested, and this was the result: $ ./python.exe -m test --coverage -D`pwd`/coverage_data test_ast
Run tests sequentially
0:00:00 [1/1] test_ast
1 test OK.
lines cov% module (path)
556 1% _collections_abc (/python-dev/cpython/Lib/_collections_abc.py)
147 25% _weakrefset (/python-dev/cpython/Lib/_weakrefset.py)
96 16% abc (/python-dev/cpython/Lib/abc.py)
156 66% ast (/python-dev/cpython/Lib/ast.py)
418 1% codecs (/python-dev/cpython/Lib/codecs.py)
692 0% collections.__init__ (/python-dev/cpython/Lib/collections/__init__.py)
166 8% contextlib (/python-dev/cpython/Lib/contextlib.py)
318 22% dis (/python-dev/cpython/Lib/dis.py)
74 5% genericpath (/python-dev/cpython/Lib/genericpath.py)
103 2% importlib.__init__ (/python-dev/cpython/Lib/importlib/__init__.py)
1776 0% inspect (/python-dev/cpython/Lib/inspect.py)
1228 0% locale (/python-dev/cpython/Lib/locale.py)
170 0% multiprocessing.process (/python-dev/cpython/Lib/multiprocessing/process.py)
612 1% os (/python-dev/cpython/Lib/os.py)
687 0% platform (/python-dev/cpython/Lib/platform.py)
313 5% posixpath (/python-dev/cpython/Lib/posixpath.py)
435 1% sysconfig (/python-dev/cpython/Lib/sysconfig.py)
336 1% test.libregrtest.main (/python-dev/cpython/Lib/test/libregrtest/main.py)
174 29% test.libregrtest.runtest (/python-dev/cpython/Lib/test/libregrtest/runtest.py)
197 27% test.libregrtest.save_env (/python-dev/cpython/Lib/test/libregrtest/save_env.py)
1341 3% test.support.__init__ (/python-dev/cpython/Lib/test/support/__init__.py)
870 98% test.test_ast (/python-dev/cpython/Lib/test/test_ast.py)
461 0% trace (/python-dev/cpython/Lib/trace.py)
285 2% traceback (/python-dev/cpython/Lib/traceback.py)
824 20% unittest.case (/python-dev/cpython/Lib/unittest/case.py)
329 8% unittest.loader (/python-dev/cpython/Lib/unittest/loader.py)
134 20% unittest.result (/python-dev/cpython/Lib/unittest/result.py)
222 44% unittest.suite (/python-dev/cpython/Lib/unittest/suite.py)
134 0% unittest.util (/python-dev/cpython/Lib/unittest/util.py)
384 6% weakref (/python-dev/cpython/Lib/weakref.py)
Total duration: 0:00:09
$ |
New changeset 1bf307f42a6b by Ned Deily in branch 'default': |
Thanks for the report. It looks the assert error is triggered by the new test case added in 59638baee25e for bpo-13436. Since that test case was only added for 3.6, I've only applied Ivan's suggested fix for 3.6 as well, although you could trigger the same assert in earlier releases. Thanks, Ivan! |
Ned, thank you for applying the patch! I have discovered this same issue accidentally while playing with possible implementations of PEP-526. It appeared as a failure in |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: