[Python-bugs-list] [ python-Bugs-626172 ] crash using unicode latin1 single char
noreply@sourceforge.net
noreply@sourceforge.net
Sun, 20 Oct 2002 20:15:29 -0700
Bugs item #626172, was opened at 2002-10-20 22:52
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=626172&group_id=5470
Category: Unicode
Group: Python 2.2.2
Status: Open
Resolution: None
Priority: 6
Submitted By: Neal Norwitz (nnorwitz)
Assigned to: M.-A. Lemburg (lemburg)
Summary: crash using unicode latin1 single char
Initial Comment:
The following code will crash python (also attached as
file):
try:
for c in u'\xe2':
c in 'g\xe2teau'
except UnicodeError:
pass
The problem appears to be a double free. Ref count
goes negative in a debug build.
The problem is with the unicode_latin1 module variable.
If I comment out the line
unicode_latin1[*u] = unicode;
in unicodeobject.c (~316 in CVS). Everything is fine.
That obviously is not correct. I added another INCREF:
Py_INCREF(unicode_latin1[*u]);
That also fixed the crash. I'm not sure if the INCREF
is the correct solution.
This bug appeared on usenet:
http://mail.python.org/pipermail/python-list/2002-October/127682.html
----------------------------------------------------------------------
>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-10-20 23:15
Message:
Logged In: YES
user_id=33168
A little more testing and neither of the fixes above
corrects this one liner which crashes the interpreter:
u'\xe2' in '\xe2'
My latest suspicion is in PyUnicodeUCS2_DecodeASCII(), but I
don't have enough time to debug this properly.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=626172&group_id=5470