Commit 9cd87aaa authored by Marc-André Lemburg's avatar Marc-André Lemburg

Fix for bug #626172: crash using unicode latin1 single char

Python 2.2.3 candidate.
parent 45186c4c
...@@ -434,6 +434,12 @@ vereq((u'ab' in 'abc'), True) ...@@ -434,6 +434,12 @@ vereq((u'ab' in 'abc'), True)
vereq((u'ab' in (1,None,u'ab')), True) vereq((u'ab' in (1,None,u'ab')), True)
vereq((u'' in u'abc'), True) vereq((u'' in u'abc'), True)
vereq(('' in u'abc'), True) vereq(('' in u'abc'), True)
try:
u'\xe2' in 'g\xe2teau'
except UnicodeError:
pass
else:
print '*** contains operator does not propagate UnicodeErrors'
print 'done.' print 'done.'
# Formatting: # Formatting:
......
...@@ -4485,10 +4485,8 @@ int PyUnicode_Contains(PyObject *container, ...@@ -4485,10 +4485,8 @@ int PyUnicode_Contains(PyObject *container,
goto onError; goto onError;
} }
u = (PyUnicodeObject *)PyUnicode_FromObject(container); u = (PyUnicodeObject *)PyUnicode_FromObject(container);
if (u == NULL) { if (u == NULL)
Py_DECREF(v);
goto onError; goto onError;
}
size = PyUnicode_GET_SIZE(v); size = PyUnicode_GET_SIZE(v);
rhs = PyUnicode_AS_UNICODE(v); rhs = PyUnicode_AS_UNICODE(v);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment