diff options
author | Irit Katriel <1055913+iritkatriel@users.noreply.github.com> | 2021-08-18 19:50:19 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-18 19:50:19 (GMT) |
commit | 31ee985db86c1339d00bd0d3cc1712019460670a (patch) | |
tree | 866b4e8377c49defb03247f5070ea7983533c344 /Include/cpython | |
parent | a3a4d20d6798aa2975428d51f3a4f890248810cb (diff) | |
download | cpython-31ee985db86c1339d00bd0d3cc1712019460670a.zip cpython-31ee985db86c1339d00bd0d3cc1712019460670a.tar.gz cpython-31ee985db86c1339d00bd0d3cc1712019460670a.tar.bz2 |
bpo-44874: deprecate Py_TRASHCAN_SAFE_BEGIN and Py_TRASHCAN_SAFE_END (GH-27693)
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Ćukasz Langa <lukasz@langa.pl>
Diffstat (limited to 'Include/cpython')
-rw-r--r-- | Include/cpython/object.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h index 75cd0f9..5ae6f36 100644 --- a/Include/cpython/object.h +++ b/Include/cpython/object.h @@ -534,7 +534,16 @@ PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc); Py_TRASHCAN_BEGIN_CONDITION(op, \ _PyTrash_cond(_PyObject_CAST(op), (destructor)dealloc)) -/* For backwards compatibility, these macros enable the trashcan - * unconditionally */ -#define Py_TRASHCAN_SAFE_BEGIN(op) Py_TRASHCAN_BEGIN_CONDITION(op, 1) -#define Py_TRASHCAN_SAFE_END(op) Py_TRASHCAN_END +/* The following two macros, Py_TRASHCAN_SAFE_BEGIN and + * Py_TRASHCAN_SAFE_END, are deprecated since version 3.11 and + * will be removed in the future. + * Use Py_TRASHCAN_BEGIN and Py_TRASHCAN_END instead. + */ +Py_DEPRECATED(3.11) typedef int UsingDeprecatedTrashcanMacro; +#define Py_TRASHCAN_SAFE_BEGIN(op) \ + do { \ + UsingDeprecatedTrashcanMacro cond=1; \ + Py_TRASHCAN_BEGIN_CONDITION(op, cond); +#define Py_TRASHCAN_SAFE_END(op) \ + Py_TRASHCAN_END; \ + } while(0); |