Closed thecodingwizard closed 1 week ago
This PR fixes an issue with type stub generations for P.args and P.kwargs when P is a ParamSpec imported from a different module. It also adds a regression test.
P.args
P.kwargs
P
ParamSpec
This issue came up in https://github.com/modal-labs/modal-client/pull/2319.
Given:
from some_module import P def foo(fn: typing.Callable[P, None], *args: P.args, **kwargs: P.kwargs) -> str: return "Hello World!"
Before (bad):
import some_module def foo(fn: typing.Callable[some_module.P, None], *args: P.args, **kwargs: P.kwargs) -> str: return "Hello World!"
After (good):
import some_module def foo(fn: typing.Callable[some_module.P, None], *args: some_module.P.args, **kwargs: some_module.P.kwargs) -> str: return "Hello World!"
This PR fixes an issue with type stub generations for
P.args
andP.kwargs
whenP
is aParamSpec
imported from a different module. It also adds a regression test.This issue came up in https://github.com/modal-labs/modal-client/pull/2319.
Given:
Before (bad):
After (good):