mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
gh-128911: Use PyImport_ImportModuleAttr() function (#129657)
* Replace PyImport_ImportModule() + PyObject_GetAttr() with PyImport_ImportModuleAttr(). * Replace PyImport_ImportModule() + PyObject_GetAttrString() with PyImport_ImportModuleAttrString().
This commit is contained in:
parent
fb5d1c9236
commit
dc804ffb2f
7 changed files with 32 additions and 84 deletions
|
@ -368,12 +368,9 @@ _convert_exc_to_TracebackException(PyObject *exc, PyObject **p_tbexc)
|
|||
PyObject *create = NULL;
|
||||
|
||||
// This is inspired by _PyErr_Display().
|
||||
PyObject *tbmod = PyImport_ImportModule("traceback");
|
||||
if (tbmod == NULL) {
|
||||
return -1;
|
||||
}
|
||||
PyObject *tbexc_type = PyObject_GetAttrString(tbmod, "TracebackException");
|
||||
Py_DECREF(tbmod);
|
||||
PyObject *tbexc_type = PyImport_ImportModuleAttrString(
|
||||
"traceback",
|
||||
"TracebackException");
|
||||
if (tbexc_type == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue