Add assertion to _Py_ReleaseInternedUnicodeStrings() if READY fails

This commit is contained in:
Victor Stinner 2011-10-04 20:04:52 +02:00
parent 5f99c912c8
commit 6b56a7fd3d
1 changed files with 4 additions and 2 deletions

View File

@ -13131,7 +13131,7 @@ PyUnicode_InternInPlace(PyObject **p)
if (PyUnicode_CHECK_INTERNED(s)) if (PyUnicode_CHECK_INTERNED(s))
return; return;
if (_PyUnicode_READY_REPLACE(p)) { if (_PyUnicode_READY_REPLACE(p)) {
assert(0 && "PyUnicode_READY fail in PyUnicode_InternInPlace"); assert(0 && "_PyUnicode_READY_REPLACE fail in PyUnicode_InternInPlace");
return; return;
} }
s = (PyUnicodeObject *)(*p); s = (PyUnicodeObject *)(*p);
@ -13217,8 +13217,10 @@ _Py_ReleaseInternedUnicodeStrings(void)
n); n);
for (i = 0; i < n; i++) { for (i = 0; i < n; i++) {
s = (PyUnicodeObject *) PyList_GET_ITEM(keys, i); s = (PyUnicodeObject *) PyList_GET_ITEM(keys, i);
if (PyUnicode_READY(s) == -1) if (PyUnicode_READY(s) == -1) {
assert(0 && "could not ready string");
fprintf(stderr, "could not ready string\n"); fprintf(stderr, "could not ready string\n");
}
switch (PyUnicode_CHECK_INTERNED(s)) { switch (PyUnicode_CHECK_INTERNED(s)) {
case SSTATE_NOT_INTERNED: case SSTATE_NOT_INTERNED:
/* XXX Shouldn't happen */ /* XXX Shouldn't happen */