Re: [Web-SIG] WSGI, Python 3 and Unicode

2007-12-08 Thread Graham Dumpleton
On 08/12/2007, Phillip J. Eby [EMAIL PROTECTED] wrote:
 * When running under Python 3, servers MUST provide a text stream for
 wsgi.errors

In Python 3, what happens if user code attempts to output to a text
stream a byte string? Ie., what would be displayed?

Also, if wsgi.errors is a text stream, presume that if a WSGI adapter
has to internally map this to a C char* like API for logging that it
would need to apply standard Python encoding to yield usable char*
string for output.

Graham
___
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com


Re: [Web-SIG] WSGI, Python 3 and Unicode

2007-12-08 Thread Guido van Rossum
On Dec 8, 2007 12:37 AM, Graham Dumpleton [EMAIL PROTECTED] wrote:
 On 08/12/2007, Phillip J. Eby [EMAIL PROTECTED] wrote:
  * When running under Python 3, servers MUST provide a text stream for
  wsgi.errors

 In Python 3, what happens if user code attempts to output to a text
 stream a byte string? Ie., what would be displayed?

Nothing. You get a TypeError.

 Also, if wsgi.errors is a text stream, presume that if a WSGI adapter
 has to internally map this to a C char* like API for logging that it
 would need to apply standard Python encoding to yield usable char*
 string for output.

The encoding can/must be specified per text stream.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
___
Web-SIG mailing list
Web-SIG@python.org
Web SIG: http://www.python.org/sigs/web-sig
Unsubscribe: 
http://mail.python.org/mailman/options/web-sig/archive%40mail-archive.com