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
ctypes: test_frozentable fails when make regen-frozen #87538
Comments
The following test failure happens on Python 3.10.0a6+ when we make regen-frozen with the same Python version we test: ====================================================================== Traceback (most recent call last):
File "/home/churchyard/Dokumenty/RedHat/cpython/Lib/ctypes/test/test_values.py", line 87, in test_frozentable
self.assertEqual(items, expected, "PyImport_FrozenModules example "
AssertionError: Lists differ: [('__hello__', 129), ('__phello__', -129), ('__phello__.spam', 129)] != [('__hello__', 125), ('__phello__', -125), ('__phello__.spam', 125)] First differing element 0:
+ [('__hello__', 125), ('__phello__', -125), ('__phello__.spam', 125)] ---------------------------------------------------------------------- FAILED (failures=1, skipped=87) Reproducer:
Actual result: Tests in (2) pass, tests in (5) fail. The difference after (3) is: diff --git a/Python/frozen_hello.h b/Python/frozen_hello.h
index 9c566cc81e..d58b726aa8 100644
--- a/Python/frozen_hello.h
+++ b/Python/frozen_hello.h
@@ -9,5 +9,5 @@ static unsigned char M___hello__[] = {
100,218,5,112,114,105,110,116,169,0,114,2,0,
0,0,114,2,0,0,0,218,4,110,111,110,101,
218,8,60,109,111,100,117,108,101,62,1,0,0,
- 0,115,2,0,0,0,4,1,
+ 0,115,6,0,0,0,4,0,12,1,255,128,
}; Expected results: Tests pass, no diff. |
When I run When I run |
I believe the line table format got changed but the frozen code didn't get re-generated. If you try to call co_lines() on the __hello__ code, Python crashes. >>> import __hello__
Hello world!
>>> co = __hello__.__spec__.loader.get_code('__hello__')
>>> co.co_linetable
b'\x04\x01'
>>> list(co.co_lines())
python: ../Objects/codeobject.c:1185: PyLineTable_NextAddressRange: Assertion `!at_end(range)' failed. My PR re-generates the code and fixes the test. Perhaps I should also add a test to exercise co_lines() on the frozen code object. |
Thanks for the fixer! |
See also bpo-43445 "Add frozen modules to sys.stdlib_module_names". |
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: