mirror of
https://github.com/python/cpython.git
synced 2026-01-06 15:32:22 +00:00
gh-108512: Add and use new replacements for PySys_GetObject() (GH-111035)
Add functions PySys_GetAttr(), PySys_GetAttrString(), PySys_GetOptionalAttr() and PySys_GetOptionalAttrString().
This commit is contained in:
parent
b265a7ddeb
commit
bac3fcba5b
32 changed files with 287 additions and 93 deletions
|
|
@ -12,7 +12,6 @@
|
|||
#include "pycore_object.h" // _PyType_AllocNoTrack
|
||||
#include "pycore_pyerrors.h" // _PyErr_FormatFromCause()
|
||||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||
#include "pycore_sysmodule.h" // _PySys_GetOptionalAttrString()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_EqualToASCIIString()
|
||||
|
||||
#include "osdefs.h" // MAXPATHLEN
|
||||
|
|
@ -1058,7 +1057,7 @@ _Py_module_getattro_impl(PyModuleObject *m, PyObject *name, int suppress)
|
|||
int is_possibly_shadowing_stdlib = 0;
|
||||
if (is_possibly_shadowing) {
|
||||
PyObject *stdlib_modules;
|
||||
if (_PySys_GetOptionalAttrString("stdlib_module_names", &stdlib_modules) < 0) {
|
||||
if (PySys_GetOptionalAttrString("stdlib_module_names", &stdlib_modules) < 0) {
|
||||
goto done;
|
||||
}
|
||||
if (stdlib_modules && PyAnySet_Check(stdlib_modules)) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue