You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Following the Python language specification ,a default super() calls the constructor of the first grand parent class, ClientConnectionError , with the wrong arguments (the constructor is supposed to take a message as first argument). The arguments provided, os_error.errno, and , os_error.strerror suggest that it should call instead the constructor of the second grand parent class, OSError .
But maybe my understanding of these classes is wrong.
If my theory is true, then the constructor of the second grand-parent class shall be called, through: super(OSError, self).__init__(os_error.errno, os_error.strerror)
Yes there is one wrong behavior: the OSError object is not properly initialized with the errno information. So any user of the library catching OSErrors will obtain wrongly initialized objects. This is an exotic case although.
I didn't focus on the error message as aiohttp is (like many Python libraries) very heterogeneous in terms of quality of the exception messages, from none (no message at all despite useful information available) to very chatty. So I don't think the error message is the issue there (and if it were it would require a separate issue to resolve it across several exception types).
Yes there is one wrong behavior: the OSError object is not properly initialized with the errno information. So any user of the library catching OSErrors will obtain wrongly initialized objects. This is an exotic case although.
That's fine, if you can add a test showing that, then feel free to make a fix.
Describe the bug
The
ClientConnectorError
class has 2 grand-parent classes:ClientConnectionError
andOSError
, in that order.However, it seems to call the constructor of the wrong grand-parent:
aiohttp/aiohttp/client_exceptions.py
Line 136 in a379e63
Following the Python language specification ,a default super() calls the constructor of the first grand parent class,
ClientConnectionError
, with the wrong arguments (the constructor is supposed to take a message as first argument). The arguments provided,os_error.errno,
and, os_error.strerror
suggest that it should call instead the constructor of the second grand parent class,OSError
.But maybe my understanding of these classes is wrong.
To Reproduce
Read the code of the client_exceptions.py file:
aiohttp/aiohttp/client_exceptions.py
Line 136 in a379e63
Expected behavior
If my theory is true, then the constructor of the second grand-parent class shall be called, through:
super(OSError, self).__init__(os_error.errno, os_error.strerror)
Logs/tracebacks
Python Version
aiohttp Version
multidict Version
yarl Version
OS
MacOS Sonoma 14.2.1 (23C71)
Related component
Client
Additional context
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: