diff options
author | Georg Brandl <georg@python.org> | 2005-11-26 16:50:44 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2005-11-26 16:50:44 (GMT) |
commit | 1f663574ee154dfc95b883747137040f51ea7ef6 (patch) | |
tree | 1672a7ff57a8f9b7ac41f028cfb0894afb999857 /Lib/urllib.py | |
parent | 7dece6690e103d24696ef543f7d14a2287c80446 (diff) | |
download | cpython-1f663574ee154dfc95b883747137040f51ea7ef6.zip cpython-1f663574ee154dfc95b883747137040f51ea7ef6.tar.gz cpython-1f663574ee154dfc95b883747137040f51ea7ef6.tar.bz2 |
bug #1365984: urllib and data: URLs. Problem was that cStringIO objects cannot be assigned attributes on the fly.
Diffstat (limited to 'Lib/urllib.py')
-rw-r--r-- | Lib/urllib.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py index f00d02f..f700d71 100644 --- a/Lib/urllib.py +++ b/Lib/urllib.py @@ -556,7 +556,7 @@ class URLopener: msg = '\n'.join(msg) f = StringIO(msg) headers = mimetools.Message(f, 0) - f.fileno = None # needed for addinfourl + #f.fileno = None # needed for addinfourl return addinfourl(f, headers, url) @@ -813,7 +813,10 @@ class addbase: self.read = self.fp.read self.readline = self.fp.readline if hasattr(self.fp, "readlines"): self.readlines = self.fp.readlines - if hasattr(self.fp, "fileno"): self.fileno = self.fp.fileno + if hasattr(self.fp, "fileno"): + self.fileno = self.fp.fileno + else: + self.fileno = lambda: None if hasattr(self.fp, "__iter__"): self.__iter__ = self.fp.__iter__ if hasattr(self.fp, "next"): |