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-99205: Mark new interpreters and threads as non-static#99268

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

Merged

Conversation

@brandtbucher
Copy link
Member

@brandtbucherbrandtbucher commentedNov 9, 2022
edited by bedevere-bot
Loading

Kludex reacted with thumbs up emojigpshead reacted with heart emoji
@brandtbucherbrandtbucher added type-bugAn unexpected behavior, bug, or error interpreter-core(Objects, Python, Grammar, and Parser dirs) needs backport to 3.11only security fixes labelsNov 9, 2022
@brandtbucherbrandtbucher self-assigned thisNov 9, 2022
Copy link
Contributor

@kumaraditya303kumaraditya303 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@ericsnowcurrentlyericsnowcurrently left a comment

Choose a reason for hiding this comment

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

LGTM

I've pointed out two places where a comment would be appropriate. I'm approving the PR under the assumption you'll take care of those.

memcpy(tstate,
&initial._main_interpreter._initial_thread,
sizeof(*tstate));
tstate->_static= false;

Choose a reason for hiding this comment

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

Please add a note pointing toPyThreadState_INIT() and indicating that fields set there should be adjusted here as appropriate.

brandtbucher reacted with thumbs up emoji
// Set to _PyInterpreterState_INIT.
memcpy(interp,&initial._main_interpreter,
sizeof(*interp));
interp->_static= false;

Choose a reason for hiding this comment

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

Likewise, a note pointing toPyInterpreterState_INIT().

brandtbucher reacted with thumbs up emoji
@ericsnowcurrently
Copy link
Member

Thanks for fixing this, BTW.

gpshead reacted with thumbs up emoji

@brandtbucher
Copy link
MemberAuthor

@pablogsal, leak tests didn't catch this because we use the "raw" domain to allocatePyThreadState andPyInterpreterState.

ericsnowcurrently reacted with thumbs up emoji

@pablogsal
Copy link
Member

Oh interesting, can you confirm that changing the domain to memory makes the test fail?

@brandtbucher
Copy link
MemberAuthor

brandtbucher commentedNov 9, 2022
edited
Loading

Oh interesting, can you confirm that changing the domain to memory makes the test fail?

You can't. :)

Fatal Python error: _PyMem_DebugCalloc: Python memory allocator called without holding the GILPython runtime state: preinitialized

See this comment:

// We don't need to allocate a thread state for the main interpreter
// (the common case), but doing it later for the other case revealed a
// reentrancy problem (deadlock). So for now we always allocate before
// taking the interpreters lock. See GH-96071.

@brandtbucherbrandtbucher merged commit283ab0e intopython:mainNov 9, 2022
@miss-islington
Copy link
Contributor

Thanks@brandtbucher for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-bot
Copy link

GH-99301 is a backport of this pull request to the3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestNov 9, 2022
…onGH-99268)(cherry picked from commit283ab0e)Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelNov 9, 2022
miss-islington added a commit that referenced this pull requestNov 9, 2022
(cherry picked from commit283ab0e)Co-authored-by: Brandt Bucher <brandtbucher@microsoft.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@ericsnowcurrentlyericsnowcurrentlyericsnowcurrently approved these changes

@kumaraditya303kumaraditya303kumaraditya303 approved these changes

@pablogsalpablogsalAwaiting requested review from pablogsal

Assignees

@brandtbucherbrandtbucher

Labels

interpreter-core(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or error

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

6 participants

@brandtbucher@ericsnowcurrently@pablogsal@miss-islington@bedevere-bot@kumaraditya303

[8]ページ先頭

©2009-2025 Movatter.jp