]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Simplify sys.breakpointhook implementation (#9519)
authorAnthony Sottile <asottile@umich.edu>
Thu, 1 Nov 2018 17:25:05 +0000 (10:25 -0700)
committerBarry Warsaw <barry@python.org>
Thu, 1 Nov 2018 17:25:05 +0000 (10:25 -0700)
Python/sysmodule.c

index 21647083d683d725fcbe13e99609e998ffe57016..c0f168c63820527d7a4555aab504676cdef0f2ac 100644 (file)
@@ -151,16 +151,8 @@ sys_breakpointhook(PyObject *self, PyObject *const *args, Py_ssize_t nargs, PyOb
         return NULL;
     }
 
-    PyObject *fromlist = Py_BuildValue("(s)", attrname);
-    if (fromlist == NULL) {
-        Py_DECREF(modulepath);
-        PyMem_RawFree(envar);
-        return NULL;
-    }
-    PyObject *module = PyImport_ImportModuleLevelObject(
-        modulepath, NULL, NULL, fromlist, 0);
+    PyObject *module = PyImport_Import(modulepath);
     Py_DECREF(modulepath);
-    Py_DECREF(fromlist);
 
     if (module == NULL) {
         goto error;