You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
bpo-10155: Add fixups for encoding problems to wsgiref
Files
issue9022.patch: Make CGIHandler use byte streams for input/outpu
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=<Date2012-12-25.15:16:34.553>created_at=<Date2010-06-18.00:25:45.756>labels= ['type-bug', 'library']
title='TypeError in wsgiref.handlers when using CGIHandler'updated_at=<Date2012-12-25.15:16:34.552>user='https://bugs.python.org/toxicdav3'
The following code produces a type error, but from what I can tell it does comply with PEP-333. This issue appeared using Python 3.1.1 and 3.1.2 on both Windows and Ubuntu. I have only tried the 32 bit versions. Works fine in Python 2.6.5.12 but I guess thats irrelevant.
Traceback (most recent call last):
File "C:\Python31\lib\wsgiref\handlers.py", line 75, in runself.finish_response()
File "C:\Python31\lib\wsgiref\handlers.py", line 116, in finish_responseself.write(data)
File "C:\Python31\lib\wsgiref\handlers.py", line 210, in writeself.send_headers()
File "C:\Python31\lib\wsgiref\handlers.py", line 266, in send_headersself.send_preamble()
File "C:\Python31\lib\wsgiref\handlers.py", line 196, in send_preambleself._write('Status: %s\r\n'%self.status)
File "C:\Python31\lib\wsgiref\handlers.py", line 402, in _writeself.stdout.write(data)
TypeError: must be str, not bytes
Yes, CGIHandler is broken in 3.0-3.1; wsgiref in general has been in limbo until the whole issue of py3k-WSGI is sorted. This seems to be happening now in PEP-3333.
Attached patch to make CGIHandler use the byte interfaces for stdin/stdout, which allows the write calls to work and provides byte streams to the WSGI application as required by PEP-3333.
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: