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 — `_PyStaticType_InitBuiltin` should not exist. · Issue #103276 · python/cpython

_PyStaticType_InitBuiltin should not exist. #103276

New issue
Copy link
New issue
Copy link
Open
Open
_PyStaticType_InitBuiltin should not exist.#103276
Copy link
Assignees
ericsnowcurrently
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@markshannon
markshannon
opened on Apr 5, 2023
Issue body actions

Part three in an ongoing series...

Following on from #96458 and #101603.

Static, builtin classes must be sharable across interpreters.
Therefore, they should be immortal and idempotent immutable. Ideally they should be immutable, but we can tolerate a bit of initialization as long as it is idempotent and thread-safe.
Therefore _PyStaticType_InitBuiltin should not exist.
We can also free up the _Py_TPFLAGS_STATIC_BUILTIN flag, as we are running low on flags.

AFAICT _PyStaticType_InitBuiltin sets an index for accessing the subclasses dict on the interpreter, and calls PyType_Ready. That's all.
PyType_Ready should be a no op on static builtin classes. (If it isn't, then that's another issue we need to add.)
Setting the subclass index can be done lazily, as many builtin classes are never subclassed.
There is no reason for the index to be distinct from the version tag, so we should use that, and statically initialize it for int, type, etc.

@ericsnowcurrently @kumaraditya303
Any more of these static init/dealloc functions? They should all go.

Activity

  1. markshannon
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Apr 5, 2023
  2. markshannon
    assigned
    ericsnowcurrently
    on Apr 5, 2023
  3. ericsnowcurrently commented on Apr 5, 2023

    @ericsnowcurrently
    ericsnowcurrently
    on Apr 5, 2023
    Member
    More actions

    FWIW, everything you've said makes sense. 🙂

  4. iritkatriel
    added
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @ericsnowcurrently
    ericsnowcurrently

Labels

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

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    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.