FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-119213: Fix getargs.c to store state in InterpreterState... by 1st1 · Pull Request #119195 · python/cpython · GitHub

/ cpython Public

gh-119213: Fix getargs.c to store state in InterpreterState... - #119195

Closed
1st1 wants to merge 1 commit into
python:mainfrom
1st1:fixargs
Closed

gh-119213: Fix getargs.c to store state in InterpreterState...#119195
1st1 wants to merge 1 commit into
python:mainfrom
1st1:fixargs

Conversation

1st1 commented May 20, 2024
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Member

...as opposed to storing it in PyRuntime. Storing it in PyRuntime
is fundametally wrong, as its state contains references to Python
objects. Those objects (tuples and strings) can (and will) be
picked by various subinterpreter clean up code, leaving PyRuntime
with broken pointers.

#119194 is a backport to 3.12

1st1 requested a review from ericsnowcurrently as a code owner May 20, 2024 01:31
ericsnowcurrently changed the title Fix getargs.c to store state in InterpreterState... gh-119213: Fix getargs.c to store state in InterpreterState... May 20, 2024

erlend-aasland 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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

LGTM; perhaps it would make sense to init getargs state just after _PyGC_Init, but I'm not sure it matters; I'll leave that kind of nitpicking to Eric :)

Copy link
Copy Markdown
Contributor

How does this work when the _PyArg_Parser instances are themselves declared as static variables (and are global to the process)? For example:

static _PyArg_Parser _parser = {
.keywords = _keywords,
.fname = "Struct",
.kwtuple = KWTUPLE,
};

erlend-aasland self-requested a review May 20, 2024 16:16

vstinner left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@serhiy-storchaka: Would you mind to review this change?

@serhiy-storchaka wrote this API.

Copy link
Copy Markdown
Member

@colesbury, I'm looking into what's going on. Basically, the statically declared tuple is only for builtin modules. I have a solution that's different from Yury's but want to be sure it's correct before closing this one.

Copy link
Copy Markdown
Member

superseded by gh-119331

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to 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.

5 participants


Back | FazBrowse Home | New Git URL