mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-128911: Add PyImport_ImportModuleAttr() function (#128912)
Add PyImport_ImportModuleAttr() and PyImport_ImportModuleAttrString() functions. * Add unit tests. * Replace _PyImport_GetModuleAttr() with PyImport_ImportModuleAttr(). * Replace _PyImport_GetModuleAttrString() with PyImport_ImportModuleAttrString(). * Remove "pycore_import.h" includes, no longer needed.
This commit is contained in:
parent
f927204f64
commit
3bebe46d34
40 changed files with 194 additions and 56 deletions
|
@ -2609,7 +2609,7 @@ create_stdio(const PyConfig *config, PyObject* io,
|
|||
|
||||
#ifdef HAVE_WINDOWS_CONSOLE_IO
|
||||
/* Windows console IO is always UTF-8 encoded */
|
||||
PyTypeObject *winconsoleio_type = (PyTypeObject *)_PyImport_GetModuleAttr(
|
||||
PyTypeObject *winconsoleio_type = (PyTypeObject *)PyImport_ImportModuleAttr(
|
||||
&_Py_ID(_io), &_Py_ID(_WindowsConsoleIO));
|
||||
if (winconsoleio_type == NULL) {
|
||||
goto error;
|
||||
|
@ -2714,7 +2714,7 @@ init_set_builtins_open(void)
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (!(wrapper = _PyImport_GetModuleAttrString("io", "open"))) {
|
||||
if (!(wrapper = PyImport_ImportModuleAttrString("io", "open"))) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue