Repository navigation
gh-50720: Set errno and strerror on URLError wrapping an OSError - #160938
Conversation
Documentation build overview
30 files changed ·
|
| self.reason = reason | ||
| if filename is not None: | ||
| self.filename = filename | ||
| if isinstance(reason, OSError): |
There was a problem hiding this comment.
The only question is winerror Should we handle that?
We don't have a great on windows and if winerror will be different than errno for the scenarios that URLError will capture.
There was a problem hiding this comment.
Keeping this just as thought. Not a blocker.
There was a problem hiding this comment.
Right, winerror stays None on Windows while the wrapped error carries the code. For socket errors it equals errno, but it differs for non-socket errors wrapped by FileHandler.
Should I open a separate improvement issue for it?
There was a problem hiding this comment.
If you have a windows system, could you verify it with a some tests?
Exposing winerror gated by system check will be good.
There was a problem hiding this comment.
I only have macOS and Linux.
The CI runs the test suite on Windows, so a Windows-only test would be verified there. I can open a follow-up PR that copies winerror behind a platform check, with the test skipped elsewhere.
What do you think?
|
The buildbot failures are not related. |
URLErrorwrapping anOSErrorsuch assocket.gaierroralways haderrnoandstrerrorset toNone.This PR copies
errnoandstrerrorfrom the reason when it is anOSError.A string reason leaves both attributes
None, as before.