Skip to content

Commit c3a75a1

Browse files
corona10ambv
andauthored
Update Lib/urllib/error.py
Co-authored-by: Łukasz Langa <[email protected]>
1 parent 91a6e6f commit c3a75a1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Lib/urllib/error.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,9 @@ def __init__(self, url, code, msg, hdrs, fp):
4242
self.hdrs = hdrs
4343
self.fp = fp
4444
self.filename = url
45-
if fp is not None:
46-
self.__super_init(fp, hdrs, url, code)
47-
else:
48-
self.__super_init(io.StringIO(), hdrs, url, code)
45+
if fp is None:
46+
fp = io.StringIO()
47+
self.__super_init(fp, hdrs, url, code)
4948

5049
def __str__(self):
5150
return 'HTTP Error %s: %s' % (self.code, self.msg)

0 commit comments

Comments
 (0)