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
{{ message }}
Repository navigation
errno and strerror attributes incorrectly set on socket errors wrapped by urllib #50720
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=Nonecreated_at=<Date2009-07-12.20:54:33.896>labels= ['type-bug', 'library', '3.9', '3.10', '3.11']
title='errno and strerror attributes incorrectly set on socket errors wrapped by urllib'updated_at=<Date2021-11-30.20:20:38.331>user='https://github.com/ezio-melotti'
Thanks for this patch. This shouldn't be backported as there is subtle scenario wherein if an old code was checking e.errno is None previously to fall back on OSError, it will break and will need a change.
Activity
iritkatriel commentedon Nov 30, 2021
Reproduced on 3.11:
vasiliyk commentedon Oct 21, 2026
Still reproduces on 3.16.0a1+dev:
URLError.__init__sets onlyargsandreason, so theOSErrorattributes are never set.Following the original patch:
URLError.__init__, ifreasonis anOSError, copy itserrnoandstrerror.args,str()andrepr()do not change, so the backward-compatibility concern does not apply.I can open a PR with tests if this approach is fine.
orsenthil commentedon Oct 29, 2026
@vasiliyk, please create the patch with the approach.
vasiliyk commentedon Oct 30, 2026
@orsenthil The PR is up - #160938. I added a a versionchanged note for 3.16 in
urllib.errordoc.Merge branch 'main' into pythongh-50720-urllib
orsenthil commentedon Oct 31, 2026
Thanks for this patch. This shouldn't be backported as there is subtle scenario wherein if an old code was checking
e.errno is Nonepreviously to fall back on OSError, it will break and will need a change.gh-50720: Set errno and strerror on URLError wrapping an OSError (#16…
gh-50720: Copy winerror to URLError on Windows (#161047)