-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Open
Description
My .pyx
file uses a PEP-484 style type signature:
#cython: embedsignature=True
def f(path: str, a: int = 0, b: bool = True) -> typing.List[str]:
return []
Cython 0.29.13 turns this into the docstring:
f(unicode path: str, a: int = 0, bool b: bool = True) -> typing.List[str]
(see also #1370 for "unicode")
When using mypy-stubgen, that docstring turns into:
def f(unicodepath: str, a: int = ..., boolb: bool = ...) -> typing.List[str]: ...
Which causes mypy false positives for Python code calling f
with a named argument for b
.
I think embedsignature
should not output Cython-specific syntax, as that breaks tooling consuming these docstrings.
Ideally it'd also convert Cython signatures into the corresponding Python signatures; but it would be good enough for me if it just left PEP484 signatures as-is.
kmaehashi, novitae, FeldrinH, trim21, nurpax and 3 more