8000 bpo-44881: Integrate GC untrack into trashcan begin. by nascheme · Pull Request #27718 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44881: Integrate GC untrack into trashcan begin. #27718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments. 8000
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
small cleanup, move declarations after
It seems slightly cleaner to have the BEGIN/END macros at the start and
end of the dealloc function body.
  • Loading branch information
nascheme committed Aug 11, 2021
commit 42a10b4c503a7df4be0ee093428e1e6bfc0094a8
2 changes: 0 additions & 2 deletions Include/cpython/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -469,8 +469,6 @@ function with a pair of macros:
static void
mytype_dealloc(mytype *p)
{
... declarations go here ...

Py_TRASHCAN_BEGIN(p, mytype_dealloc)
... The body of the deallocator goes here, including all calls ...
... to Py_DECREF on contained objects. ...
Expand Down
2 changes: 1 addition & 1 deletion Objects/dictobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -1924,11 +1924,11 @@ _PyDict_FromKeys(PyObject *cls, PyObject *iterable, PyObject *value)
static void
dict_dealloc(PyDictObject *mp)
{
Py_TRASHCAN_BEGIN(mp, dict_dealloc)
PyObject **values = mp->ma_values;
PyDictKeysObject *keys = mp->ma_keys;
Py_ssize_t i, n;

Py_TRASHCAN_BEGIN(mp, dict_dealloc)
if (values != NULL) {
if (values != empty_values) {
for (i = 0, n = mp->ma_keys->dk_nentries; i < n; i++) {
Expand Down
2 changes: 1 addition & 1 deletion Objects/listobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,8 @@ PyList_Append(PyObject *op, PyObject *newitem)
static void
list_dealloc(PyListObject *op)
{
Py_ssize_t i;
Py_TRASHCAN_BEGIN(op, list_dealloc)
Py_ssize_t i;
if (op->ob_item != NULL) {
/* Do it backwards, for Christian Tismer.
There's a simple test case where somehow this reduces
Expand Down
2 changes: 1 addition & 1 deletion Objects/setobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,10 +482,10 @@ set_next(PySetObject *so, Py_ssize_t *pos_ptr, setentry **entry_ptr)
static void
set_dealloc(PySetObject *so)
{
Py_TRASHCAN_BEGIN(so, set_dealloc)
setentry *entry;
Py_ssize_t used = so->used;

Py_TRASHCAN_BEGIN(so, set_dealloc)
if (so->weakreflist != NULL)
PyObject_ClearWeakRefs((PyObject *) so);

Expand Down
2 changes: 1 addition & 1 deletion Objects/tupleobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,8 @@ PyTuple_Pack(Py_ssize_t n, ...)
static void
tupledealloc(PyTupleObject *op)
{
Py_ssize_t len = Py_SIZE(op);
Py_TRASHCAN_BEGIN(op, tupledealloc)
Py_ssize_t len = Py_SIZE(op);
if (len > 0) {
Py_ssize_t i = len;
while (--i >= 0) {
Expand Down
3 changes: 1 addition & 2 deletions Python/hamt.c
Original file line number Diff line number Diff line change
Expand Up @@ -1558,12 +1558,11 @@ hamt_node_collision_traverse(PyHamtNode_Collision *self,
static void
hamt_node_collision_dealloc(PyHamtNode_Collision *self)
{
Py_TRASHCAN_BEGIN(self, hamt_node_collision_dealloc)
/* Collision's tp_dealloc */

Py_ssize_t len = Py_SIZE(self);

Py_TRASHCAN_BEGIN(self, hamt_node_collision_dealloc)

if (len > 0) {

while (--len >= 0) {
Expand Down
0