unicode_fromascii() doesn't check string content twice in debug mode

_PyUnicode_CheckConsistency() also checks string content.
This commit is contained in:
Victor Stinner 2011-12-11 21:54:30 +01:00
parent a1d12bb119
commit e6b2d4407a
1 changed files with 3 additions and 6 deletions

View File

@ -1768,15 +1768,12 @@ static PyObject*
unicode_fromascii(const unsigned char* s, Py_ssize_t size)
{
PyObject *unicode;
if (size == 1) {
#ifdef Py_DEBUG
const unsigned char *p;
const unsigned char *end = s + size;
for (p=s; p < end; p++) {
assert(*p < 128);
}
assert(s[0] < 128);
#endif
if (size == 1)
return get_latin1_char(s[0]);
}
unicode = PyUnicode_New(size, 127);
if (!unicode)
return NULL;