Problem with wsgiref.headers.Headers

Gabriel Genellina gagsl-py2 at
Sun Jan 17 17:47:54 CET 2010

En Fri, 15 Jan 2010 18:41:29 -0300, Phil <phily05 at> escribió:

> I am having an issue with wsgiref.headers.Headers.
> For example, if I do this...
> from wsgiref.headers import Headers
> list = []
> wrapper = Headers(list)
> wrapper['content-type'] = "text/html"
> print(list)
> print(wrapper)
> I get an empty list printed, and then the correct result for wrapper
> printed.

You forgot to mention the Python version; the code works fine with 2.x,  
but fails in 3.1
r68205 [1] is the culprit, in response to issue #4718 [2]
The commit message says the changes were made to comply with (basically, clarify  
str/unicode/bytes handling in Python 3.x). Either the documentation should  
be updated or the original behavior be maintained (meaning the original  
list contents could be altered); you probably should raise the question in  
the Web-SIG [3].


Gabriel Genellina

More information about the Python-list mailing list