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

Over-aggressive optimization for _GUARD_CODE_VERSION #146018

Copy link
Copy link
@markshannon

Description

@markshannon
Issue body actions

Bug report

Bug description:

The optimizer is replacing _GUARD_CODE_VERSION with a watcher, which would be fine if the code object were known.
However, the code object is just the one observed during tracing. The one observed during execution could be different, which is why the guard was added in the first place.

We should only remove the guard if the code version is known.
Correct optimizations would be:

  • Only remove the first guard (and add the code watcher)
  • If the function is known and its version is known, remove the guard.

CPython versions tested on:

CPython main branch

Operating systems tested on:

No response

Linked PRs

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    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
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

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