diff options
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Python/errors.c b/Python/errors.c index 02cf47992b..f80ae21fdd 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -1098,10 +1098,11 @@ PyErr_NewException(const char *name, PyObject *base, PyObject *dict) goto failure; } - if (_PyDict_GetItemIdWithError(dict, &PyId___module__) == NULL) { - if (_PyErr_Occurred(tstate)) { - goto failure; - } + int r = _PyDict_ContainsId(dict, &PyId___module__); + if (r < 0) { + goto failure; + } + if (r == 0) { modulename = PyUnicode_FromStringAndSize(name, (Py_ssize_t)(dot-name)); if (modulename == NULL) |