*type
and **type
is not parsed properly for Python 2 type hints
#1191
Labels
fixed in next version (main)
A fix has been implemented and will appear in an upcoming version
waiting for user response
Requires more information from user
Environment data
Expected behaviour
*type
and**type
type hints are parsed properly by Pylance.Actual behaviour
*type
and**type
type hints raise an error.Logs
I did not manage to get any relevant log, even with
Trace
-level logging enabled.Code Snippet / Additional information
According to PEP-484, this should be the standard way to type hint
*
and**
arguments in older versions of Python. However, writing the type hint that way raises errors:In the code,
args
is considered to have typeTuple[Any, ...]
andkwargs
is considered to have typeDict[str, Any]
.However, it looks like using line-by-line type hints work:
Here,
args
is considered to have typeTuple[int, ...]
, andkwargs
is considered to have typeDict[str, float]
.I also tried removing the
*
and**
:In that case, Pylance does find the right types,
args
is considered to have typeTuple[int, ...]
andkwargs
to have typeDict[str, float]
, but this is inconsistent with the expected format (and I find it also harder to read).The text was updated successfully, but these errors were encountered: