Skip to content

gh-133644: remove deprecated global configuration variables #133654

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 29 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
12f494a
remove `Py_BytesWarningFlag`
picnixz May 8, 2025
a6467f8
remove `Py_DebugFlag`
picnixz May 8, 2025
df48806
remove `Py_VerboseFlag`
picnixz May 8, 2025
cfabb22
remove `Py_QuietFlag`
picnixz May 8, 2025
71bca31
remove `Py_InspectFlag`
picnixz May 8, 2025
7ebf7bd
remove `Py_OptimizeFlag`
picnixz May 8, 2025
2d05afe
remove `Py_NoSiteFlag`
picnixz May 8, 2025
2a8e546
remove `Py_FrozenFlag`
picnixz May 8, 2025
93eee09
remove `Py_IgnoreEnvironmentFlag`
picnixz May 8, 2025
311f95c
remove `Py_DontWriteBytecodeFlag`
picnixz May 8, 2025
f5b39db
remove `Py_NoUserSiteDirectory`
picnixz May 8, 2025
c66edb3
remove `Py_UnbufferedStdioFlag`
picnixz May 8, 2025
9116a65
remove `Py_HashRandomizationFlag`
picnixz May 8, 2025
fb2a247
remove `Py_IsolatedFlag`
picnixz May 8, 2025
86c0c87
remove `Py_LegacyWindowsFSEncodingFlag`
picnixz May 8, 2025
eab9e01
remove `Py_LegacyWindowsStdioFlag`
picnixz May 8, 2025
54ff2aa
remove `Py_FileSystemDefaultEncoding` and `Py_HasFileSystemDefaultEnc…
picnixz May 8, 2025
9a322fe
remove `Py_FileSystemDefaultEncodeErrors`
picnixz May 8, 2025
d4ff0f7
fix test_embed
picnixz May 8, 2025
5d59540
blurb
picnixz May 8, 2025
eef039e
update What's New entries
picnixz May 8, 2025
1248cea
update docs
picnixz May 8, 2025
583bafb
update docutils refs
picnixz May 8, 2025
daa1e2d
fixup
picnixz May 8, 2025
6c7baa2
revert `putenv` statements
picnixz May 8, 2025
d9f4def
restore file
picnixz May 8, 2025
279ac00
update stable ABI symbols
picnixz May 8, 2025
cddebbe
revert runtime changes for now
picnixz May 8, 2025
b8afe23
Merge remote-tracking branch 'upstream/main' into cleanup/315/depreca…
picnixz May 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
242 changes: 7 additions & 235 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,103 +91,9 @@ and options. By default, these flags are controlled by :ref:`command line
options <using-on-interface-options>`.

When a flag is set by an option, the value of the flag is the number of times
that the option was set. For example, ``-b`` sets :c:data:`Py_BytesWarningFlag`
to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
that the option was set. For example, ``-b`` sets :c:member:`PyConfig.bytes_warning`
to 1 and ``-bb`` sets :c:member:`PyConfig.bytes_warning` to 2.

.. c:var:: int Py_BytesWarningFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.bytes_warning` should be used instead, see :ref:`Python
Initialization Configuration <init-config>`.

Issue a warning when comparing :class:`bytes` or :class:`bytearray` with
:class:`str` or :class:`bytes` with :class:`int`. Issue an error if greater
or equal to ``2``.

Set by the :option:`-b` option.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_DebugFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.parser_debug` should be used instead, see :ref:`Python
Initialization Configuration <init-config>`.

Turn on parser debugging output (for expert only, depending on compilation
options).

Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment
variable.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_DontWriteBytecodeFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.write_bytecode` should be used instead, see :ref:`Python
Initialization Configuration <init-config>`.

If set to non-zero, Python won't try to write ``.pyc`` files on the
import of source modules.

Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE`
environment variable.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_FrozenFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.pathconfig_warnings` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

Private flag used by ``_freeze_module`` and ``frozenmain`` programs.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_HashRandomizationFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.hash_seed` and :c:member:`PyConfig.use_hash_seed` should
be used instead, see :ref:`Python Initialization Configuration
<init-config>`.

Set to ``1`` if the :envvar:`PYTHONHASHSEED` environment variable is set to
a non-empty string.

If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment
variable to initialize the secret hash seed.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_IgnoreEnvironmentFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.use_environment` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

Ignore all :envvar:`!PYTHON*` environment variables, e.g.
:envvar:`PYTHONPATH` and :envvar:`PYTHONHOME`, that might be set.

Set by the :option:`-E` and :option:`-I` options.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_InspectFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.inspect` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

When a script is passed as first argument or the :option:`-c` option is used,
enter interactive mode after executing the script or the command, even when
:data:`sys.stdin` does not appear to be a terminal.

Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment
variable.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_InteractiveFlag

Expand All @@ -199,141 +105,6 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

.. deprecated:: 3.12

.. c:var:: int Py_IsolatedFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.isolated` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

Run Python in isolated mode. In isolated mode :data:`sys.path` contains
neither the script's directory nor the user's site-packages directory.

Set by the :option:`-I` option.

.. versionadded:: 3.4

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_LegacyWindowsFSEncodingFlag

This API is kept for backward compatibility: setting
:c:member:`PyPreConfig.legacy_windows_fs_encoding` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

If the flag is non-zero, use the ``mbcs`` encoding with ``replace`` error
handler, instead of the UTF-8 encoding with ``surrogatepass`` error handler,
for the :term:`filesystem encoding and error handler`.

Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSFSENCODING` environment
variable is set to a non-empty string.

See :pep:`529` for more details.

.. availability:: Windows.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_LegacyWindowsStdioFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.legacy_windows_stdio` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

If the flag is non-zero, use :class:`io.FileIO` instead of
:class:`!io._WindowsConsoleIO` for :mod:`sys` standard streams.

Set to ``1`` if the :envvar:`PYTHONLEGACYWINDOWSSTDIO` environment
variable is set to a non-empty string.

See :pep:`528` for more details.

.. availability:: Windows.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_NoSiteFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.site_import` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

Disable the import of the module :mod:`site` and the site-dependent
manipulations of :data:`sys.path` that it entails. Also disable these
manipulations if :mod:`site` is explicitly imported later (call
:func:`site.main` if you want them to be triggered).

Set by the :option:`-S` option.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_NoUserSiteDirectory

This API is kept for backward compatibility: setting
:c:member:`PyConfig.user_site_directory` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

Don't add the :data:`user site-packages directory <site.USER_SITE>` to
:data:`sys.path`.

Set by the :option:`-s` and :option:`-I` options, and the
:envvar:`PYTHONNOUSERSITE` environment variable.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_OptimizeFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.optimization_level` should be used instead, see
:ref:`Python Initialization Configuration <init-config>`.

Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment
variable.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_QuietFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.quiet` should be used instead, see :ref:`Python
Initialization Configuration <init-config>`.

Don't display the copyright and version messages even in interactive mode.

Set by the :option:`-q` option.

.. versionadded:: 3.2

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_UnbufferedStdioFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.buffered_stdio` should be used instead, see :ref:`Python
Initialization Configuration <init-config>`.

Force the stdout and stderr streams to be unbuffered.

Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED`
environment variable.

.. deprecated-removed:: 3.12 3.15

.. c:var:: int Py_VerboseFlag

This API is kept for backward compatibility: setting
:c:member:`PyConfig.verbose` should be used instead, see :ref:`Python
Initialization Configuration <init-config>`.

Print a message each time a module is initialized, showing the place
(filename or built-in module) from which it is loaded. If greater or equal
to ``2``, print a message for each file that is checked for when
searching for a module. Also provides information on module cleanup at exit.

Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment
variable.

.. deprecated-removed:: 3.12 3.15


Initializing and finalizing the interpreter
===========================================
Expand Down Expand Up @@ -499,10 +270,11 @@ Initializing and finalizing the interpreter

Note that if an otherwise unhandled :exc:`SystemExit` is raised, this
function will not return ``1``, but exit the process, as long as
``Py_InspectFlag`` is not set. If ``Py_InspectFlag`` is set, execution will
drop into the interactive Python prompt, at which point a second otherwise
unhandled :exc:`SystemExit` will still exit the process, while any other
means of exiting will set the return value as described above.
:c:member:`PyConfig.inspect` is not set. If :c:member:`!PyConfig.inspect`
is set, execution will drop into the interactive Python prompt, at which
point a second otherwise unhandled :exc:`SystemExit` will still exit the
process, while any other means of exiting will set the return value as
described above.

In terms of the CPython runtime configuration APIs documented in the
:ref:`runtime configuration <init-config>` section (and without accounting
Expand Down
32 changes: 16 additions & 16 deletions Doc/deprecations/c-api-pending-removal-in-3.15.rst
Original file line number Diff line number Diff line change
Expand Up @@ -68,56 +68,56 @@ Pending removal in Python 3.15

* Global configuration variables:

* :c:var:`Py_DebugFlag`:
* :c:var:`!Py_DebugFlag`:
Use :c:member:`PyConfig.parser_debug` or
:c:func:`PyConfig_Get("parser_debug") <PyConfig_Get>` instead.
* :c:var:`Py_VerboseFlag`:
* :c:var:`!Py_VerboseFlag`:
Use :c:member:`PyConfig.verbose` or
:c:func:`PyConfig_Get("verbose") <PyConfig_Get>` instead.
* :c:var:`Py_QuietFlag`:
* :c:var:`!Py_QuietFlag`:
Use :c:member:`PyConfig.quiet` or
:c:func:`PyConfig_Get("quiet") <PyConfig_Get>` instead.
* :c:var:`Py_InteractiveFlag`:
Use :c:member:`PyConfig.interactive` or
:c:func:`PyConfig_Get("interactive") <PyConfig_Get>` instead.
* :c:var:`Py_InspectFlag`:
* :c:var:`!Py_InspectFlag`:
Use :c:member:`PyConfig.inspect` or
:c:func:`PyConfig_Get("inspect") <PyConfig_Get>` instead.
* :c:var:`Py_OptimizeFlag`:
* :c:var:`!Py_OptimizeFlag`:
Use :c:member:`PyConfig.optimization_level` or
:c:func:`PyConfig_Get("optimization_level") <PyConfig_Get>` instead.
* :c:var:`Py_NoSiteFlag`:
* :c:var:`!Py_NoSiteFlag`:
Use :c:member:`PyConfig.site_import` or
:c:func:`PyConfig_Get("site_import") <PyConfig_Get>` instead.
* :c:var:`Py_BytesWarningFlag`:
* :c:var:`!Py_BytesWarningFlag`:
Use :c:member:`PyConfig.bytes_warning` or
:c:func:`PyConfig_Get("bytes_warning") <PyConfig_Get>` instead.
* :c:var:`Py_FrozenFlag`:
* :c:var:`!Py_FrozenFlag`:
Use :c:member:`PyConfig.pathconfig_warnings` or
:c:func:`PyConfig_Get("pathconfig_warnings") <PyConfig_Get>` instead.
* :c:var:`Py_IgnoreEnvironmentFlag`:
* :c:var:`!Py_IgnoreEnvironmentFlag`:
Use :c:member:`PyConfig.use_environment` or
:c:func:`PyConfig_Get("use_environment") <PyConfig_Get>` instead.
* :c:var:`Py_DontWriteBytecodeFlag`:
* :c:var:`!Py_DontWriteBytecodeFlag`:
Use :c:member:`PyConfig.write_bytecode` or
:c:func:`PyConfig_Get("write_bytecode") <PyConfig_Get>` instead.
* :c:var:`Py_NoUserSiteDirectory`:
* :c:var:`!Py_NoUserSiteDirectory`:
Use :c:member:`PyConfig.user_site_directory` or
:c:func:`PyConfig_Get("user_site_directory") <PyConfig_Get>` instead.
* :c:var:`Py_UnbufferedStdioFlag`:
* :c:var:`!Py_UnbufferedStdioFlag`:
Use :c:member:`PyConfig.buffered_stdio` or
:c:func:`PyConfig_Get("buffered_stdio") <PyConfig_Get>` instead.
* :c:var:`Py_HashRandomizationFlag`:
* :c:var:`!Py_HashRandomizationFlag`:
Use :c:member:`PyConfig.use_hash_seed`
and :c:member:`PyConfig.hash_seed` or
:c:func:`PyConfig_Get("hash_seed") <PyConfig_Get>` instead.
* :c:var:`Py_IsolatedFlag`:
* :c:var:`!Py_IsolatedFlag`:
Use :c:member:`PyConfig.isolated` or
:c:func:`PyConfig_Get("isolated") <PyConfig_Get>` instead.
* :c:var:`Py_LegacyWindowsFSEncodingFlag`:
* :c:var:`!Py_LegacyWindowsFSEncodingFlag`:
Use :c:member:`PyPreConfig.legacy_windows_fs_encoding` or
:c:func:`PyConfig_Get("legacy_windows_fs_encoding") <PyConfig_Get>` instead.
* :c:var:`Py_LegacyWindowsStdioFlag`:
* :c:var:`!Py_LegacyWindowsStdioFlag`:
Use :c:member:`PyConfig.legacy_windows_stdio` or
:c:func:`PyConfig_Get("legacy_windows_stdio") <PyConfig_Get>` instead.
* :c:var:`!Py_FileSystemDefaultEncoding`, :c:var:`!Py_HasFileSystemDefaultEncoding`:
Expand Down
34 changes: 17 additions & 17 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2150,24 +2150,24 @@ Deprecated

* Deprecate global configuration variable:

* :c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`
* :c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`
* :c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`
* :c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`
* :c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`
* :c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`
* :c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`
* :c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`
* :c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`
* :c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`
* :c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`
* :c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`
* :c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`
* :c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed`
* :c:var:`!Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`
* :c:var:`!Py_VerboseFlag`: use :c:member:`PyConfig.verbose`
* :c:var:`!Py_QuietFlag`: use :c:member:`PyConfig.quiet`
* :c:var:`!Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`
* :c:var:`!Py_InspectFlag`: use :c:member:`PyConfig.inspect`
* :c:var:`!Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`
* :c:var:`!Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`
* :c:var:`!Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`
* :c:var:`!Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`
* :c:var:`!Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`
* :c:var:`!Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`
* :c:var:`!Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`
* :c:var:`!Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`
* :c:var:`!Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed`
and :c:member:`PyConfig.hash_seed`
* :c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`
* :c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig.legacy_windows_fs_encoding`
* :c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig.legacy_windows_stdio`
* :c:var:`!Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`
* :c:var:`!Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig.legacy_windows_fs_encoding`
* :c:var:`!Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig.legacy_windows_stdio`
* :c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig.filesystem_encoding`
* :c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig.filesystem_encoding`
* :c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig.filesystem_errors`
Expand Down
Loading
Loading