@@ -969,9 +969,9 @@ async def _wrap_create_connection(
969
969
raise ClientConnectorCertificateError (req .connection_key , exc ) from exc
970
970
except ssl_errors as exc :
971
971
raise ClientConnectorSSLError (req .connection_key , exc ) from exc
972
- except asyncio .TimeoutError :
973
- raise
974
972
except OSError as exc :
973
+ if exc .errno is None and isinstance (exc , asyncio .TimeoutError ):
974
+ raise
975
975
raise client_error (req .connection_key , exc ) from exc
976
976
977
977
def _warn_about_tls_in_tls (
@@ -1050,9 +1050,9 @@ async def _start_tls_connection(
1050
1050
raise ClientConnectorCertificateError (req .connection_key , exc ) from exc
1051
1051
except ssl_errors as exc :
1052
1052
raise ClientConnectorSSLError (req .connection_key , exc ) from exc
1053
- except asyncio .TimeoutError :
1054
- raise
1055
1053
except OSError as exc :
1054
+ if exc .errno is None and isinstance (exc , asyncio .TimeoutError ):
1055
+ raise
1056
1056
raise client_error (req .connection_key , exc ) from exc
1057
1057
except TypeError as type_err :
1058
1058
# Example cause looks like this:
@@ -1103,9 +1103,9 @@ def drop_exception(fut: "asyncio.Future[List[Dict[str, Any]]]") -> None:
1103
1103
1104
1104
host_resolved .add_done_callback (drop_exception )
1105
1105
raise
1106
- except asyncio .TimeoutError :
1107
- raise
1108
1106
except OSError as exc :
1107
+ if exc .errno is None and isinstance (exc , asyncio .TimeoutError ):
1108
+ raise
1109
1109
# in case of proxy it is not ClientProxyConnectionError
1110
1110
# it is problem of resolving proxy ip itself
1111
1111
raise ClientConnectorError (req .connection_key , exc ) from exc
@@ -1298,9 +1298,9 @@ async def _create_connection(
1298
1298
_ , proto = await self ._loop .create_unix_connection (
1299
1299
self ._factory , self ._path
1300
1300
)
1301
- except asyncio .TimeoutError :
1302
- raise
1303
1301
except OSError as exc :
1302
+ if exc .errno is None and isinstance (exc , asyncio .TimeoutError ):
1303
+ raise
1304
1304
raise UnixClientConnectorError (self .path , req .connection_key , exc ) from exc
1305
1305
1306
1306
return cast (ResponseHandler , proto )
@@ -1365,9 +1365,9 @@ async def _create_connection(
1365
1365
await asyncio .sleep (0 )
1366
1366
# other option is to manually set transport like
1367
1367
# `proto.transport = trans`
1368
- except asyncio .TimeoutError :
1369
- raise
1370
1368
except OSError as exc :
1369
+ if exc .errno is None and isinstance (exc , asyncio .TimeoutError ):
1370
+ raise
1371
1371
raise ClientConnectorError (req .connection_key , exc ) from exc
1372
1372
1373
1373
return cast (ResponseHandler , proto )
0 commit comments