-
-
Notifications
You must be signed in to change notification settings - Fork 34.4k
bpo-35476: clear error in _imp_create_dynamic_impl #14738
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2249,6 +2249,9 @@ _imp_create_dynamic_impl(PyObject *module, PyObject *spec, PyObject *file) | |
|
|
||
| mod = _PyImport_FindExtensionObject(name, path); | ||
| if (mod != NULL || PyErr_Occurred()) { | ||
| if (PyErr_Occurred()) { | ||
| PyErr_Clear(); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I've started a discussion over on the issue where if I'm right and swallowing an exception is bad then this clearing of the exception should be removed. |
||
| } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This actually won't work because since you cleared out the error but are returning |
||
| Py_DECREF(name); | ||
| Py_DECREF(path); | ||
| Py_XINCREF(mod); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To avoid the overhead of calling
PyErr_Occurred(), could you store the result in a variable and check that?