summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-02-16 15:10:12 (GMT)
committerGuido van Rossum <guido@python.org>1999-02-16 15:10:12 (GMT)
commited52a20c6eb451cd8827e3901f115709980edaae (patch)
treef4a8afe0da344d4cfea126d549296d6780a3a6fe /Lib
parentb8c3cbdd50badf2ecf5da9d62a91959162695fa1 (diff)
downloadcpython-ed52a20c6eb451cd8827e3901f115709980edaae.zip
cpython-ed52a20c6eb451cd8827e3901f115709980edaae.tar.gz
cpython-ed52a20c6eb451cd8827e3901f115709980edaae.tar.bz2
In open_ftp(), check that retrlen is not None before using it in a %d format!
Diffstat (limited to 'Lib')
-rw-r--r--Lib/urllib.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/urllib.py b/Lib/urllib.py
index d175eef..d37906c 100644
--- a/Lib/urllib.py
+++ b/Lib/urllib.py
@@ -387,7 +387,7 @@ class URLopener:
value in ('a', 'A', 'i', 'I', 'd', 'D'):
type = string.upper(value)
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
- if retrlen >= 0:
+ if retrlen is not None and retrlen >= 0:
import mimetools, StringIO
headers = mimetools.Message(StringIO.StringIO(
'Content-Length: %d\n' % retrlen))