Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support PEP 612: Parameter Specification Variables #786

Open
rchen152 opened this issue Jan 7, 2021 · 2 comments
Open

Support PEP 612: Parameter Specification Variables #786

rchen152 opened this issue Jan 7, 2021 · 2 comments
Labels
cat: callables functions and decorators enhancement

Comments

@rchen152
Copy link
Contributor

rchen152 commented Jan 7, 2021

PEP: https://www.python.org/dev/peps/pep-0612/

As a simple first step, we should add ParamSpec and Concatenate to the typing stub so typeshed can start using them (python/typeshed#4827).

@rchen152
Copy link
Contributor Author

Assigning to myself to implement the "first step" described above, to unblock typeshed.

rchen152 added a commit that referenced this issue Apr 2, 2021
pytype will gracefully fall back to Any when typing.ParamSpec or
typing.Concatenate is used as the first argument to a Callable in a type stub,
allowing typeshed to start using most of PEP 612. Custom generic classes
parameterized with a ParamSpec are still not supported.

pytype was reporting weird [bad-unpacking] errors in parser.py, so I kept
adding ast3.AST annotations until they went away.

I also fixed a bug in PrintVisitor that caused it to print typing_extensions
imports as aliases rather than imports.

For #786.

PiperOrigin-RevId: 366342708
@rchen152
Copy link
Contributor Author

rchen152 commented Apr 2, 2021

It's now possible to use a ParamSpec or Concatenate as the first argument to a Callable in type stubs.

@rchen152 rchen152 removed their assignment Apr 2, 2021
rchen152 added a commit that referenced this issue Aug 11, 2021
pytype does not yet support typing.ParamSpec. We were already replacing
instances of ParamSpec itself with Any, but ParamSpec also has args and kwargs
attributes that need to be replaced.

Context: python/typeshed#5896

For #786

PiperOrigin-RevId: 390166645
rchen152 added a commit that referenced this issue Nov 2, 2021
This is to unblock python/typeshed#6221.
Also see #786.

PiperOrigin-RevId: 407168815
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cat: callables functions and decorators enhancement
Projects
None yet
Development

No branches or pull requests

1 participant