-
-
Notifications
You must be signed in to change notification settings - Fork 31.9k
nogil set clear
causes concurrent __str__
to print as empty dict
#129967
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
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-free-threading
type-bug
An unexpected behavior, bug, or error
Comments
Thanks - this is a bit of a weird one:
This can happen in the GIL-enabled build too, at least in Python 3.11 and earlier, where I think we should do two things:
|
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Feb 10, 2025
The call to `PySequence_List()` could temporarily unlock and relock the set, allowing the items to be cleared and return the incorrect notation `{}` for a empty set (it should be `set()`).
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Feb 11, 2025
colesbury
added a commit
that referenced
this issue
Feb 11, 2025
The call to `PySequence_List()` could temporarily unlock and relock the set, allowing the items to be cleared and return the incorrect notation `{}` for a empty set (it should be `set()`). Co-authored-by: T. Wouters <[email protected]>
colesbury
added a commit
to colesbury/cpython
that referenced
this issue
Feb 11, 2025
…29978) The call to `PySequence_List()` could temporarily unlock and relock the set, allowing the items to be cleared and return the incorrect notation `{}` for a empty set (it should be `set()`). (cherry picked from commit a7427f2) Co-authored-by: Sam Gross <[email protected]> Co-authored-by: T. Wouters <[email protected]>
colesbury
added a commit
that referenced
this issue
Feb 11, 2025
…30020) The call to `PySequence_List()` could temporarily unlock and relock the set, allowing the items to be cleared and return the incorrect notation `{}` for a empty set (it should be `set()`). (cherry picked from commit a7427f2) Co-authored-by: T. Wouters <[email protected]>
Thanks @luisggpina - this is fixed now in the main and 3.13 branches. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-free-threading
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
Hi,
We're a research group focused on testing concurrent runtimes. Our work-in-progress prototype found that the current nogil build
__str__
can return"{}"
(empty dict) instead of the expected"set()"
when there is a concurrentclear()
operation. The program below shows the wrong behavior:Sample output:
This behavior can be observed quite readily. We tested it on a number of x86_64 and one ARM machine.
@flypoodles and @overlorde are part of the team, adding them so they get notified about further discussion.
CPython versions tested on:
3.14, CPython main branch
Operating systems tested on:
Linux
Linked PRs
repr(set)
#129978repr(set)
(gh-129978) #130020The text was updated successfully, but these errors were encountered: