You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
HTTPError fp.read returns string instead of bytes #101936
@gaborbernat@sobolevn
Thanks, I will take a look and use this issue through the internal OSS sprint as the good first bug.
I am mentoring them this year Thank you for your understanding!
Activity
sobolevn commentedon Feb 15, 2023
cc @corona10
corona10 commentedon Feb 15, 2023
@gaborbernat @sobolevn
Thanks, I will take a look and use this issue through the internal OSS sprint as the good first bug.
I am mentoring them this year Thank you for your understanding!
longvhdeveloper commentedon Feb 20, 2023
I'll take it
longvhdeveloper commentedon Feb 21, 2023
@corona10 I ran code in live run the code
I checked type of fp
is <class 'http.client.HTTPResponse'>
it is not StringIO, that mean fp is not None. And if you call read() method it will return bytes
cpython/Lib/urllib/request.py
Line 639 in dc8a868
https://docs.python.org/3/library/http.client.html#http.client.HTTPResponse.read
Do I change StringIO to BytesIO when fp is None ?
gaborbernat commentedon Feb 21, 2023
The title is incorrect, should be read returns string instead of bytes when fp is None.
corona10 commentedon Feb 21, 2023
@longvhdeveloper
This script might explain better.
Yes please go ahead with nice test code.
[-]HTTPError fp.read returns bytes instead of string [/-][+]HTTPError fp.read returns string instead of bytes [/+]corona10 commentedon Feb 21, 2023
Thanks, I modified the title.
gh-101936: Update the default value of fp from io.StringIO to io.Byte…
pythongh-101936: Update the default value of fp from io.StringIO to i…
pythongh-101936: Update the default value of fp from io.StringIO to i…
[3.11] gh-101936: Update the default value of fp from io.StringIO to …
[3.10] gh-101936: Update the default value of fp from io.StringIO to …
corona10 commentedon Feb 22, 2023
@longvhdeveloper Thank you for your hard work!
Merge branch 'main' into lockfreecp
pythongh-101936: Update the default value of fp from io.StringIO to i…
pythongh-101936: Update the default value of fp from io.StringIO to i…
pythongh-101936: Update the default value of fp from io.StringIO to i…