From: Guido van Rossum Date: Tue, 16 Feb 1999 15:10:12 +0000 (+0000) Subject: In open_ftp(), check that retrlen is not None before using it in a %d format! X-Git-Tag: v1.5.2b2~49 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ed52a20c6eb451cd8827e3901f115709980edaae;p=thirdparty%2FPython%2Fcpython.git In open_ftp(), check that retrlen is not None before using it in a %d format! --- diff --git a/Lib/urllib.py b/Lib/urllib.py index d175eef91bd5..d37906c0b2dd 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))