diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-11-24 22:03:31 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 22:03:31 (GMT) |
commit | ed1a5a5baca8f61e9a99c5be3adc16b1801514fe (patch) | |
tree | f3db72407b31e7a94b025ab181455df83d770780 /Objects | |
parent | 0ec34cab9dd4a7bcddafaeeb445fae0f26afcdd1 (diff) | |
download | cpython-ed1a5a5baca8f61e9a99c5be3adc16b1801514fe.zip cpython-ed1a5a5baca8f61e9a99c5be3adc16b1801514fe.tar.gz cpython-ed1a5a5baca8f61e9a99c5be3adc16b1801514fe.tar.bz2 |
bpo-40170: Hide impl detail of Py_TRASHCAN_BEGIN macro (GH-23235)
The Py_TRASHCAN_BEGIN macro no longer accesses PyTypeObject attributes,
but now can get the condition by calling the new private
_PyTrash_cond() function which hides implementation details.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/object.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Objects/object.c b/Objects/object.c index be7790e..2e8717f 100644 --- a/Objects/object.c +++ b/Objects/object.c @@ -2134,6 +2134,15 @@ _PyTrash_end(PyThreadState *tstate) } +/* bpo-40170: It's only be used in Py_TRASHCAN_BEGIN macro to hide + implementation details. */ +int +_PyTrash_cond(PyObject *op, destructor dealloc) +{ + return Py_TYPE(op)->tp_dealloc == dealloc; +} + + void _Py_NO_RETURN _PyObject_AssertFailed(PyObject *obj, const char *expr, const char *msg, const char *file, int line, const char *function) |