New submission from Glenn Linderman <v+pyt...@g.nevcal.com>:

The CGI interface is a binary stream, because it is pumped directly to/from the 
HTTP protocol, which is a binary stream.

Hence, cgitb.py should produce binary output.  Presently, it produces text 
output.

When one sets stdout to a binary stream, and then cgitb intercepts an error, 
cgitb fails.

Demonstration of problem:

import sys
import traceback
sys.stdout = open("sob", "wb")  # WSGI sez data should be binary, so stdout 
should be binary???
import cgitb
sys.stdout.write(b"out")
fhb = open("fhb", "wb")
cgitb.enable()
fhb.write("abcdef")  # try writing non-binary to binary file.  Expect an error, 
of course.

----------
components: Unicode
messages: 121865
nosy: v+python
priority: normal
severity: normal
status: open
title: cgitb.py should assume a binary stream for output
versions: Python 3.2

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10479>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to