[Python-checkins] Simplify sys.breakpointhook implementation (#9519)

Barry Warsaw webhook-mailer at python.org
Thu Nov 1 13:25:10 EDT 2018


https://github.com/python/cpython/commit/dce345c51abd5081679a487315fb47efddc54cdb
commit: dce345c51abd5081679a487315fb47efddc54cdb
branch: master
author: Anthony Sottile <asottile at umich.edu>
committer: Barry Warsaw <barry at python.org>
date: 2018-11-01T10:25:05-07:00
summary:

Simplify sys.breakpointhook implementation (#9519)

files:
M Python/sysmodule.c

diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index 21647083d683..c0f168c63820 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -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;



More information about the Python-checkins mailing list