[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))
        self._output(str)


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]))
        self._output(s)

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>
<http://bugs.python.org/issue10012>
_______________________________________


More information about the New-bugs-announce mailing list