Skip to content

code objects remove unknown opcodes from the instruction stream when accessing co_code #128045

Closed

Description

@DinoV

Bug report

Bug description:

If you construct a code object with an unknown opcode it'll get removed when the code object goes through the opcodes to de-opt them. We should just ignore unknown opcodes instead.

CPython versions tested on:

3.12, 3.14

Operating systems tested on:

Linux

Linked PRs

Activity

  1. added
    type-bug
    on Dec 17, 2024
  2. added
    interpreter-core
    3.12
    3.13
    3.14
    on Dec 17, 2024
  3. markshannon commented on Dec 20, 2024

    @markshannon
    Member

    Constructing a code object with an unknown opcode seems like a bug to me.

    I presume this is for Cinder.
    Is there a way to make this work for Cinder, without making CPython less resilient?

  4. DinoV commented on Jan 29, 2025

    @DinoV
    ContributorAuthor

    The problem here is that this is related to our extension of the interpreter loop, so the opcodes are known to us, but unknown to the code object. I suppose we could open these tables up and allow someone to say "these are known opcodes" but I'm not sure that's an improvement.

    Also we're not doing anything like "reject code objects with unknown opcodes", instead they're just silently turning into 0's which doesn't seem like it's being very resilient in the first place.

  5. added a commit that references this issue on May 19, 2025
  6. added a commit that references this issue on May 19, 2025
  7. added 2 commits that reference this issue on May 19, 2025
  8. added 2 commits that reference this issue on Jul 12, 2025
  9. added 2 commits that reference this issue on Aug 4, 2025
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

    3.123.133.14interpreter-coretype-bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions