Skip to content

Commit

Permalink
pythongh-105373: Remove C API global config vars in Python 3.14 (pyth…
Browse files Browse the repository at this point in the history
…on#106538)

Schedule the removal of C API global configuration variables in
Python 3.14. Announce the removal to help C extension maintainers to
upgrade their code.
  • Loading branch information
vstinner authored Jul 7, 2023
1 parent 1b29381 commit ffe70c4
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 44 deletions.
32 changes: 16 additions & 16 deletions Doc/c-api/init.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

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

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_DebugFlag
Expand All @@ -101,7 +101,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-d` option and the :envvar:`PYTHONDEBUG` environment
variable.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_DontWriteBytecodeFlag
Expand All @@ -115,7 +115,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-B` option and the :envvar:`PYTHONDONTWRITEBYTECODE`
environment variable.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_FrozenFlag
Expand All @@ -128,7 +128,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

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

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_HashRandomizationFlag
Expand All @@ -143,7 +143,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
If the flag is non-zero, read the :envvar:`PYTHONHASHSEED` environment
variable to initialize the secret hash seed.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_IgnoreEnvironmentFlag
Expand All @@ -156,7 +156,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

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

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_InspectFlag
Expand All @@ -171,7 +171,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-i` option and the :envvar:`PYTHONINSPECT` environment
variable.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_InteractiveFlag
Expand All @@ -196,7 +196,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

.. versionadded:: 3.4

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_LegacyWindowsFSEncodingFlag
Expand All @@ -215,7 +215,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

.. availability:: Windows.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_LegacyWindowsStdioFlag
Expand All @@ -233,7 +233,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

.. availability:: Windows.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_NoSiteFlag
Expand All @@ -248,7 +248,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

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

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_NoUserSiteDirectory
Expand All @@ -262,7 +262,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-s` and :option:`-I` options, and the
:envvar:`PYTHONNOUSERSITE` environment variable.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_OptimizeFlag
Expand All @@ -273,7 +273,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-O` option and the :envvar:`PYTHONOPTIMIZE` environment
variable.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_QuietFlag
Expand All @@ -287,7 +287,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.

.. versionadded:: 3.2

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_UnbufferedStdioFlag
Expand All @@ -300,7 +300,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-u` option and the :envvar:`PYTHONUNBUFFERED`
environment variable.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14

.. c:var:: int Py_VerboseFlag
Expand All @@ -316,7 +316,7 @@ to 1 and ``-bb`` sets :c:data:`Py_BytesWarningFlag` to 2.
Set by the :option:`-v` option and the :envvar:`PYTHONVERBOSE` environment
variable.

.. deprecated:: 3.12
.. deprecated-removed:: 3.12 3.14


Initializing and finalizing the interpreter
Expand Down
59 changes: 31 additions & 28 deletions Doc/whatsnew/3.13.rst
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,37 @@ Removed
:c:func:`PyInterpreterState_Get()` on Python 3.8 and older.
(Contributed by Victor Stinner in :gh:`106320`.)

Pending Removal in Python 3.14
------------------------------

* Global configuration variables:

* :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_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`
* :c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:`Py_PreInitialize`)

The :c:func:`Py_InitializeFromConfig` API should be used with
:c:type:`PyConfig` instead.

Pending Removal in Python 3.15
------------------------------

Expand Down Expand Up @@ -656,34 +687,6 @@ removed, although there is currently no date scheduled for their removal.
* :c:member:`!PyBytesObject.ob_shash` member:
call :c:func:`PyObject_Hash` instead.
* :c:member:`!PyDictObject.ma_version_tag` member.
* Global configuration variables:

* :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_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`
* :c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:`Py_PreInitialize`)

The :c:func:`Py_InitializeFromConfig` API should be used with
:c:type:`PyConfig` instead.

* TLS API:

* :c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc`.
Expand Down

0 comments on commit ffe70c4

Please sign in to comment.