Skip to content

Commit bccc1b7

Browse files
GH-109190: Copyedit 3.12 What's New: Improve the C-API deprecations section (#109751)
Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 2302fa1 commit bccc1b7

File tree

1 file changed

+96
-13
lines changed

1 file changed

+96
-13
lines changed

Doc/whatsnew/3.12.rst

Lines changed: 96 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1126,11 +1126,6 @@ Deprecated
11261126
:exc:`ImportWarning`).
11271127
(Contributed by Brett Cannon in :gh:`65961`.)
11281128

1129-
* In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:`PyDictObject`
1130-
is deprecated for extension modules. Accessing this field will generate a compiler
1131-
warning at compile time. This field will be removed in Python 3.14.
1132-
(Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. PEP by Ken Jin.)
1133-
11341129
* The bitwise inversion operator (``~``) on bool is deprecated. It will throw an
11351130
error in Python 3.14. Use ``not`` for logical negation of bools instead.
11361131
In the rare case that you really need the bitwise inversion of the underlying
@@ -1261,9 +1256,6 @@ Pending Removal in Python 3.14
12611256
* :mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`xml.etree.ElementTree.Element`
12621257
is deprecated and will raise an exception in Python 3.14.
12631258

1264-
* Creating immutable types (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
1265-
bases using the C API (:gh:`95388`).
1266-
12671259
* ``__package__`` and ``__cached__`` will cease to be set or taken
12681260
into consideration by the import system (:gh:`97879`).
12691261

@@ -1273,9 +1265,6 @@ Pending Removal in Python 3.14
12731265
May be removed in 3.14.
12741266
(Contributed by Nikita Sobolev in :gh:`101866`.)
12751267

1276-
* Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable
1277-
bases using the C API (:gh:`95388`)
1278-
12791268
Pending Removal in Future Versions
12801269
----------------------------------
12811270

@@ -2058,6 +2047,11 @@ Porting to Python 3.12
20582047
Deprecated
20592048
----------
20602049

2050+
* In accordance with :pep:`699`, the ``ma_version_tag`` field in :c:type:`PyDictObject`
2051+
is deprecated for extension modules. Accessing this field will generate a compiler
2052+
warning at compile time. This field will be removed in Python 3.14.
2053+
(Contributed by Ramvikrams and Kumar Aditya in :gh:`101193`. PEP by Ken Jin.)
2054+
20612055
* Deprecate global configuration variable:
20622056

20632057
* :c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`
@@ -2087,8 +2081,8 @@ Deprecated
20872081
:c:type:`PyConfig` instead.
20882082
(Contributed by Victor Stinner in :gh:`77782`.)
20892083

2090-
* Creating immutable types (:c:macro:`Py_TPFLAGS_IMMUTABLETYPE`) with mutable
2091-
bases is deprecated and will be disabled in Python 3.14.
2084+
* Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable
2085+
bases is deprecated and will be disabled in Python 3.14. (:gh:`95388`)
20922086

20932087
* The :file:`structmember.h` header is deprecated, though it continues to be
20942088
available and there are no plans to remove it.
@@ -2137,6 +2131,95 @@ Deprecated
21372131
overrides :c:member:`~PyTypeObject.tp_new` is deprecated.
21382132
Call the metaclass instead.
21392133

2134+
Pending Removal in Python 3.14
2135+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2136+
2137+
* The ``ma_version_tag`` field in :c:type:`PyDictObject` for extension modules
2138+
(:pep:`699`; :gh:`101193`).
2139+
2140+
* Global configuration variables:
2141+
2142+
* :c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`
2143+
* :c:var:`Py_VerboseFlag`: use :c:member:`PyConfig.verbose`
2144+
* :c:var:`Py_QuietFlag`: use :c:member:`PyConfig.quiet`
2145+
* :c:var:`Py_InteractiveFlag`: use :c:member:`PyConfig.interactive`
2146+
* :c:var:`Py_InspectFlag`: use :c:member:`PyConfig.inspect`
2147+
* :c:var:`Py_OptimizeFlag`: use :c:member:`PyConfig.optimization_level`
2148+
* :c:var:`Py_NoSiteFlag`: use :c:member:`PyConfig.site_import`
2149+
* :c:var:`Py_BytesWarningFlag`: use :c:member:`PyConfig.bytes_warning`
2150+
* :c:var:`Py_FrozenFlag`: use :c:member:`PyConfig.pathconfig_warnings`
2151+
* :c:var:`Py_IgnoreEnvironmentFlag`: use :c:member:`PyConfig.use_environment`
2152+
* :c:var:`Py_DontWriteBytecodeFlag`: use :c:member:`PyConfig.write_bytecode`
2153+
* :c:var:`Py_NoUserSiteDirectory`: use :c:member:`PyConfig.user_site_directory`
2154+
* :c:var:`Py_UnbufferedStdioFlag`: use :c:member:`PyConfig.buffered_stdio`
2155+
* :c:var:`Py_HashRandomizationFlag`: use :c:member:`PyConfig.use_hash_seed`
2156+
and :c:member:`PyConfig.hash_seed`
2157+
* :c:var:`Py_IsolatedFlag`: use :c:member:`PyConfig.isolated`
2158+
* :c:var:`Py_LegacyWindowsFSEncodingFlag`: use :c:member:`PyPreConfig.legacy_windows_fs_encoding`
2159+
* :c:var:`Py_LegacyWindowsStdioFlag`: use :c:member:`PyConfig.legacy_windows_stdio`
2160+
* :c:var:`!Py_FileSystemDefaultEncoding`: use :c:member:`PyConfig.filesystem_encoding`
2161+
* :c:var:`!Py_HasFileSystemDefaultEncoding`: use :c:member:`PyConfig.filesystem_encoding`
2162+
* :c:var:`!Py_FileSystemDefaultEncodeErrors`: use :c:member:`PyConfig.filesystem_errors`
2163+
* :c:var:`!Py_UTF8Mode`: use :c:member:`PyPreConfig.utf8_mode` (see :c:func:`Py_PreInitialize`)
2164+
2165+
The :c:func:`Py_InitializeFromConfig` API should be used with
2166+
:c:type:`PyConfig` instead.
2167+
2168+
* Creating :c:data:`immutable types <Py_TPFLAGS_IMMUTABLETYPE>` with mutable
2169+
bases (:gh:`95388`).
2170+
2171+
Pending Removal in Python 3.15
2172+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2173+
2174+
* :c:func:`PyImport_ImportModuleNoBlock`: use :c:func:`PyImport_ImportModule`
2175+
* :c:func:`PyWeakref_GET_OBJECT`: use :c:func:`PyWeakref_GetRef`
2176+
* :c:func:`PyWeakref_GetObject`: use :c:func:`PyWeakref_GetRef`
2177+
* :c:type:`!Py_UNICODE_WIDE` type: use :c:type:`wchar_t`
2178+
* :c:type:`Py_UNICODE` type: use :c:type:`wchar_t`
2179+
* Python initialization functions:
2180+
2181+
* :c:func:`PySys_ResetWarnOptions`: clear :data:`sys.warnoptions` and
2182+
:data:`!warnings.filters`
2183+
* :c:func:`Py_GetExecPrefix`: get :data:`sys.exec_prefix`
2184+
* :c:func:`Py_GetPath`: get :data:`sys.path`
2185+
* :c:func:`Py_GetPrefix`: get :data:`sys.prefix`
2186+
* :c:func:`Py_GetProgramFullPath`: get :data:`sys.executable`
2187+
* :c:func:`Py_GetProgramName`: get :data:`sys.executable`
2188+
* :c:func:`Py_GetPythonHome`: get :c:member:`PyConfig.home` or
2189+
the :envvar:`PYTHONHOME` environment variable
2190+
2191+
Pending Removal in Future Versions
2192+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2193+
2194+
The following APIs are deprecated and will be removed,
2195+
although there is currently no date scheduled for their removal.
2196+
2197+
* :c:macro:`Py_TPFLAGS_HAVE_FINALIZE`: unneeded since Python 3.8
2198+
* :c:func:`PyErr_Fetch`: use :c:func:`PyErr_GetRaisedException`
2199+
* :c:func:`PyErr_NormalizeException`: use :c:func:`PyErr_GetRaisedException`
2200+
* :c:func:`PyErr_Restore`: use :c:func:`PyErr_SetRaisedException`
2201+
* :c:func:`PyModule_GetFilename`: use :c:func:`PyModule_GetFilenameObject`
2202+
* :c:func:`PyOS_AfterFork`: use :c:func:`PyOS_AfterFork_Child`
2203+
* :c:func:`PySlice_GetIndicesEx`: use :c:func:`PySlice_Unpack` and :c:func:`PySlice_AdjustIndices`
2204+
* :c:func:`!PyUnicode_AsDecodedObject`: use :c:func:`PyCodec_Decode`
2205+
* :c:func:`!PyUnicode_AsDecodedUnicode`: use :c:func:`PyCodec_Decode`
2206+
* :c:func:`!PyUnicode_AsEncodedObject`: use :c:func:`PyCodec_Encode`
2207+
* :c:func:`!PyUnicode_AsEncodedUnicode`: use :c:func:`PyCodec_Encode`
2208+
* :c:func:`PyUnicode_READY`: unneeded since Python 3.12
2209+
* :c:func:`!PyErr_Display`: use :c:func:`PyErr_DisplayException`
2210+
* :c:func:`!_PyErr_ChainExceptions`: use ``_PyErr_ChainExceptions1``
2211+
* :c:member:`!PyBytesObject.ob_shash` member:
2212+
call :c:func:`PyObject_Hash` instead
2213+
* :c:member:`!PyDictObject.ma_version_tag` member
2214+
* Thread Local Storage (TLS) API:
2215+
2216+
* :c:func:`PyThread_create_key`: use :c:func:`PyThread_tss_alloc`
2217+
* :c:func:`PyThread_delete_key`: use :c:func:`PyThread_tss_free`
2218+
* :c:func:`PyThread_set_key_value`: use :c:func:`PyThread_tss_set`
2219+
* :c:func:`PyThread_get_key_value`: use :c:func:`PyThread_tss_get`
2220+
* :c:func:`PyThread_delete_key_value`: use :c:func:`PyThread_tss_delete`
2221+
* :c:func:`PyThread_ReInitTLS`: unneeded since Python 3.7
2222+
21402223
Removed
21412224
-------
21422225

0 commit comments

Comments
 (0)