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
Exception ignored in the internal traceback machinery:
AttributeError: 'object' object has no attribute '_print_exception_bltin'
Traceback (most recent call last):
File "/home/bswck/Python/cpython/t.py", line 12, in <module>
python: Objects/call.c:618: callmethod: Assertion `callable != NULL' failed.
Fatal Python error: Aborted
Aborted (core dumped)
The problem happens because _Py_FindSourceFile resorts to _PyObject_CallMethodFormat which assumes callable is healthy (the callable in this case is the result of getting open of io, which is NULL because io is an object() from test_import).
Maybe NULL-check the callable first? (PR in progress)
Activity
johnslavik commentedon Dec 15, 2025
Full message (please include it when possible):
The problem happens because
_Py_FindSourceFileresorts to_PyObject_CallMethodFormatwhich assumescallableis healthy (thecallablein this case is the result of gettingopenofio, which isNULLbecauseiois anobject()fromtest_import).Maybe NULL-check the
callablefirst? (PR in progress)ZeroIntensity commentedon Dec 15, 2025
I think the issue is here:
cpython/Python/traceback.c
Lines 417 to 420 in 14d3974
We need to check for a
NULLresult fromPyObject_GetAttr, not defer the check to_PyObject_CallMethodFormat, because:johnslavik commentedon Dec 15, 2025
Would slow down for other callers of
_Py_FindSourceFile-- there are no other callers of_PyObject_CallMethodFormatthantraceback.citself.I think we can skip the entire loop actually, if
openisNULL?ZeroIntensity commentedon Dec 15, 2025
Then I assume that API was added with the intention that we'll use it somewhere else someday.
Yeah, that makes sense to me.
gh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (GH-142747)
pythongh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (pytho…
pythongh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (pytho…
[3.13] pythongh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (…
[3.13] gh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (GH-1…
[3.14] gh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (GH-1…
pythongh-142737: Handle lost `io.open` in `_Py_FindSourceFile` (pytho…