Skip to content

pypy3.9 - SyntaxError due to positional only arguments in stubfile #13499

@florianfischer91

Description

@florianfischer91

Bug Report

Typecheck a *.pyi file containing a function with positional only arguments raises a SyntaxError.
I use pypy3.9 (with pypy3.8 i don't get any errors)

To Reproduce

Run the code below with mypy and pypy3.9

def f(a:int, b:int, /) -> None:
	...

Expected Behavior

No error

Actual Behavior

SyntaxError: Positional only arguments are only supported in Python (3, 8) and above.

I guess the reason is that when parsing a stubfile the feature_version 7 is used.
Running the code with feature_version 8 solves the problem

Your Environment

  • Mypy version used: mypy 0.971 (compiled: no)
  • Python version used:
Python 3.9.12 | packaged by conda-forge | (05fbe3aa, Aug 15 2022, 10:20:11)
[PyPy 7.3.9 with GCC 10.4.0]
  • Operating system and version: Ubuntu

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugmypy got something wrong

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions