aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pylifecycle.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2025-01-30 12:17:29 +0100
committerGitHub <noreply@github.com>2025-01-30 11:17:29 +0000
commit3bebe46d3413195ee18c5c9ada83a35d4fd1d0e7 (patch)
tree8918bff5c9b4782e75a923014886d9b4b44bfed2 /Python/pylifecycle.c
parentf927204f64b3f8dbecec784e05bc8e25d2a78b2e (diff)
downloadcpython-3bebe46d3413195ee18c5c9ada83a35d4fd1d0e7.tar.gz
cpython-3bebe46d3413195ee18c5c9ada83a35d4fd1d0e7.zip
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.
Diffstat (limited to 'Python/pylifecycle.c')
-rw-r--r--Python/pylifecycle.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/pylifecycle.c b/Python/pylifecycle.c
index 00a98af998c..7031d743174 100644
--- a/Python/pylifecycle.c
+++ b/Python/pylifecycle.c
@@ -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;
}