[issue10479] cgitb.py should assume a binary stream for output

2020-11-16 Thread Irit Katriel


Change by Irit Katriel :


--
versions: +Python 3.10, Python 3.8, Python 3.9 -Python 3.1, Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10479] cgitb.py should assume a binary stream for output

2011-01-30 Thread Glenn Linderman

Glenn Linderman  added the comment:

So since cgi.py was fixed to use the .buffer attribute of sys.stdout, that 
leaves sys.stdout itself as a character stream, and cgitb.py can successfully 
write to that.

If cgitb.py never writes anything but ASCII, then maybe that should be 
documented, and this issue closed.

If cgitb.py writes non-ASCII, then it should use an appropriate encoding for 
the web application, which isn't necessarily the default encoding on the 
system.  Some user control over the appropriate encoding should be given, or it 
should be documented that the encoding of sys.stdout should be changed to an 
appropriate encoding, because that is where cgitb.py will write its character 
stream.  Guidance on how to do that would be appropriate for the documentation 
also, as a CGI application may be the first one a programmer might write that 
can't just use the default encoding configured for the system.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10479] cgitb.py should assume a binary stream for output

2010-11-21 Thread Antoine Pitrou

Changes by Antoine Pitrou :


--
nosy: +facundobatista, fdrake, orsenthil
versions: +Python 3.1

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10479] cgitb.py should assume a binary stream for output

2010-11-20 Thread Glenn Linderman

Changes by Glenn Linderman :


--
type:  -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue10479] cgitb.py should assume a binary stream for output

2010-11-20 Thread Glenn Linderman

New submission from Glenn Linderman :

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 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com