bpo-36365: Rewrite structseq_repr() using _PyUnicodeWriter by vstinner · Pull Request #12440 · python/cpython
Conversation
No longer limit repr(structseq) to 512 bytes. Use _PyUnicodeWriter
for better performance and write directly Unicode rather than using
encode repr() value to UTF-8 and then decode from UTF-8.
No longer limit repr(structseq) to 512 bytes. Use _PyUnicodeWriter for better performance and write directly Unicode rather than using encode repr() value to UTF-8 and then decode from UTF-8.
| strlen(typ->tp_name), | ||
| NULL); | ||
| if (type_name == NULL) { | ||
| goto error; |
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the record, this goto error would cause _PyUnicodeWriter_Dealloc() to be called on an uninitialized _PyUnicodeWriter. This was fixed in 93e8012.
For the record, this goto error would cause _PyUnicodeWriter_Dealloc() to be called on an uninitialized _PyUnicodeWriter. This was fixed in 93e8012.
Oops, I moved "PyObject *type_name = ..." after my initial code to simplify the error handling, but I forgot to make the error handling correct in the final change. So thanks for the fix!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters