Skip to content

Commit a192517

Browse files
miss-islingtonAA-Turnerserhiy-storchaka
authored
[3.12] GH-109190: Copyedit 3.12 What's New: Improve the C-API deprecations section (GH-109751) (#109830)
* GH-109190: Copyedit 3.12 What's New: Improve the C-API deprecations section (GH-109751) (cherry picked from commit bccc1b7) Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]> * Remove the weakref get object functions --------- Co-authored-by: Adam Turner <[email protected]> Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent de6d17c commit a192517

File tree

1 file changed

+94
-13
lines changed

1 file changed

+94
-13
lines changed

Doc/whatsnew/3.12.rst

+94-13
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
@@ -1260,9 +1255,6 @@ Pending Removal in Python 3.14
12601255
* :mod:`xml.etree.ElementTree`: Testing the truth value of an :class:`xml.etree.ElementTree.Element`
12611256
is deprecated and will raise an exception in Python 3.14.
12621257

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

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

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

@@ -2059,6 +2048,11 @@ Porting to Python 3.12
20592048
Deprecated
20602049
----------
20612050

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

20642058
* :c:var:`Py_DebugFlag`: use :c:member:`PyConfig.parser_debug`
@@ -2088,8 +2082,8 @@ Deprecated
20882082
:c:type:`PyConfig` instead.
20892083
(Contributed by Victor Stinner in :gh:`77782`.)
20902084

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

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

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

0 commit comments

Comments
 (0)