Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
gh-99352: Respecthttp.client.HTTPConnection.debuglevel inurllib.request.AbstractHTTPHandler#99353
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
gh-99352: Respecthttp.client.HTTPConnection.debuglevel inurllib.request.AbstractHTTPHandler#99353
Uh oh!
There was an error while loading.Please reload this page.
Conversation
bedevere-bot commentedNov 10, 2022
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
ghost commentedNov 10, 2022 • edited by ghost
Loading Uh oh!
There was an error while loading.Please reload this page.
edited by ghost
Uh oh!
There was an error while loading.Please reload this page.
353519d to518d0e2Comparebedevere-bot commentedNov 10, 2022
Most changes to Pythonrequire a NEWS entry. Please add it using theblurb_it web app or theblurb command-line tool. |
ac4037b tocc7f8d9Comparewheelerlaw commentedDec 7, 2022
Who do I need to mention to get a review on this? |
gpshead left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
(be sure to pull first, i pushed an update to the news entry in the branch)
Lib/test/test_urllib2.py Outdated
| deftest_http_handler_debuglevel(self): | ||
| deftest_http_handler_global_debuglevel(self): | ||
| http.client.HTTPConnection.debuglevel=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
use awith mock.patch.object(http.client.HTTPConnection, 'debuglevel, 1): style block to set this so that it is undone after the test. same below. I also suggest using a value other than 1 so that it is more obviously correlated with the specific test and not a default from elsewhere.
bedevere-bot commentedFeb 7, 2023
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
…ent.HTTPConnection.debuglevel
* Use mock.patch.object instead of settting the module level value.* Used test values to assert the debuglevel.
031e8a9 toad096d4Compare
orsenthil left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
LGTM. I have addressed the review comments against this change.
ericsnowcurrently commentedApr 24, 2023
This appears to have caused failures on several buildbots. For example,https://buildbot.python.org/all/#/builders/15/builds/4336. |
ericsnowcurrently commentedApr 24, 2023
@orsenthil, this is the one I was talking about. |
orsenthil commentedApr 25, 2023
Oh. I see the issue now. Didn't realize we were disabling ssl in some builds. I will fix it. Sorry. |
orsenthil commentedApr 25, 2023
Here we go -#103828 ; I can test against the failing buildbot before merging. |
…g https tests. (python#103828)pythongh-99352: Ensure HTTPSConnection is available before exercising httpstests.This will fix the buildbot issue mentioned inpython#99353
Uh oh!
There was an error while loading.Please reload this page.
Fixes#99352.
Some proposed changes to allow the
AbstractHTTPHandleruse the value ofhttp.client.HTTPConnection.debuglevelif nodebuglevelis passed toAbstractHTTPHandler's constructor. This has to be done in the constructor body because argument default values are evaluated at function definition evaluation time andhttp.client.HTTPConnection.debuglevelcould be set afterurllib.requestis imported.With these proposed changes,
AbstractHTTPHandlerandHTTPSHandlernow respect both sources ofdebuglevel. If the value is not set in the constructor arguments, the constructor will source the value fromhttp.client.HTTPConnection.debuglevel.Using the global
http.client.HTTPConnection.debuglevel:Using the
debuglevelconstructor parameter:urllib.request.urlopen()no longer respects thehttp.client.HTTPConnection.debuglevelflag #99352