Skip to content

Commit 04a586c

Browse files
authored
stubgenc: small fix in get_default_function_sig (#19822)
This small change fixes a crash in the case when a function arg has both a default value and a non-string type annotation. Here is an example: ``` def f(i: int = 0): pass ```
1 parent e03d3c1 commit 04a586c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

mypy/stubgenc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def add_args(
322322
default_value = get_default_value(i, arg)
323323
if default_value is not _Missing.VALUE:
324324
if arg in annotations:
325-
argtype = annotations[arg]
325+
argtype = get_annotation(arg)
326326
else:
327327
argtype = self.get_type_annotation(default_value)
328328
if argtype == "None":

0 commit comments

Comments
 (0)