Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-100227: Make the Global Interned Dict Safe for Isolated Interpreters#102925

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation

ericsnowcurrently
Copy link
Member

@ericsnowcurrentlyericsnowcurrently commentedMar 22, 2023
edited by bedevere-bot
Loading

This is effectively two changes. The first (the bulk of the change) is where we add_Py_AddToGlobalDict() (and_PyRuntime.cached_objects.main_tstate, etc.). The second (much smaller) change is where we updatePyUnicode_InternInPlace() to use_Py_AddToGlobalDict() instead of callingPyDict_SetDefault() directly.

Basically,_Py_AddToGlobalDict() is a wrapper aroundPyDict_SetDefault() that should be used whenever we need to add a value to a runtime-global dict object (in the few cases where we are leaving the container global rather than moving it toPyInterpreterState, e.g. the interned strings dict)._Py_AddToGlobalDict() does all the necessary work to make sure the target global dict is shared safely between isolated interpreters. This is especially important as we move the obmalloc state to each interpreter (gh-101660), as well as, potentially, the GIL (PEP 684).

(This is an alternative to#102339, where we keep the interned dict global instead of making it per-interpreter.)

@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@ericsnowcurrently for commit22753b3 🤖

If you want to schedule another build, you need to add the🔨 test-with-refleak-buildbots label again.

@ericsnowcurrentlyericsnowcurrently deleted the interned-dict-owned-by-main-interpreter branchMarch 23, 2023 00:30
Fidget-Spinner pushed a commit to Fidget-Spinner/cpython that referenced this pull requestMar 27, 2023
…rpreters (pythongh-102925)This is effectively two changes.  The first (the bulk of the change) is where we add _Py_AddToGlobalDict() (and _PyRuntime.cached_objects.main_tstate, etc.).  The second (much smaller) change is where we update PyUnicode_InternInPlace() to use _Py_AddToGlobalDict() instead of calling PyDict_SetDefault() directly.Basically, _Py_AddToGlobalDict() is a wrapper around PyDict_SetDefault() that should be used whenever we need to add a value to a runtime-global dict object (in the few cases where we are leaving the container global rather than moving it to PyInterpreterState, e.g. the interned strings dict).  _Py_AddToGlobalDict() does all the necessary work to make sure the target global dict is shared safely between isolated interpreters.  This is especially important as we move the obmalloc state to each interpreter (pythongh-101660), as well as, potentially, the GIL (PEP 684).python#100227
ericsnowcurrently added a commit to ericsnowcurrently/cpython that referenced this pull requestMar 27, 2023
ericsnowcurrently added a commit that referenced this pull requestMar 27, 2023
… Safe for Isolated Interpreters" (gh-103063)This reverts commit 87be8d9.This approach to keeping the interned strings safe is turning out to be too complex for my taste (due to obmalloc isolation). For now I'm going with the simpler solution, making the dict per-interpreter. We can revisit that later if we want a sharing solution.
warsaw pushed a commit to warsaw/cpython that referenced this pull requestApr 11, 2023
…rpreters (pythongh-102925)This is effectively two changes.  The first (the bulk of the change) is where we add _Py_AddToGlobalDict() (and _PyRuntime.cached_objects.main_tstate, etc.).  The second (much smaller) change is where we update PyUnicode_InternInPlace() to use _Py_AddToGlobalDict() instead of calling PyDict_SetDefault() directly.Basically, _Py_AddToGlobalDict() is a wrapper around PyDict_SetDefault() that should be used whenever we need to add a value to a runtime-global dict object (in the few cases where we are leaving the container global rather than moving it to PyInterpreterState, e.g. the interned strings dict).  _Py_AddToGlobalDict() does all the necessary work to make sure the target global dict is shared safely between isolated interpreters.  This is especially important as we move the obmalloc state to each interpreter (pythongh-101660), as well as, potentially, the GIL (PEP 684).python#100227
warsaw pushed a commit to warsaw/cpython that referenced this pull requestApr 11, 2023
…obal Interned Dict Safe for Isolated Interpreters" (pythongh-103063)This reverts commit 87be8d9.This approach to keeping the interned strings safe is turning out to be too complex for my taste (due to obmalloc isolation). For now I'm going with the simpler solution, making the dict per-interpreter. We can revisit that later if we want a sharing solution.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@kumaraditya303kumaraditya303Awaiting requested review from kumaraditya303

Assignees
No one assigned
Labels
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

2 participants
@ericsnowcurrently@bedevere-bot

[8]ページ先頭

©2009-2025 Movatter.jp