Skip to content

bug: function block is missing in "Assembled Bytecode". #13

Description

@Honghe

source:

x = 1
def foo():
    print(x)
    x += 1
foo()

dis output:

  0           RESUME                   0

  1           LOAD_CONST               0 (1)
              STORE_NAME               0 (x)

  2           LOAD_CONST               1 (<code object foo at 0x60e3e8094eb0, file "example.py", line 2>)
              MAKE_FUNCTION
              STORE_NAME               1 (foo)

  5           LOAD_NAME                1 (foo)
              PUSH_NULL
              CALL                     0
              POP_TOP
              RETURN_CONST             2 (None)

foo
  2           RESUME                   0

  3           LOAD_GLOBAL              1 (print + NULL)
              LOAD_FAST_CHECK          0 (x)
              CALL                     1
              POP_TOP

  4           LOAD_FAST                0 (x)
              LOAD_CONST               1 (1)
              BINARY_OP               13 (+=)
              STORE_FAST               0 (x)
              RETURN_CONST             0 (None)

codoscope output:
Image

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions