bpo-34170: Add _PyCoreConfig.isolated (GH-8417) · python/cpython@d19d8d5 (original) (raw)
`@@ -28,7 +28,7 @@ typedef PyObject* (*_PyFrameEvalFunction)(struct _frame *, int);
`
28
28
`typedef struct {
`
29
29
`int install_signal_handlers; /* Install signal handlers? -1 means unset */
`
30
30
``
31
``
`-
int ignore_environment; /* -E, Py_IgnoreEnvironmentFlag */
`
``
31
`+
int ignore_environment; /* -E, Py_IgnoreEnvironmentFlag, -1 means unset */
`
32
32
`int use_hash_seed; /* PYTHONHASHSEED=x */
`
33
33
`unsigned long hash_seed;
`
34
34
`const char allocator; / Memory allocator: _PyMem_SetupAllocators() */
`
`@@ -75,18 +75,42 @@ typedef struct {
`
75
75
`wchar_t dll_path; / Windows DLL path */
`
76
76
`#endif
`
77
77
``
78
``
`-
/* Private fields */
`
79
``
`-
int _disable_importlib; /* Needed by freeze_importlib */
`
``
78
`+
/* If greater than 0, enable isolated mode: sys.path contains
`
``
79
`+
neither the script's directory nor the user's site-packages directory.
`
``
80
+
``
81
`+
Set to 1 by the -I command line option. If set to -1 (default), inherit
`
``
82
`+
Py_IsolatedFlag value. */
`
``
83
`+
int isolated;
`
``
84
+
``
85
`+
/* If equal to zero, disable the import of the module site and the
`
``
86
`+
site-dependent manipulations of sys.path that it entails. Also disable
`
``
87
`+
these manipulations if site is explicitly imported later (call
`
``
88
`+
site.main() if you want them to be triggered).
`
``
89
+
``
90
`+
Set to 0 by the -S command line option. If set to -1 (default), set to
`
``
91
`+
the negative value of Py_NoSiteFlag. */
`
``
92
`+
int site_import;
`
``
93
+
``
94
`+
/* --- Private fields -------- */
`
``
95
+
``
96
`+
/* Install importlib? If set to 0, importlib is not initialized at all.
`
``
97
`+
Needed by freeze_importlib: see install_importlib argument of
`
``
98
`+
_Py_InitializeEx_Private(). */
`
``
99
`+
int _install_importlib;
`
80
100
`} _PyCoreConfig;
`
81
101
``
82
102
`#define _PyCoreConfig_INIT \
`
83
103
` (_PyCoreConfig){ \
`
84
104
` .install_signal_handlers = -1, \
`
``
105
`+
.ignore_environment = -1, \
`
85
106
` .use_hash_seed = -1, \
`
86
107
` .coerce_c_locale = -1, \
`
87
108
` .utf8_mode = -1, \
`
88
109
` .argc = -1, \
`
89
``
`-
.nmodule_search_path = -1}
`
``
110
`+
.nmodule_search_path = -1, \
`
``
111
`+
.isolated = -1, \
`
``
112
`+
.site_import = -1, \
`
``
113
`+
._install_importlib = 1}
`
90
114
`/* Note: _PyCoreConfig_INIT sets other fields to 0/NULL */
`
91
115
``
92
116
`/* Placeholders while working on the new configuration API
`