Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2020-11-22.08:29:33.645>created_at=<Date2020-11-21.17:27:58.861>labels= ['type-feature', 'library', '3.10']
title='Use the errno attribute of OSError instead of args[0]'updated_at=<Date2020-11-22.08:29:33.644>user='https://github.com/serhiy-storchaka'
Some code in the stdlib still uses e.args[0] to access errno of OSError instead of e.errno. The latter is more readable, and also it always success (although can return None), but args can be an empty tuple.
We are observing following traceback, occasionally
File "urllib3/connectionpool.py", line 444, in _make_request
File "http/client.py", line 1347, in getresponse
File "http/client.py", line 307, in begin
File "http/client.py", line 268, in _read_status
File "socket.py", line 674, in readinto
IndexError: tuple index out of range
The strange thing is that the code at line 674 of socket.py is not the readinto method. But since this bug says that args may be empty, then args[0] would explain the error, isn't it ?
Activity
serhiy-storchaka commented on Nov 21, 2020
Some code in the stdlib still uses e.args[0] to access errno of OSError instead of e.errno. The latter is more readable, and also it always success (although can return None), but args can be an empty tuple.
serhiy-storchaka commented on Nov 22, 2020
New changeset c4d45ee by Serhiy Storchaka in branch 'master':
bpo-42427: Use the errno attribute of OSError instead of args[0] (GH-23449)
c4d45ee
viralmutant commented on Oct 8, 2022
Does this issue exist in 3.7.3 too ?
We are observing following traceback, occasionally
The strange thing is that the code at line 674 of socket.py is not the readinto method. But since this bug says that args may be empty, then args[0] would explain the error, isn't it ?