summaryrefslogtreecommitdiffstats
path: root/Include
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2021-06-23 13:51:47 (GMT)
committerGitHub <noreply@github.com>2021-06-23 13:51:47 (GMT)
commitdb532a09990c837ec1348e6e6bd2719f5d4a8216 (patch)
treef5b93ef99f6faba98468bad23f53bcde2dda0369 /Include
parent2a396d65b8e63300ff05e217adacf0765c502ba3 (diff)
downloadcpython-db532a09990c837ec1348e6e6bd2719f5d4a8216.zip
cpython-db532a09990c837ec1348e6e6bd2719f5d4a8216.tar.gz
cpython-db532a09990c837ec1348e6e6bd2719f5d4a8216.tar.bz2
bpo-39947: Remove old private trashcan C API functions (GH-26869)
Remove 4 C API private trashcan functions which were only kept for the backward compatibility of the stable ABI with Python 3.8 and older, since the trashcan API was not usable with the limited C API on Python 3.8 and older. The trashcan API was excluded from the limited C API in Python 3.9. Removed functions: * _PyTrash_deposit_object() * _PyTrash_destroy_chain() * _PyTrash_thread_deposit_object() * _PyTrash_thread_destroy_chain() The trashcan C API was never usable with the limited C API, since old trashcan macros accessed directly PyThreadState members like "_tstate->trash_delete_nesting", whereas the PyThreadState structure is opaque in the limited C API. Exclude also the PyTrash_UNWIND_LEVEL constant from the C API. The trashcan C API was modified in Python 3.9 by commit 38965ec5411da60d312b59be281f3510d58e0cf1 and in Python 3.10 by commit ed1a5a5baca8f61e9a99c5be3adc16b1801514fe to hide implementation details.
Diffstat (limited to 'Include')
-rw-r--r--Include/cpython/object.h16
1 files changed, 2 insertions, 14 deletions
diff --git a/Include/cpython/object.h b/Include/cpython/object.h
index 84c60e5..75cd0f9 100644
--- a/Include/cpython/object.h
+++ b/Include/cpython/object.h
@@ -493,8 +493,8 @@ without deallocating anything (and so unbounded call-stack depth is avoided).
When the call stack finishes unwinding again, code generated by the END macro
notices this, and calls another routine to deallocate all the objects that
may have been added to the list of deferred deallocations. In effect, a
-chain of N deallocations is broken into (N-1)/(PyTrash_UNWIND_LEVEL-1) pieces,
-with the call stack never exceeding a depth of PyTrash_UNWIND_LEVEL.
+chain of N deallocations is broken into (N-1)/(_PyTrash_UNWIND_LEVEL-1) pieces,
+with the call stack never exceeding a depth of _PyTrash_UNWIND_LEVEL.
Since the tp_dealloc of a subclass typically calls the tp_dealloc of the base
class, we need to ensure that the trashcan is only triggered on the tp_dealloc
@@ -503,16 +503,6 @@ partially-deallocated object. To check this, the tp_dealloc function must be
passed as second argument to Py_TRASHCAN_BEGIN().
*/
-/* This is the old private API, invoked by the macros before 3.2.4.
- Kept for binary compatibility of extensions using the stable ABI. */
-PyAPI_FUNC(void) _PyTrash_deposit_object(PyObject*);
-PyAPI_FUNC(void) _PyTrash_destroy_chain(void);
-
-/* This is the old private API, invoked by the macros before 3.9.
- Kept for binary compatibility of extensions using the stable ABI. */
-PyAPI_FUNC(void) _PyTrash_thread_deposit_object(PyObject*);
-PyAPI_FUNC(void) _PyTrash_thread_destroy_chain(void);
-
/* Forward declarations for PyThreadState */
struct _ts;
@@ -522,8 +512,6 @@ PyAPI_FUNC(void) _PyTrash_end(struct _ts *tstate);
/* Python 3.10 private API, invoked by the Py_TRASHCAN_BEGIN(). */
PyAPI_FUNC(int) _PyTrash_cond(PyObject *op, destructor dealloc);
-#define PyTrash_UNWIND_LEVEL 50
-
#define Py_TRASHCAN_BEGIN_CONDITION(op, cond) \
do { \
PyThreadState *_tstate = NULL; \