Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
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
to518d0e2
Comparebedevere-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
tocc7f8d9
CompareWho do I need to mention to get a review on this? |
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
@@ -1048,7 +1057,30 @@ def test_http_body_array(self): | |||
newreq = h.do_request_(req) | |||
self.assertEqual(int(newreq.get_header('Content-length')),16) | |||
def test_http_handler_debuglevel(self): | |||
def test_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
toad096d4
CompareThere 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.
This appears to have caused failures on several buildbots. For example,https://buildbot.python.org/all/#/builders/15/builds/4336. |
@orsenthil, this is the one I was talking about. |
Oh. I see the issue now. Didn't realize we were disabling ssl in some builds. I will fix it. Sorry. |
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
AbstractHTTPHandler
use the value ofhttp.client.HTTPConnection.debuglevel
if nodebuglevel
is 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.debuglevel
could be set afterurllib.request
is imported.With these proposed changes,
AbstractHTTPHandler
andHTTPSHandler
now 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
debuglevel
constructor parameter:urllib.request.urlopen()
no longer respects thehttp.client.HTTPConnection.debuglevel
flag #99352