Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

bpo-43564: preserve original exception in args of FTP URLError#24938

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
orsenthil merged 4 commits intopython:mainfromcarljm:urllibnonet
Oct 10, 2022

Conversation

@carljm
Copy link
Member

@carljmcarljm commentedMar 19, 2021
edited by bedevere-bot
Loading

This makes this case consistent with the other cases in this module where anOSError is caught and wrapped and re-raised as aURLError, in that the original exception is preserved in the args of theURLError for introspection by the caller.

In particular, this means thattest.support.transient_internet works with these wrapped errors, so that the FTP urllib2net tests correctly skip instead of failing when the network is not reachable.

https://bugs.python.org/issue43564

@github-actions
Copy link

This PR is stale because it has been open for 30 days with no activity.

@github-actionsgithub-actionsbot added the staleStale PR or inactive for long period of time. labelApr 20, 2021
@github-actionsgithub-actionsbot removed the staleStale PR or inactive for long period of time. labelAug 5, 2022
* main: (5519 commits)  Minor edits to the Descriptor HowTo Guide (pythonGH-24901)  Fix link to Lifecycle of a Pull Request in CONTRIBUTING (python#98102)pythonGH-94597: deprecate `SafeChildWatcher`, `FastChildWatcher` and `MultiLoopChildWatcher` child watchers  (python#98089)  Auto-cancel old builds when new commit pushed to branch (python#98009)pythongh-95011: Migrate syslog module to Argument Clinic (pythonGH-95012)pythongh-68686: Retire eptag ptag scripts (python#98064)pythongh-97922: Run the GC only on eval breaker (python#97920)  GitHub Workflows security hardening (python#96492)  Add `@ezio-melotti` as codeowner for `.github/`. (python#98079)pythongh-97913 Docs: Add walrus operator to the index (python#97921)  [doc] Fix broken links to C extensions accelerating stdlib modules (python#96914)pythongh-97822: Fix http.server documentation reference to test() function (python#98027)pythongh-91052: Add PyDict_Unwatch for unwatching a dictionary (python#98055)pythonGH-98023: Change default child watcher to PidfdChildWatcher on supported systems (python#98024)pythonGH-94182: Run the PidfdChildWatcher on the running loop (python#94184)pythongh-92886: make test_ast pass with -O (assertions off) (pythonGH-98058)pythongh-92886: make test_coroutines pass with -O (assertions off) (pythonGH-98060)pythongh-57179: Add note on symlinks for os.walk (python#94799)pythongh-94808: Fix regex on exotic platforms (python#98036)pythongh-90085: Remove vestigial -t and -c timeit options (python#94941)  ...
@carljm
Copy link
MemberAuthor

I re-checked this change and I believe it is still correct/useful. The conditions for this to cause a test suite failure are a bit more subtle than described in the issue. If the network is totally unavailable, then the gethostbyname call will fail at

host=socket.gethostbyname(host)
and this error handler already wraps the full network error the way most places in urllib do, whichtest.support.transient_internet handles correctly.

In order to reproduce this problem, you need a host where there is a network and DNS available (sogethostbyname succeeds) but the network does not have access to the public internet, so theconnect_ftp call a bit later at

fw=self.connect_ftp(user,passwd,host,port,dirs,req.timeout)
fails. And it is the error handling around the latter that is inconsistent with the rest of urllib, breakstest.support.transient_internet, and is fixed in this PR.

Without such a host, you can verify this fix by manually addingraise OSError(61, "foo") to the top of theconnect_ftp method at

returnftpwrapper(user,passwd,host,port,dirs,timeout,
. Without this fix,./python.exe -m test test_urllib2net -u network will then fail. With this fix, it will pass and skip the FTP tests due totest.support.transient_internet.

@carljm
Copy link
MemberAuthor

Requesting review from@orsenthil, listed in experts index as expert for urllib.

@carljmcarljm requested a review fromorsenthilOctober 9, 2022 10:22
* main:pythongh-97841: Add methoddef for _filters_mutated (pythongh-98115)
@orsenthil
Copy link
Member

Looks like a right candidate to back port to other supported branches.

important change for CI

@orsenthilorsenthil added needs backport to 3.10only security fixes needs backport to 3.11only security fixes labelsOct 10, 2022
@orsenthilorsenthil merged commitad817cd intopython:mainOct 10, 2022
@miss-islington
Copy link
Contributor

Thanks@carljm for the PR, and@orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10, 3.11.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry@carljm and@orsenthil, I had trouble checking out the3.11 backport branch.
Please backport usingcherry_picker on command line.
cherry_picker ad817cd5c44416da3752ebf9baf16d650703275c 3.11

@miss-islington
Copy link
Contributor

Sorry,@carljm and@orsenthil, I could not cleanly backport this to3.10 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker ad817cd5c44416da3752ebf9baf16d650703275c 3.10

@AlexWaygoodAlexWaygood added needs backport to 3.11only security fixes and removed needs backport to 3.11only security fixes labelsOct 10, 2022
@miss-islington
Copy link
Contributor

Thanks@carljm for the PR, and@orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@miss-islington
Copy link
Contributor

Sorry@carljm and@orsenthil, I had trouble checking out the3.11 backport branch.
Please backport usingcherry_picker on command line.
cherry_picker ad817cd5c44416da3752ebf9baf16d650703275c 3.11

@AlexWaygoodAlexWaygood removed the needs backport to 3.11only security fixes labelOct 10, 2022
@AlexWaygoodAlexWaygood added the needs backport to 3.11only security fixes labelOct 10, 2022
@miss-islington
Copy link
Contributor

Thanks@carljm for the PR, and@orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

@bedevere-botbedevere-bot removed the needs backport to 3.11only security fixes labelOct 10, 2022
@bedevere-bot
Copy link

GH-98136 is a backport of this pull request to the3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestOct 10, 2022
…nGH-24938)* bpo-43564: preserve original error in args of FTP URLError* Add NEWS blurbCo-authored-by: Carl Meyer <carljm@instagram.com>(cherry picked from commitad817cd)Co-authored-by: Carl Meyer <carl@oddbird.net>
miss-islington added a commit that referenced this pull requestOct 10, 2022
)*bpo-43564: preserve original error in args of FTP URLError* Add NEWS blurbCo-authored-by: Carl Meyer <carljm@instagram.com>(cherry picked from commitad817cd)Co-authored-by: Carl Meyer <carl@oddbird.net>
@orsenthilorsenthil added needs backport to 3.10only security fixes and removed needs backport to 3.10only security fixes labelsOct 10, 2022
@miss-islington
Copy link
Contributor

Thanks@carljm for the PR, and@orsenthil for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@miss-islington
Copy link
Contributor

Sorry,@carljm and@orsenthil, I could not cleanly backport this to3.10 due to a conflict.
Please backport usingcherry_picker on command line.
cherry_picker ad817cd5c44416da3752ebf9baf16d650703275c 3.10

orsenthil pushed a commit that referenced this pull requestOct 10, 2022
…GH-24938)*bpo-43564: preserve original error in args of FTP URLError* Add NEWS blurbCo-authored-by: Carl Meyer <carljm@instagram.com>.(cherry picked from commitad817cd)Co-authored-by: Carl Meyer <carl@oddbird.net>
@bedevere-bot
Copy link

GH-98138 is a backport of this pull request to the3.10 branch.

@bedevere-botbedevere-bot removed the needs backport to 3.10only security fixes labelOct 10, 2022
orsenthil added a commit that referenced this pull requestOct 10, 2022
…GH-24938) (#98138)*bpo-43564: preserve original error in args of FTP URLError* Add NEWS blurbCo-authored-by: Carl Meyer <carljm@instagram.com>.(cherry picked from commitad817cd)Co-authored-by: Carl Meyer <carl@oddbird.net>Co-authored-by: Carl Meyer <carl@oddbird.net>
@carljmcarljm deleted the urllibnonet branchOctober 10, 2022 06:51
mpage pushed a commit to mpage/cpython that referenced this pull requestOct 11, 2022
…n#24938)* bpo-43564: preserve original error in args of FTP URLError* Add NEWS blurbCo-authored-by: Carl Meyer <carljm@instagram.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@orsenthilorsenthilorsenthil approved these changes

Assignees

@orsenthilorsenthil

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@carljm@orsenthil@miss-islington@bedevere-bot@the-knights-who-say-ni@ezio-melotti@AlexWaygood

[8]ページ先頭

©2009-2025 Movatter.jp