diff options
author | Hai Shi <shihai1992@gmail.com> | 2020-11-25 06:03:31 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-24 23:03:31 +0100 |
commit | ed1a5a5baca8f61e9a99c5be3adc16b1801514fe (patch) | |
tree | f3db72407b31e7a94b025ab181455df83d770780 /Objects | |
parent | bpo-42392: Remove loop parameter form asyncio locks and Queue (#23420) (diff) | |
download | cpython-ed1a5a5baca8f61e9a99c5be3adc16b1801514fe.tar.gz cpython-ed1a5a5baca8f61e9a99c5be3adc16b1801514fe.tar.bz2 cpython-ed1a5a5baca8f61e9a99c5be3adc16b1801514fe.zip |
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 be7790eefd1..2e8717f506c 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) |