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

gh-111971: Make _PyUnicode_FromId thread-safe in --disable-gil#113489
corona10 merged 5 commits into
python:mainfrom
corona10:gh-111971

Conversation

@corona10

@corona10corona10 commented Dec 26, 2023

Copy link
Copy Markdown
Member

@corona10

Copy link
Copy Markdown
MemberAuthor

@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.

@colesburycolesbury 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 threadInclude/cpython/object.h Outdated
Comment threadInclude/cpython/object.h
@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:mainDec 26, 2023
@corona10
corona10 deleted the gh-111971 branch December 27, 2023 04:03
Sign up for freeto 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.

2 participants

@corona10@colesbury