[New-bugs-announce] [issue10012] httplib shadows builtin, assumes strings

Cliff Wells report at bugs.python.org
Sat Oct 2 01:44:08 CEST 2010

New submission from Cliff Wells <cliff at develix.com>:

httplib.py ~Line 924

    def putheader(self, header, *values):
        str = '%s: %s' % (header, '\r\n\t'.join(values))

should be changed to something like:

    def putheader(self, header, *values):
        s = '%s: %s' % (header, '\r\n\t'.join([str(v) for v in values]))

The current version shadows str builtin with a local variable.  join method assumes strings so they should probably be explicitly cast (at least one 3rd party library appears to pass Content-length as an integer, causing this to fail.  Of course, this can't be done unless the str builtin is no longer shadowed.

components: Library (Lib)
messages: 117852
nosy: cwells
priority: normal
severity: normal
status: open
title: httplib shadows builtin, assumes strings
versions: Python 2.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list