File tree 2 files changed +6
-13
lines changed 2 files changed +6
-13
lines changed Original file line number Diff line number Diff line change @@ -104,4 +104,4 @@ def special_function_elide_names(name: str) -> bool:
104
104
105
105
106
106
def argument_elide_name (name : Optional [str ]) -> bool :
107
- return name is not None and name .startswith ("__" )
107
+ return name is not None and name .startswith ("__" ) and not name . endswith ( "__" )
Original file line number Diff line number Diff line change @@ -2073,25 +2073,18 @@ h(7) # E: Cannot call function of unknown type
2073
2073
2074
2074
[case testPositionalOnlyArg]
2075
2075
def f(__a: int) -> None: pass
2076
+ def g(__a__: int) -> None: pass
2076
2077
2077
2078
f(1)
2078
2079
f(__a=1) # E: Unexpected keyword argument "__a" for "f"
2079
2080
2080
- [builtins fixtures/bool.pyi]
2081
- [out]
2082
- main:1: note: "f" defined here
2083
-
2084
- [case testPositionalOnlyArgFastparse]
2085
-
2086
-
2087
- def f(__a: int) -> None: pass
2088
-
2089
- f(1)
2090
- f(__a=1) # E: Unexpected keyword argument "__a" for "f"
2081
+ g(1)
2082
+ # Argument names that also end with __ are not positional-only.
2083
+ g(__a__=1)
2091
2084
2092
2085
[builtins fixtures/bool.pyi]
2093
2086
[out]
2094
- main:3 : note: "f" defined here
2087
+ main:1 : note: "f" defined here
2095
2088
2096
2089
[case testMagicMethodPositionalOnlyArg]
2097
2090
class A(object):
You can’t perform that action at this time.
0 commit comments