Skip to content
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

gh-112529: Stop the world around gc.get_referents #114823

Merged
merged 3 commits into from
Feb 6, 2024

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

Modules/gcmodule.c Outdated Show resolved Hide resolved
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 and others added 2 commits February 1, 2024 11:33
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
@colesbury colesbury merged commit 7fdd423 into python:main Feb 6, 2024
32 checks passed
@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 <Pablogsal@gmail.com>
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