mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +00:00
In open_ftp(), check that retrlen is not None before using it in a %d format!
This commit is contained in:
parent
b8c3cbdd50
commit
ed52a20c6e
1 changed files with 1 additions and 1 deletions
|
@ -387,7 +387,7 @@ class URLopener:
|
||||||
value in ('a', 'A', 'i', 'I', 'd', 'D'):
|
value in ('a', 'A', 'i', 'I', 'd', 'D'):
|
||||||
type = string.upper(value)
|
type = string.upper(value)
|
||||||
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
|
(fp, retrlen) = self.ftpcache[key].retrfile(file, type)
|
||||||
if retrlen >= 0:
|
if retrlen is not None and retrlen >= 0:
|
||||||
import mimetools, StringIO
|
import mimetools, StringIO
|
||||||
headers = mimetools.Message(StringIO.StringIO(
|
headers = mimetools.Message(StringIO.StringIO(
|
||||||
'Content-Length: %d\n' % retrlen))
|
'Content-Length: %d\n' % retrlen))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue