diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2023-05-31 14:44:11 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-31 14:44:11 (GMT) |
commit | fbc9d0dbb22549bac2706f61f3ab631239d357b4 (patch) | |
tree | 05c7b90671fa33c4b9aadb1b1f991c9150abd336 /Doc | |
parent | 0430e97097a8f852aea21669e7f4203d028114f9 (diff) | |
download | cpython-fbc9d0dbb22549bac2706f61f3ab631239d357b4.zip cpython-fbc9d0dbb22549bac2706f61f3ab631239d357b4.tar.gz cpython-fbc9d0dbb22549bac2706f61f3ab631239d357b4.tar.bz2 |
gh-105111: remove deprecated macros Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END (#105112)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/whatsnew/3.13.rst | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.13.rst b/Doc/whatsnew/3.13.rst index 59c7f78..441b3ab 100644 --- a/Doc/whatsnew/3.13.rst +++ b/Doc/whatsnew/3.13.rst @@ -286,6 +286,11 @@ Removed third-party Tix library which the module wrapped is unmaintained. (Contributed by Zachary Ware in :gh:`75552`.) +* Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and + ``Py_TRASHCAN_SAFE_END``. They should be replaced by the new macros + ``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. The new macros were + added in Python 3.8 and the old macros were deprecated in Python 3.11. + (Contributed by Irit Katriel in :gh:`105111`.) Porting to Python 3.13 @@ -294,6 +299,35 @@ Porting to Python 3.13 This section lists previously described changes and other bugfixes that may require changes to your code. +* The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and ``Py_TRASHCAN_SAFE_END`` + were removed. They should be replaced by the new macros ``Py_TRASHCAN_BEGIN`` + and ``Py_TRASHCAN_END``. + + A tp_dealloc function that has the old macros, such as:: + + static void + mytype_dealloc(mytype *p) + { + PyObject_GC_UnTrack(p); + Py_TRASHCAN_SAFE_BEGIN(p); + ... + Py_TRASHCAN_SAFE_END + } + + should migrate to the new macros as follows:: + + static void + mytype_dealloc(mytype *p) + { + PyObject_GC_UnTrack(p); + Py_TRASHCAN_BEGIN(p, mytype_dealloc) + ... + Py_TRASHCAN_END + } + + Note that ``Py_TRASHCAN_BEGIN`` has a second argument which + should be the deallocation function it is in. + Build Changes ============= |