diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2025-05-28 20:11:09 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-28 20:11:09 +0300 |
commit | bac3fcba5b2d83aa294267a456ccc36d86151dd4 (patch) | |
tree | 08897bbd4e0e94530371da6dad38cc5db438c91a /Python/import.c | |
parent | b265a7ddeb12b2040d80b471d447ce4c3ff4bb95 (diff) | |
download | cpython-bac3fcba5b2d83aa294267a456ccc36d86151dd4.tar.gz cpython-bac3fcba5b2d83aa294267a456ccc36d86151dd4.zip |
gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035)
Add functions PySys_GetAttr(), PySys_GetAttrString(),
PySys_GetOptionalAttr() and PySys_GetOptionalAttrString().
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Python/import.c b/Python/import.c index e7be1b90751..98557991378 100644 --- a/Python/import.c +++ b/Python/import.c @@ -3369,11 +3369,11 @@ PyObject * PyImport_GetImporter(PyObject *path) { PyThreadState *tstate = _PyThreadState_GET(); - PyObject *path_importer_cache = _PySys_GetRequiredAttrString("path_importer_cache"); + PyObject *path_importer_cache = PySys_GetAttrString("path_importer_cache"); if (path_importer_cache == NULL) { return NULL; } - PyObject *path_hooks = _PySys_GetRequiredAttrString("path_hooks"); + PyObject *path_hooks = PySys_GetAttrString("path_hooks"); if (path_hooks == NULL) { Py_DECREF(path_importer_cache); return NULL; @@ -3682,14 +3682,14 @@ import_find_and_load(PyThreadState *tstate, PyObject *abs_name) PyTime_t t1 = 0, accumulated_copy = accumulated; PyObject *sys_path, *sys_meta_path, *sys_path_hooks; - if (_PySys_GetOptionalAttrString("path", &sys_path) < 0) { + if (PySys_GetOptionalAttrString("path", &sys_path) < 0) { return NULL; } - if (_PySys_GetOptionalAttrString("meta_path", &sys_meta_path) < 0) { + if (PySys_GetOptionalAttrString("meta_path", &sys_meta_path) < 0) { Py_XDECREF(sys_path); return NULL; } - if (_PySys_GetOptionalAttrString("path_hooks", &sys_path_hooks) < 0) { + if (PySys_GetOptionalAttrString("path_hooks", &sys_path_hooks) < 0) { Py_XDECREF(sys_meta_path); Py_XDECREF(sys_path); return NULL; @@ -4127,7 +4127,7 @@ _PyImport_FiniCore(PyInterpreterState *interp) static int init_zipimport(PyThreadState *tstate, int verbose) { - PyObject *path_hooks = _PySys_GetRequiredAttrString("path_hooks"); + PyObject *path_hooks = PySys_GetAttrString("path_hooks"); if (path_hooks == NULL) { return -1; } |