GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-119213: Fix getargs.c to store state in InterpreterState... by 1st1 · Pull Request #119195 · python/cpython

Conversation

@1st1

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

Uh oh!

There was an error while loading. Please reload this page.

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

  • Issue: getargs.c is Breaking Interpeter Isolation #119213

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Yury Selivanov
fixargs
1ea7a5c
@1st1
1st1 requested a review from ericsnowcurrently as a code owner May 20, 2024 01:31
@bedevere-app bedevere-app Bot added the awaiting core review label May 20, 2024
@ericsnowcurrently 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
@bedevere-app bedevere-app Bot mentioned this pull request May 20, 2024
getargs.c is Breaking Interpeter Isolation #119213
Closed
erlend-aasland
erlend-aasland approved these changes May 20, 2024
View reviewed changes

@erlend-aasland erlend-aasland left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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 :)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bedevere-app bedevere-app Bot added awaiting merge and removed awaiting core review labels May 20, 2024
@colesbury

colesbury commented May 20, 2024

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:

cpython/Modules/clinic/_struct.c.h

Lines 49 to 53 in 6f7dd0a

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

erlend-aasland reacted with eyes emoji
All reactions
  • 👀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@erlend-aasland
erlend-aasland self-requested a review May 20, 2024 16:16
vstinner
vstinner reviewed May 20, 2024
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

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

@serhiy-storchaka wrote this API.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ericsnowcurrently

ericsnowcurrently commented May 21, 2024

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.

erlend-aasland reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericsnowcurrently

ericsnowcurrently commented May 22, 2024

Copy link
Copy Markdown
Member

superseded by gh-119331

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ericsnowcurrently ericsnowcurrently closed this May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner left review comments
@ericsnowcurrently ericsnowcurrently Awaiting requested review from ericsnowcurrently ericsnowcurrently is a code owner
@erlend-aasland erlend-aasland Awaiting requested review from erlend-aasland

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

awaiting merge

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@1st1 @colesbury @ericsnowcurrently @vstinner @erlend-aasland
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.