Skip to content

Commit 3891e21

Browse files
committed
Move C API removal to correct section
1 parent ea2eda2 commit 3891e21

File tree

1 file changed

+37
-34
lines changed

1 file changed

+37
-34
lines changed

Doc/whatsnew/3.13.rst

+37-34
Original file line numberDiff line numberDiff line change
@@ -932,47 +932,15 @@ webbrowser
932932
Others
933933
------
934934

935-
* Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and
936-
``Py_TRASHCAN_SAFE_END``. They should be replaced by the new macros
937-
``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. The new macros were
938-
added in Python 3.8 and the old macros were deprecated in Python 3.11.
939-
(Contributed by Irit Katriel in :gh:`105111`.)
940-
935+
* None yet
941936

942937
Porting to Python 3.13
943938
======================
944939

945940
This section lists previously described changes and other bugfixes
946941
that may require changes to your code.
947942

948-
* The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and ``Py_TRASHCAN_SAFE_END``
949-
were removed. They should be replaced by the new macros ``Py_TRASHCAN_BEGIN``
950-
and ``Py_TRASHCAN_END``.
951-
952-
A tp_dealloc function that has the old macros, such as::
953-
954-
static void
955-
mytype_dealloc(mytype *p)
956-
{
957-
PyObject_GC_UnTrack(p);
958-
Py_TRASHCAN_SAFE_BEGIN(p);
959-
...
960-
Py_TRASHCAN_SAFE_END
961-
}
962-
963-
should migrate to the new macros as follows::
964-
965-
static void
966-
mytype_dealloc(mytype *p)
967-
{
968-
PyObject_GC_UnTrack(p);
969-
Py_TRASHCAN_BEGIN(p, mytype_dealloc)
970-
...
971-
Py_TRASHCAN_END
972-
}
973-
974-
Note that ``Py_TRASHCAN_BEGIN`` has a second argument which
975-
should be the deallocation function it is in.
943+
* None yet
976944

977945

978946
Build Changes
@@ -1168,6 +1136,35 @@ Porting to Python 3.13
11681136
are now undefined by ``<Python.h>``.
11691137
(Contributed by Victor Stinner in :gh:`85283`.)
11701138

1139+
* The old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and ``Py_TRASHCAN_SAFE_END``
1140+
were removed. They should be replaced by the new macros ``Py_TRASHCAN_BEGIN``
1141+
and ``Py_TRASHCAN_END``.
1142+
1143+
A tp_dealloc function that has the old macros, such as::
1144+
1145+
static void
1146+
mytype_dealloc(mytype *p)
1147+
{
1148+
PyObject_GC_UnTrack(p);
1149+
Py_TRASHCAN_SAFE_BEGIN(p);
1150+
...
1151+
Py_TRASHCAN_SAFE_END
1152+
}
1153+
1154+
should migrate to the new macros as follows::
1155+
1156+
static void
1157+
mytype_dealloc(mytype *p)
1158+
{
1159+
PyObject_GC_UnTrack(p);
1160+
Py_TRASHCAN_BEGIN(p, mytype_dealloc)
1161+
...
1162+
Py_TRASHCAN_END
1163+
}
1164+
1165+
Note that ``Py_TRASHCAN_BEGIN`` has a second argument which
1166+
should be the deallocation function it is in.
1167+
11711168
* The :c:func:`PyUnicode_AsUTF8` function now raises an exception if the string
11721169
contains embedded null characters. To accept embedded null characters and
11731170
truncate on purpose at the first null byte,
@@ -1302,6 +1299,12 @@ Removed
13021299
Configuration <init-config>` instead (:pep:`587`), added to Python 3.8.
13031300
(Contributed by Victor Stinner in :gh:`105145`.)
13041301

1302+
* Remove the old trashcan macros ``Py_TRASHCAN_SAFE_BEGIN`` and
1303+
``Py_TRASHCAN_SAFE_END``. They should be replaced by the new macros
1304+
``Py_TRASHCAN_BEGIN`` and ``Py_TRASHCAN_END``. The new macros were
1305+
added in Python 3.8 and the old macros were deprecated in Python 3.11.
1306+
(Contributed by Irit Katriel in :gh:`105111`.)
1307+
13051308
* Remove ``PyEval_InitThreads()`` and ``PyEval_ThreadsInitialized()``
13061309
functions, deprecated in Python 3.9. Since Python 3.7, ``Py_Initialize()``
13071310
always creates the GIL: calling ``PyEval_InitThreads()`` did nothing and

0 commit comments

Comments
 (0)