Skip to content

Commit ea9291d

Browse files
authored
Fix type expected by stubgenc (#8888)
In investigating a crash when running on a PyBind11 module, I noticed a mismatch in the types; infer_prop_type_from_docstring can clearly get None, but it has a type of plain str. Fix the annotation to match the expectation. Now, when rebuilding Mypy, the error goes away and this now works without crashing, and can completely generate stubs.
1 parent e87bf24 commit ea9291d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/stubdoc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ def find_unique_signatures(sigs: Sequence[Sig]) -> List[Sig]:
339339
return sorted(result)
340340

341341

342-
def infer_prop_type_from_docstring(docstr: str) -> Optional[str]:
342+
def infer_prop_type_from_docstring(docstr: Optional[str]) -> Optional[str]:
343343
"""Check for Google/Numpy style docstring type annotation for a property.
344344
345345
The docstring has the format "<type>: <descriptions>".

0 commit comments

Comments
 (0)