@@ -66,7 +66,7 @@ def _frozenbind(
66
66
flags : int = 0 ,
67
67
) -> tuple [str | int | bytes | None , ...]:
68
68
sig = inspect .signature (self ._orig_getaddrinfo )
69
- bound = sig .bind (host , port , family , proto , flags )
69
+ bound = sig .bind (host , port , family , type , proto , flags )
70
70
bound .apply_defaults ()
71
71
frozenbound = bound .args
72
72
assert not bound .kwargs
@@ -82,7 +82,9 @@ def set(
82
82
proto : int = 0 ,
83
83
flags : int = 0 ,
84
84
) -> None :
85
- self ._responses [self ._frozenbind (host , port , family , proto , flags )] = response
85
+ self ._responses [self ._frozenbind (host , port , family , type , proto , flags )] = (
86
+ response
87
+ )
86
88
87
89
def getaddrinfo (
88
90
self ,
@@ -93,12 +95,12 @@ def getaddrinfo(
93
95
proto : int = 0 ,
94
96
flags : int = 0 ,
95
97
) -> GetAddrInfoResponse | str :
96
- bound = self ._frozenbind (host , port , family , proto , flags )
98
+ bound = self ._frozenbind (host , port , family , type , proto , flags )
97
99
self .record .append (bound )
98
100
if bound in self ._responses :
99
101
return self ._responses [bound ]
100
102
elif flags & stdlib_socket .AI_NUMERICHOST :
101
- return self ._orig_getaddrinfo (host , port , family , proto , flags )
103
+ return self ._orig_getaddrinfo (host , port , family , type , proto , flags )
102
104
else :
103
105
raise RuntimeError (f"gai called with unexpected arguments { bound } " )
104
106
@@ -885,19 +887,17 @@ async def test_resolve_address_exception_in_connect_closes_socket() -> None:
885
887
with tsocket .socket () as sock :
886
888
887
889
async def _resolve_address_nocp (
888
- self : _SocketType ,
889
- host : str | bytes | None ,
890
- port : str | bytes | int | None ,
891
- family : int = 0 ,
892
- type : int = 0 ,
893
- proto : int = 0 ,
894
- flags : int = 0 ,
890
+ address : AddressFormat ,
891
+ * ,
892
+ local : bool ,
895
893
) -> None :
894
+ assert address == ""
895
+ assert not local
896
896
cancel_scope .cancel ()
897
897
await _core .checkpoint ()
898
898
899
899
assert isinstance (sock , _SocketType )
900
- sock ._resolve_address_nocp = _resolve_address_nocp # type: ignore[method-assign, assignment ]
900
+ sock ._resolve_address_nocp = _resolve_address_nocp # type: ignore[method-assign]
901
901
with assert_checkpoints ():
902
902
with pytest .raises (_core .Cancelled ):
903
903
await sock .connect ("" )
0 commit comments