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

Commitedbde8f

Browse files
[3.11]gh-101936: Update the default value of fp from io.StringIO to io.BytesIO (gh-102100) (gh-102117)
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 parent528e91c commitedbde8f

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
@@ -1828,6 +1828,7 @@ def test_HTTPError_interface(self):
18281828
deftest_gh_98778(self):
18291829
x=urllib.error.HTTPError("url",405,"METHOD NOT ALLOWED",None,None)
18301830
self.assertEqual(getattr(x,"__notes__", ()), ())
1831+
self.assertIsInstance(x.fp.read(),bytes)
18311832

18321833
deftest_parse_proxy(self):
18331834
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
@@ -1882,6 +1882,7 @@ Kurt Vile
18821882
Norman Vine
18831883
Pauli Virtanen
18841884
Frank Visser
1885+
Long Vo
18851886
Johannes Vogel
18861887
Michael Vogt
18871888
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