unicode_writer_finish() checks string consistency
This commit is contained in:
parent
5d73c178a8
commit
f59c28c930
|
@ -1064,6 +1064,10 @@ class UnicodeTest(string_tests.CommonTest,
|
|||
self.assertEqual('%f' % INF, 'inf')
|
||||
self.assertEqual('%F' % INF, 'INF')
|
||||
|
||||
# PEP 393
|
||||
self.assertEqual('%.1s' % "a\xe9\u20ac", 'a')
|
||||
self.assertEqual('%.2s' % "a\xe9\u20ac", 'a\xe9')
|
||||
|
||||
def test_startswith_endswith_errors(self):
|
||||
for meth in ('foo'.startswith, 'foo'.endswith):
|
||||
with self.assertRaises(TypeError) as cm:
|
||||
|
|
|
@ -13320,6 +13320,7 @@ unicode_writer_finish(unicode_writer_t *writer)
|
|||
Py_DECREF(writer->buffer);
|
||||
return NULL;
|
||||
}
|
||||
assert(_PyUnicode_CheckConsistency(writer->buffer, 1));
|
||||
return writer->buffer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue