Skip to content

[Bug] import statement in method: 'error parsing code, unable to find "debug" function statement' #84

Closed
@Jasha10

Description

@Jasha10

Bug

When the from devtools import debug statement occurs within a method (as opposed to at toplevel of the module), an "error parsing code" message is printed.

Min repro:

The following works as expected:

# tmp.py
from devtools import debug
def foo():
    debug(123)
foo()
$ python tmp.py
tmp.py:4 foo
    123 (int)

But if you put the import statement inside the method, there is an error:

# tmp2.py
def foo():
    from devtools import debug
    debug(123)
foo()
$ python tmp2.py
tmp2.py:4 foo (error parsing code, unable to find "debug" function statement)
    123 (int)

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