mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +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
|
@ -1057,15 +1057,10 @@ test_pep3118_obsolete_write_locks(PyObject* self, PyObject *Py_UNUSED(ignored))
|
|||
if (ret != -1 || match == 0)
|
||||
goto error;
|
||||
|
||||
PyObject *mod_io = PyImport_ImportModule("_io");
|
||||
if (mod_io == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* bytesiobuf_getbuffer() */
|
||||
PyTypeObject *type = (PyTypeObject *)PyObject_GetAttrString(
|
||||
mod_io, "_BytesIOBuffer");
|
||||
Py_DECREF(mod_io);
|
||||
PyTypeObject *type = (PyTypeObject *)PyImport_ImportModuleAttrString(
|
||||
"_io",
|
||||
"_BytesIOBuffer");
|
||||
if (type == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue