diff options
author | Brett Cannon <brett@python.org> | 2013-07-04 21:48:16 (GMT) |
---|---|---|
committer | Brett Cannon <brett@python.org> | 2013-07-04 21:48:16 (GMT) |
commit | 82da8886cc3d8166ab8ef5a257cb04a32ddb1720 (patch) | |
tree | 081cfaea38e07f443861716a38c7bc778431153a /Python/errors.c | |
parent | 45091c0a0c4b759f36a2094d324e9e2022b4106b (diff) | |
download | cpython-82da8886cc3d8166ab8ef5a257cb04a32ddb1720.zip cpython-82da8886cc3d8166ab8ef5a257cb04a32ddb1720.tar.gz cpython-82da8886cc3d8166ab8ef5a257cb04a32ddb1720.tar.bz2 |
Issue #15767: Revert 3a50025f1900 for ModuleNotFoundError
Diffstat (limited to 'Python/errors.c')
-rw-r--r-- | Python/errors.c | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/Python/errors.c b/Python/errors.c index 89021aa..1f955b5 100644 --- a/Python/errors.c +++ b/Python/errors.c @@ -619,25 +619,12 @@ PyObject *PyErr_SetFromWindowsErrWithUnicodeFilename( #endif /* MS_WINDOWS */ PyObject * -PyErr_SetImportErrorSubclass(PyObject *exception, PyObject *msg, - PyObject *name, PyObject *path) +PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path) { - int issubclass; PyObject *args, *kwargs, *error; - issubclass = PyObject_IsSubclass(exception, PyExc_ImportError); - if (issubclass < 0) { - return NULL; - } - else if (!issubclass) { - PyErr_SetString(PyExc_TypeError, "expected a subclass of ImportError"); - return NULL; - } - - if (msg == NULL) { - PyErr_SetString(PyExc_TypeError, "expected a message argument"); + if (msg == NULL) return NULL; - } args = PyTuple_New(1); if (args == NULL) @@ -662,7 +649,7 @@ PyErr_SetImportErrorSubclass(PyObject *exception, PyObject *msg, PyDict_SetItemString(kwargs, "name", name); PyDict_SetItemString(kwargs, "path", path); - error = PyObject_Call(exception, args, kwargs); + error = PyObject_Call(PyExc_ImportError, args, kwargs); if (error != NULL) { PyErr_SetObject((PyObject *)Py_TYPE(error), error); Py_DECREF(error); @@ -674,12 +661,6 @@ PyErr_SetImportErrorSubclass(PyObject *exception, PyObject *msg, return NULL; } -PyObject * -PyErr_SetImportError(PyObject *msg, PyObject *name, PyObject *path) -{ - return PyErr_SetImportErrorSubclass(PyExc_ImportError, msg, name, path); -} - void _PyErr_BadInternalCall(const char *filename, int lineno) { |