Skip to content

gh-111971: Make _PyUnicode_FromId thread-safe in --disable-gil - #113489

Merged
corona10 merged 5 commits into
python:mainfrom
corona10:gh-111971
Dec 26, 2023
Merged

corona10 merged 5 commits into
python:mainfrom
corona10:gh-111971

Conversation

@corona10

@corona10 corona10 commented Dec 26, 2023 •

Copy link
Copy Markdown
Member
@corona10

Copy link
Copy Markdown
Member Author

@colesbury

I am not sure that this implementation is what you intended at #111971 (comment).

  1. When _Py_Identifier is initial status(index==-1), the first thread that got mutex will get a proper index value for this.
  2. the rest of the threads will get PyObject * from the current index.

@colesbury colesbury left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The _Py_static_string_init definition needs to be fixed, but otherwise looks okay

Comment thread Include/cpython/object.h Resolved
Comment thread Include/cpython/object.h Resolved
@corona10
corona10 enabled auto-merge (squash) December 26, 2023 16:24
@corona10
corona10 disabled auto-merge December 26, 2023 16:24
@corona10
corona10 enabled auto-merge (squash) December 26, 2023 16:25
@corona10
corona10 merged commit 8f5b998 into python:main Dec 26, 2023
@corona10
corona10 deleted the gh-111971 branch December 27, 2023 04:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants