Skip to content

"Run Selection" does not handle decorators properly.Β #15058

@dmitrievskymax

Description

@dmitrievskymax
def my_decorator(func):
    def wrapper():
        print("Something is happening before the function is called.")
        func()
        print("Something is happening after the function is called.")
    return wrapper


@my_decorator
def say_whee():
    print("Whee!")


say_whee()

shift+enter or 'run' button in vscode

>>> def my_decorator(func):
...     def wrapper():
...         print("Something is happening before the function is called.")
...         func()
...         print("Something is happening after the function is called.")
...     return wrapper
... @my_decorator
  File "<stdin>", line 7
    @my_decorator
    ^
SyntaxError: invalid syntax
>>>
>>> def say_whee():
...     print("Whee!")
...
>>> say_whee()
Whee!
>>>

python extension v2021.1.442908725-dev

Metadata

Metadata

Assignees

Labels

area-terminalbugIssue identified by VS Code Team member as probable bugverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions