-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Open
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
Ran into this on 3.15 main... I don't have libuuid available on my Linux machine, and import _uuid results in: "python3.15: third-party/python/main/patched/Objects/call.c:120: PyObject *_PyObject_VectorcallDictTstate(PyThreadState *, PyObject *, PyObject *const *, size_t, PyObject *): Assertion `!_PyErr_Occurred(tstate)' failed."
The issue seems to be that _PyImport_GetModuleExportHooks does the findfuncptr for export_prefix which results in an ImportError being set. Then it does it again for init_prefix and that again tries setting an ImportError resulting in the failed assertion.
I'd be happy to put up a PR but I'm not sure if the correct behavior is:
- PyErr_Clear after the first failed attempt
- PyErr_Fetch after the first failed attempt, and PyErr_Restore if the 2nd one doesn't succeed
- PyErr_Fetch after the first failed attempt, and leave the error of the 2nd one if it reported an error, or PyErr_Restore if it doesn't.
The new code was added with 589a03a
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error