You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SystemError when printing symbol table entry #109207
<symtable entry top(-1), line 0>OverflowError: Python int too large to convert to C long
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "x:\python\oneliner\__develop\symt.py", line 8, in <module>
print(symt._table)
SystemError: <built-in method write of _io.TextIOWrapper object at 0x000001508B5559A0> returned a result with an exception set
The repr first converts the table id to C long using PyLong_AS_LONG(). But the table id is just the id() of the corresponding AST node, and in Python it is an integer representation of pointer. Pointers are 64-bit on 64-bit platform, but C long is 32-bit on Windows. So we get an exception on 64-bit Windows.
Marking this as easy issue, as what you only need is simply remove PyLong_AS_LONG(), replace the %ld format code with %S or %R, and add a test and a NEWS entry. Welcome!
Activity
serhiy-storchaka commentedon Sep 10, 2023
I can see what the problem can be.
The repr first converts the table id to C long using
PyLong_AS_LONG(). But the table id is just theid()of the corresponding AST node, and in Python it is an integer representation of pointer. Pointers are 64-bit on 64-bit platform, but C long is 32-bit on Windows. So we get an exception on 64-bit Windows.Marking this as easy issue, as what you only need is simply remove
PyLong_AS_LONG(), replace the%ldformat code with%Sor%R, and add a test and a NEWS entry. Welcome!Fix pythongh-109207
Fix pythongh-109207
Fix pythongh-109207
gh-109207: Fix SystemError when printing symtable entry object. (GH-1…
pythongh-109207: Fix SystemError when printing symtable entry object. (…
pythongh-109207: Fix SystemError when printing symtable entry object. (…
[3.11] gh-109207: Fix SystemError when printing symtable entry object. (
[3.12] gh-109207: Fix SystemError when printing symtable entry object. (