Skip to content

Unable to parse stub conditionals #28

@tharvik

Description

@tharvik

In PEP 484, there is a section on conditional stubs.

For example, the next code is a valid stub code

import sys

if sys.version_info <= (3,):
    def old_code_stub() -> None: ...

But currently, running pytd on it will fail with

Error while parsing pyi:

  File "/tmp/asd.py", line 3
    if sys.version_info <= (3,):
          ^
SyntaxError: Unexpected 'DOT'

Found while doing typeshed#345.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions