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-95795: Move types.next_version_tag to PyInterpreterState by ericsnowcurrently · Pull Request #102343 · python/cpython

Conversation

@ericsnowcurrently

@ericsnowcurrently ericsnowcurrently commented Feb 28, 2023 •
edited by bedevere-bot
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Core static types will continue to use the global value. All other types will use the per-interpreter value. They all share the same range, where the global types use values < 2^16 and each interpreter uses values higher than that.

  • Issue: [subinterpreter] Make type version tag counter threadsafe for per interpreter GIL #95795

Sorry, something went wrong.

Uh oh!

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

All reactions
@ericsnowcurrently
Move types.next_version_tag to PyInterpreterState for non-core-static…
83e16d5
… types.
@ericsnowcurrently ericsnowcurrently added the skip news label Feb 28, 2023
@ericsnowcurrently
ericsnowcurrently requested a review from markshannon as a code owner February 28, 2023 21:54
@bedevere-bot bedevere-bot added the awaiting core review label Feb 28, 2023
@bedevere-bot bedevere-bot mentioned this pull request Feb 28, 2023
[subinterpreter] Make type version tag counter threadsafe for per interpreter GIL #95795
Closed
@ericsnowcurrently
ericsnowcurrently marked this pull request as draft February 28, 2023 22:52
ericsnowcurrently added 5 commits March 3, 2023 11:56
@ericsnowcurrently
Add NEXT_GLOBAL_VERSION_TAG.
c9281e4
@ericsnowcurrently
Handle static types correctly in assign_version_tag().
95ffcd1
@ericsnowcurrently
Verify that builtin types have builtin bases.
f3b707d
@ericsnowcurrently
Add an assert.
c32b834
@ericsnowcurrently
Do not invalidate the method cache for static builtin types.
6362a36
@ericsnowcurrently ericsnowcurrently mentioned this pull request Mar 16, 2023
Move _Py_RefTotal to PyInterpreterState #102304
Closed
brandtbucher
brandtbucher reviewed Mar 20, 2023
View reviewed changes

@brandtbucher brandtbucher left a comment •
edited
Loading

Uh oh!

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

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.

One minor note from a first readthrough. Honestly, I have no idea why this PR would cause an assertion failure in insertdict during an attribute load. Everything about that seems wrong.

Maybe try rerunning locally, but setting ENABLE_SPECIALIZATION = False in opcode.py and regenerating everything. That way we can try to figure out if specialization is indeed the culprit, or if this is maybe some freeze/deepfreeze weirdness.

Sorry, something went wrong.

Uh oh!

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

All reactions
Comment thread Include/internal/pycore_typeobject.h
the same __name__, for any __name__. Since that's a static property, it is
appropriate to declare fixed-size arrays for this. */
#define MAX_EQUIV 10
#define _Py_TYPE_BASE_VERSION_TAG (2<<16)

@brandtbucher brandtbucher Mar 20, 2023

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.

Did you mean (1<<16) here? This is currently the same as (1<<17)...

Sorry, something went wrong.

Uh oh!

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

All reactions
@ericsnowcurrently
Merge branch 'main' into isolate-types-next-version-tag
5f8c3e4
@ericsnowcurrently

ericsnowcurrently commented Apr 24, 2023

Copy link
Copy Markdown
Member Author

FYI, this PR is blocked by code objects being shared for deep-frozen modules.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently
Only use deepfreeze in the main interpreter.
0d78c1b
@ericsnowcurrently
ericsnowcurrently marked this pull request as ready for review April 24, 2023 21:55
@ericsnowcurrently
ericsnowcurrently requested review from brettcannon, encukou, ncoghlan and warsaw as code owners April 24, 2023 21:55
@ericsnowcurrently
ericsnowcurrently removed request for brettcannon, encukou, ncoghlan and warsaw April 24, 2023 21:55
@ericsnowcurrently
Merge branch 'main' into isolate-types-next-version-tag
5e9ec1d
@ericsnowcurrently
ericsnowcurrently enabled auto-merge (squash) April 24, 2023 21:58
@carljm

carljm commented Apr 24, 2023

Copy link
Copy Markdown
Member

It seems like this PR will effectively mean that there will now be only 2^16 type versions available to heap types? This seems too low, since we estimate (for instance) that Instagram likely has somewhere around 2^16 heap types, period, without even considering modifications to types. It seems preferable if we can allocate fewer bits to the static types (since there aren't that many) and more to the heap types.

All reactions

Sorry, something went wrong.

Uh oh!

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

@ericsnowcurrently
ericsnowcurrently merged commit 209a0a7 into python:main Apr 24, 2023
@bedevere-bot bedevere-bot removed the awaiting core review label Apr 24, 2023
@ericsnowcurrently
ericsnowcurrently deleted the isolate-types-next-version-tag branch April 24, 2023 22:30
@carljm

carljm commented Apr 24, 2023

Copy link
Copy Markdown
Member

Ignore my above comment; I misunderstood how this PR works. There are still (2^32) - (2^16) types available to heap types, which is much more than plenty.

All reactions

Sorry, something went wrong.

Uh oh!

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

carljm added a commit to carljm/cpython that referenced this pull request Apr 24, 2023
@carljm
Merge branch 'main' into superopt_spec
3236f45
* main:
  pythongh-103801: Tools/wasm linting and formatting (python#103796)
  pythongh-103673: Add missing ForkingUnixStreamServer and ForkingUnixDatagramServer socketservers (python#103674)
  pythongh-95795: Move types.next_version_tag to PyInterpreterState (pythongh-102343)
This was referenced Apr 25, 2023
gh-103826: fix unused variable warning introduced in gh-102343 #103825
Merged
Fix unused variable warning #103826
Closed
kumaraditya303 pushed a commit that referenced this pull request Apr 25, 2023
@sunmy2019
gh-103826: fix unused variable warning introduced in gh-102343 (#103825)
0acea96
@bsteffensmeier bsteffensmeier mentioned this pull request Jul 3, 2026
Sub-interpreter shared modules appear to be broken in Python 3.12 ninia/jep#645
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@brandtbucher brandtbucher brandtbucher left review comments
@markshannon markshannon Awaiting requested review from markshannon markshannon is a code owner

Uh oh!

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

Assignees

No one assigned

Labels

skip news

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.

4 participants

@ericsnowcurrently @carljm @brandtbucher @bedevere-bot
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.