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

Appearance settings

bpo-45691: Make array of small ints static to fix use-after-free error.#29366

Merged
markshannon merged 2 commits into
python:mainpython/cpython:mainfrom
faster-cpython:make-small-ints-staticfaster-cpython/cpython:make-small-ints-staticCopy head branch name to clipboard
Nov 3, 2021
Merged

bpo-45691: Make array of small ints static to fix use-after-free error.#29366
markshannon merged 2 commits into
python:mainpython/cpython:mainfrom
faster-cpython:make-small-ints-staticfaster-cpython/cpython:make-small-ints-staticCopy head branch name to clipboard

Conversation

@markshannon

@markshannon markshannon commented Nov 2, 2021

Copy link
Copy Markdown
Member

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

Note the small ints have been in PyInterpreterState for a while. We didn't get use-after-free until gh-29274. So perhaps we could just revert that one? The general underlying problem in bpo-45691 is one we'll have to fix regardless, so there's no need to go all the way back to using a static global.

Otherwise this looks fine.

(I'm approving assuming that you'll take my feedback into consideration before merging and discuss if you disagree.)

@markshannon

markshannon commented Nov 2, 2021

Copy link
Copy Markdown
Member Author

As I stated in bpo-45691, we need to make everything static or per-interpreter. Right now that means static.

The best way to move towards multiple interpreters is to merge all the static state into a single struct. That way there is only one static value to convert to per-interpreter when we are ready.

We can start with the small ints 🙂

@ericsnowcurrently

ericsnowcurrently commented Nov 2, 2021

Copy link
Copy Markdown
Member

The best way to move towards multiple interpreters is to merge all the static state into a single struct.

FYI, that's exactly what _PyRuntimeState is (with a handful of things that will stay global). 🙂

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

I'm good with this.

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.

4 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.