__lazy_import__() segfaults when fromlist contains a non-string object.
__lazy_import__("os", fromlist=(123,))
~$ python -X faulthandler -c '__lazy_import__("os", fromlist=(123,))'; echo "exit status: $?" Fatal Python error: Segmentation fault Current thread 0x00007fd2b9bd6740 [python] (most recent call first): File "<string>", line 1 in <module> Current thread's C stack trace (most recent call first): Binary file "python", at _Py_DumpStack+0x30 [0x4f1dd0] Binary file "python" [0x59990b] Binary file "python" [0x59985e] Binary file "/lib/x86_64-linux-gnu/libc.so.6", at +0x3c050 [0x7fd2b990d050] Binary file "python" [0x1d98601] Binary file "python", at PyUnicode_FromFormat+0x60 [0x1a2e4e0] Binary file "python" [0x1b3efc5] Binary file "python" [0x491a67] Binary file "python" [0x4916bf] Binary file "python", at PyObject_Vectorcall+0x4c [0x1a15d64] Binary file "python", at _Py_VectorCallInstrumentation_StackRefSteal+0xca [0x1aa8e9a] Binary file "python" [0x1aaa666] Binary file "python" [0x1abf644] Binary file "python", at PyEval_EvalCode+0xa6 [0x1abf326] Binary file "python" [0x1aae98f] Binary file "python" [0x1aae7a9] Binary file "python" [0x1b7de90] Binary file "python", at Py_RunMain+0x58c [0x1b7dd8c] Binary file "python" [0x1b7d7dd] Binary file "python" [0x1b7d62c] Binary file "/lib/x86_64-linux-gnu/libc.so.6", at +0x2724a [0x7fd2b98f824a] Binary file "/lib/x86_64-linux-gnu/libc.so.6", at __libc_start_main+0x85 [0x7fd2b98f8305] Binary file "python", at _start+0x29 [0x1bf9b69] Segmentation fault exit status: 139
3.15
Linux
Python 3.15.0rc2 (main, Sep 29 2026, 15:02:39) [Clang 22.1.3 ]
This was fixed in a6a63b6.
>>> __lazy_import__("os", fromlist=(123,)) Traceback (most recent call last): File "<python-input-0>", line 1, in <module> __lazy_import__("os", fromlist=(123,)) ~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^ TypeError: Item in ``from list'' must be str, not int
Although the error message is a little odd.
Activity
StanFromIreland commented on Oct 3, 2026
This was fixed in a6a63b6.
Although the error message is a little odd.