[Python-bugs-list] [ python-Bugs-660165 ] PyFile_GetLine() doesn't grok unicode

noreply@sourceforge.net noreply@sourceforge.net
Fri, 03 Jan 2003 03:05:55 -0800


Bugs item #660165, was opened at 2002-12-30 22:15
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=660165&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: Guido van Rossum (gvanrossum)
Assigned to: Martin v. Löwis (loewis)
Summary:  PyFile_GetLine() doesn't grok unicode

Initial Comment:
PyFile_GetLine() complains when object.readline()
returns a Unicode string.  This is only used by
raw_input() (and possible by 3rd party extensions). 
Could we change it to either allow Unicode strings, or
at least attempt to convert the result to str()?


----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2003-01-03 12:05

Message:
Logged In: YES 
user_id=21627

What do you think about this patch? I could not find a way
to avoid duplication of the string-stripping code; apart
from that, it works fine in my test cases.

----------------------------------------------------------------------

Comment By: Guido van Rossum (gvanrossum)
Date: 2002-12-31 02:02

Message:
Logged In: YES 
user_id=6380

Wanna cook up a patch?

----------------------------------------------------------------------

Comment By: Martin v. Löwis (loewis)
Date: 2002-12-31 00:05

Message:
Logged In: YES 
user_id=21627

I'm in favour of allowing raw_input to return Unicode
objects. This would follow the principle that you shall
convert to a byte string at the latest possible point in
processing (i.e. immediately before the byte-oriented storage).

It may surprise applications, but it (in itself) isn't an
incompatible change (as you now get an exception).

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=660165&group_id=5470