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

Commit0f28af5

Browse files
[3.10]gh-101936: Update the default value of fp from io.StringIO to io.BytesIO (gh-102100) (#102118)
gh-101936: Update the default value of fp from io.StringIO to io.BytesIO (gh-102100)(cherry picked from commit0d4c7fc)Co-authored-by: Long Vo <long.vo@linecorp.com>
1 parent3e9fb1a commit0f28af5

File tree

4 files changed

+5
-1
lines changed

4 files changed

+5
-1
lines changed

‎Lib/test/test_urllib2.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1826,6 +1826,7 @@ def test_HTTPError_interface(self):
18261826
deftest_gh_98778(self):
18271827
x=urllib.error.HTTPError("url",405,"METHOD NOT ALLOWED",None,None)
18281828
self.assertEqual(getattr(x,"__notes__", ()), ())
1829+
self.assertIsInstance(x.fp.read(),bytes)
18291830

18301831
deftest_parse_proxy(self):
18311832
parse_proxy_test_cases= [

‎Lib/urllib/error.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def __init__(self, url, code, msg, hdrs, fp):
4343
self.fp=fp
4444
self.filename=url
4545
iffpisNone:
46-
fp=io.StringIO()
46+
fp=io.BytesIO()
4747
self.__super_init(fp,hdrs,url,code)
4848

4949
def__str__(self):

‎Misc/ACKS‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1867,6 +1867,7 @@ Kurt Vile
18671867
Norman Vine
18681868
Pauli Virtanen
18691869
Frank Visser
1870+
Long Vo
18701871
Johannes Vogel
18711872
Michael Vogt
18721873
Radu Voicilas
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The default value of ``fp`` becomes:class:`io.BytesIO` if:exc:`~urllib.error.HTTPError`
2+
is initialized without a designated ``fp`` parameter. Patch by Long Vo.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp