@@ -15,8 +15,7 @@ Before Python initialization
1515
1616In an application embedding Python, the :c:func: `Py_Initialize ` function must
1717be called before using any other Python/C API functions; with the exception of
18- a few functions and the :ref: `global configuration variables
19- <global-conf-vars>`.
18+ a few functions.
2019
2120The following functions can be safely called before Python is initialized:
2221
@@ -75,277 +74,6 @@ The following functions can be safely called before Python is initialized:
7574 been initialized: :c:func: `Py_EncodeLocale `, and :c:func: `Py_RunMain `.
7675
7776
78- .. _global-conf-vars :
79-
80- Global configuration variables
81- ------------------------------
82-
83- Python has variables for the global configuration to control different features
84- and options. By default, these flags are controlled by :ref: `command line
85- options <using-on-interface-options>`.
86-
87- When a flag is set by an option, the value of the flag is the number of times
88- that the option was set. For example, ``-b `` sets :c:data: `Py_BytesWarningFlag `
89- to 1 and ``-bb `` sets :c:data: `Py_BytesWarningFlag ` to 2.
90-
91-
92- .. c :var :: int Py_BytesWarningFlag
93-
94- This API is kept for backward compatibility: setting
95- :c:member: `PyConfig.bytes_warning ` should be used instead, see :ref: `Python
96- Initialization Configuration <init-config>`.
97-
98- Issue a warning when comparing :class: `bytes ` or :class: `bytearray ` with
99- :class: `str ` or :class: `bytes ` with :class: `int `. Issue an error if greater
100- or equal to ``2 ``.
101-
102- Set by the :option: `-b ` option.
103-
104- .. deprecated-removed :: 3.12 3.16
105-
106-
107- .. c :var :: int Py_DebugFlag
108-
109- This API is kept for backward compatibility: setting
110- :c:member: `PyConfig.parser_debug ` should be used instead, see :ref: `Python
111- Initialization Configuration <init-config>`.
112-
113- Turn on parser debugging output (for expert only, depending on compilation
114- options).
115-
116- Set by the :option: `-d ` option and the :envvar: `PYTHONDEBUG ` environment
117- variable.
118-
119- .. deprecated-removed :: 3.12 3.16
120-
121-
122- .. c :var :: int Py_DontWriteBytecodeFlag
123-
124- This API is kept for backward compatibility: setting
125- :c:member: `PyConfig.write_bytecode ` should be used instead, see :ref: `Python
126- Initialization Configuration <init-config>`.
127-
128- If set to non-zero, Python won't try to write ``.pyc `` files on the
129- import of source modules.
130-
131- Set by the :option: `-B ` option and the :envvar: `PYTHONDONTWRITEBYTECODE `
132- environment variable.
133-
134- .. deprecated-removed :: 3.12 3.16
135-
136-
137- .. c :var :: int Py_FrozenFlag
138-
139- This API is kept for backward compatibility: setting
140- :c:member: `PyConfig.pathconfig_warnings ` should be used instead, see
141- :ref: `Python Initialization Configuration <init-config >`.
142-
143- Private flag used by ``_freeze_module `` and ``frozenmain `` programs.
144-
145- .. deprecated-removed :: 3.12 3.16
146-
147-
148- .. c :var :: int Py_HashRandomizationFlag
149-
150- This API is kept for backward compatibility: setting
151- :c:member: `PyConfig.hash_seed ` and :c:member: `PyConfig.use_hash_seed ` should
152- be used instead, see :ref: `Python Initialization Configuration
153- <init-config>`.
154-
155- Set to ``1 `` if the :envvar: `PYTHONHASHSEED ` environment variable is set to
156- a non-empty string.
157-
158- If the flag is non-zero, read the :envvar: `PYTHONHASHSEED ` environment
159- variable to initialize the secret hash seed.
160-
161- .. deprecated-removed :: 3.12 3.16
162-
163-
164- .. c :var :: int Py_IgnoreEnvironmentFlag
165-
166- This API is kept for backward compatibility: setting
167- :c:member: `PyConfig.use_environment ` should be used instead, see
168- :ref: `Python Initialization Configuration <init-config >`.
169-
170- Ignore all :envvar: `!PYTHON* ` environment variables, e.g.
171- :envvar: `PYTHONPATH ` and :envvar: `PYTHONHOME `, that might be set.
172-
173- Set by the :option: `-E ` and :option: `-I ` options.
174-
175- .. deprecated-removed :: 3.12 3.16
176-
177-
178- .. c :var :: int Py_InspectFlag
179-
180- This API is kept for backward compatibility: setting
181- :c:member: `PyConfig.inspect ` should be used instead, see
182- :ref: `Python Initialization Configuration <init-config >`.
183-
184- When a script is passed as first argument or the :option: `-c ` option is used,
185- enter interactive mode after executing the script or the command, even when
186- :data: `sys.stdin ` does not appear to be a terminal.
187-
188- Set by the :option: `-i ` option and the :envvar: `PYTHONINSPECT ` environment
189- variable.
190-
191- .. deprecated-removed :: 3.12 3.16
192-
193-
194- .. c :var :: int Py_InteractiveFlag
195-
196- This API is kept for backward compatibility: setting
197- :c:member: `PyConfig.interactive ` should be used instead, see
198- :ref: `Python Initialization Configuration <init-config >`.
199-
200- Set by the :option: `-i ` option.
201-
202- .. deprecated-removed :: 3.12 3.16
203-
204-
205- .. c :var :: int Py_IsolatedFlag
206-
207- This API is kept for backward compatibility: setting
208- :c:member: `PyConfig.isolated ` should be used instead, see
209- :ref: `Python Initialization Configuration <init-config >`.
210-
211- Run Python in isolated mode. In isolated mode :data: `sys.path ` contains
212- neither the script's directory nor the user's site-packages directory.
213-
214- Set by the :option: `-I ` option.
215-
216- .. versionadded :: 3.4
217-
218- .. deprecated-removed :: 3.12 3.16
219-
220-
221- .. c :var :: int Py_LegacyWindowsFSEncodingFlag
222-
223- This API is kept for backward compatibility: setting
224- :c:member: `PyPreConfig.legacy_windows_fs_encoding ` should be used instead, see
225- :ref: `Python Initialization Configuration <init-config >`.
226-
227- If the flag is non-zero, use the ``mbcs `` encoding with ``replace `` error
228- handler, instead of the UTF-8 encoding with ``surrogatepass `` error handler,
229- for the :term: `filesystem encoding and error handler `.
230-
231- Set to ``1 `` if the :envvar: `PYTHONLEGACYWINDOWSFSENCODING ` environment
232- variable is set to a non-empty string.
233-
234- See :pep: `529 ` for more details.
235-
236- .. availability :: Windows.
237-
238- .. deprecated-removed :: 3.12 3.16
239-
240-
241- .. c :var :: int Py_LegacyWindowsStdioFlag
242-
243- This API is kept for backward compatibility: setting
244- :c:member: `PyConfig.legacy_windows_stdio ` should be used instead, see
245- :ref: `Python Initialization Configuration <init-config >`.
246-
247- If the flag is non-zero, use :class: `io.FileIO ` instead of
248- :class: `!io._WindowsConsoleIO ` for :mod: `sys ` standard streams.
249-
250- Set to ``1 `` if the :envvar: `PYTHONLEGACYWINDOWSSTDIO ` environment
251- variable is set to a non-empty string.
252-
253- See :pep: `528 ` for more details.
254-
255- .. availability :: Windows.
256-
257- .. deprecated-removed :: 3.12 3.16
258-
259-
260- .. c :var :: int Py_NoSiteFlag
261-
262- This API is kept for backward compatibility: setting
263- :c:member: `PyConfig.site_import ` should be used instead, see
264- :ref: `Python Initialization Configuration <init-config >`.
265-
266- Disable the import of the module :mod: `site ` and the site-dependent
267- manipulations of :data: `sys.path ` that it entails. Also disable these
268- manipulations if :mod: `site ` is explicitly imported later (call
269- :func: `site.main ` if you want them to be triggered).
270-
271- Set by the :option: `-S ` option.
272-
273- .. deprecated-removed :: 3.12 3.16
274-
275-
276- .. c :var :: int Py_NoUserSiteDirectory
277-
278- This API is kept for backward compatibility: setting
279- :c:member: `PyConfig.user_site_directory ` should be used instead, see
280- :ref: `Python Initialization Configuration <init-config >`.
281-
282- Don't add the :data: `user site-packages directory <site.USER_SITE> ` to
283- :data: `sys.path `.
284-
285- Set by the :option: `-s ` and :option: `-I ` options, and the
286- :envvar: `PYTHONNOUSERSITE ` environment variable.
287-
288- .. deprecated-removed :: 3.12 3.16
289-
290-
291- .. c :var :: int Py_OptimizeFlag
292-
293- This API is kept for backward compatibility: setting
294- :c:member: `PyConfig.optimization_level ` should be used instead, see
295- :ref: `Python Initialization Configuration <init-config >`.
296-
297- Set by the :option: `-O ` option and the :envvar: `PYTHONOPTIMIZE ` environment
298- variable.
299-
300- .. deprecated-removed :: 3.12 3.16
301-
302-
303- .. c :var :: int Py_QuietFlag
304-
305- This API is kept for backward compatibility: setting
306- :c:member: `PyConfig.quiet ` should be used instead, see :ref: `Python
307- Initialization Configuration <init-config>`.
308-
309- Don't display the copyright and version messages even in interactive mode.
310-
311- Set by the :option: `-q ` option.
312-
313- .. versionadded :: 3.2
314-
315- .. deprecated-removed :: 3.12 3.16
316-
317-
318- .. c :var :: int Py_UnbufferedStdioFlag
319-
320- This API is kept for backward compatibility: setting
321- :c:member: `PyConfig.buffered_stdio ` should be used instead, see :ref: `Python
322- Initialization Configuration <init-config>`.
323-
324- Force the stdout and stderr streams to be unbuffered.
325-
326- Set by the :option: `-u ` option and the :envvar: `PYTHONUNBUFFERED `
327- environment variable.
328-
329- .. deprecated-removed :: 3.12 3.16
330-
331-
332- .. c :var :: int Py_VerboseFlag
333-
334- This API is kept for backward compatibility: setting
335- :c:member: `PyConfig.verbose ` should be used instead, see :ref: `Python
336- Initialization Configuration <init-config>`.
337-
338- Print a message each time a module is initialized, showing the place
339- (filename or built-in module) from which it is loaded. If greater or equal
340- to ``2 ``, print a message for each file that is checked for when
341- searching for a module. Also provides information on module cleanup at exit.
342-
343- Set by the :option: `-v ` option and the :envvar: `PYTHONVERBOSE ` environment
344- variable.
345-
346- .. deprecated-removed :: 3.12 3.16
347-
348-
34977Initializing and finalizing the interpreter
35078-------------------------------------------
35179
0 commit comments