Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Jan 31, 2024

We do not want to add locking in tp_traverse slot implementations. Instead, stop-the-world when calling gc.get_referents. Note that the the stop-the-world call is a no-op in the default build.

We do not want to add locking in tp_traverse slot implementations.
Instead, stop-the-world when calling gc.get_referents. Note that the the
stop-the-world call is a no-op in the default build.
Copy link
Member

@pablogsal pablogsal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Left a small nit, feel free to ignore

PyObject *obj = PyTuple_GET_ITEM(args, i);

if (!_PyObject_IS_GC(obj))
continue;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: Do you mind adding braces here to conform with PEP 7? (I know we are just moving code around but now that we are changing it it's a good opportunity)

@colesbury colesbury merged commit 7fdd423 into python:main Feb 6, 2024
@colesbury colesbury deleted the gh-112529-get-referents branch February 6, 2024 16:45
fsc-eriker pushed a commit to fsc-eriker/cpython that referenced this pull request Feb 14, 2024
We do not want to add locking in `tp_traverse` slot implementations.
Instead, stop the world when calling `gc.get_referents`. Note that the the
stop the world call is a no-op in the default build.

Co-authored-by: Pablo Galindo Salgado <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants