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 — Remove `DELETE_GLOBAL` bytecode instruction · Issue #145857 · python/cpython

Remove DELETE_GLOBAL bytecode instruction #145857

New issue
Copy link
New issue
Copy link
Closed
Closed
Remove DELETE_GLOBAL bytecode instruction#145857
Copy link
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

Description

@markshannon
markshannon
opened on Mar 12, 2026
Issue body actions

Feature or enhancement

Proposal:

DELETE_GLOBAL could be removed by making STORE_GLOBAL handle a NULL value and replacing DELETE_GLOBAL with PUSH_NULL; STORE_GLOBAL.

This wouldn't have an effect on performance or code size, as STORE_GLOBAL would also need to do the job of DELETE_GLOBAL but it would free up an opcode for future use. Also, once #145854 and #145855 are implemented, it would make the bytecode for deletion more consistent.

Has this already been discussed elsewhere?

This is a minor feature, which does not need previous discussion elsewhere

Linked PRs

  • gh-145857: Replace DELETE_GLOBAL with PUSH_NULL; STORE_GLOBAL #146314

Activity

  1. markshannon
    added
    type-featureA feature request or enhancementA feature request or enhancement
    on Mar 12, 2026
  2. aisk
    added
    performancePerformance or resource usagePerformance or resource usage
    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
    on Mar 12, 2026
  3. MazinSharaf commented on Mar 12, 2026

    @MazinSharaf
    MazinSharaf
    on Mar 12, 2026
    Contributor
    More actions

    DELETE_GLOBAL could be removed by making STORE_GLOBAL handle a NULL value and replacing DELETE_GLOBAL with PUSH_NULL; STORE_GLOBAL.

    I don't think this would exactly work, and it would probably be worse. I say this because DELETE_GLOBAL removes the global from the dictionary itself, that means its name as well. STORE_GLOBAL doesn’t do that and instead leaves the name there and only removes the value. This would be bad as well because if the names are still there in the dictionary, but have no value, then it's just a waste sitting there.

    I may still test this but I'm very skeptical about making this change.

  4. brijkapadia commented on Mar 13, 2026

    @brijkapadia
    brijkapadia
    on Mar 13, 2026
    Contributor
    More actions

    If you make it so that a NULL value for STORE_GLOBAL corresponds to popping the variable from the global dictionary, then you would get the same behavior as DELETE_GLOBAL. The one thing that seems strange is that STORE_GLOBAL would end up removing a key from the global dictionary, despite the name implying it would set that key to have a value of NULL.

  5. picnixz commented on Mar 13, 2026

    @picnixz
    picnixz
    on Mar 13, 2026
    Member
    More actions

    It is not an issue for the naming. PyObject_SetAttr takes a NULL to indicate deletion.

    Reacted by Sergey Miryanov, Brij Kapadia and Mazin Sharaf
  6. brijkapadia commented on Mar 17, 2026

    @brijkapadia
    brijkapadia
    on Mar 17, 2026
    Contributor
    More actions

    I can try to work on this change as it is a necessary feature to implement before I continue with one of my PRs (namely PR #145983). Additionally, this change is very similar to what I am currently doing in PR #146006, so I don't think I will have trouble implementing this issue once that one gets merged.

  7. brijkapadia
    added a commit that references this issue on Mar 23, 2026

    pythongh-145857: Replace `DELETE_GLOBAL` with `PUSH_NULL; STORE_GLOBAL`

    f6038d0
  8. markshannon
    added a commit that references this issue on Jun 30, 2026

    gh-145857: Replace `DELETE_GLOBAL` with `PUSH_NULL; STORE_GLOBAL` (GH…

    a3dc784
  9. markshannon
    closed this as completedon Jul 1, 2026
  10. maurycy
    added a commit that references this issue on Jul 1, 2026

    Merge branch 'main' into maurycy/bye-abba

    da7d768
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)performancePerformance or resource usagePerformance or resource usagetype-featureA feature request or enhancementA feature request or enhancement

    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.