Skip to content

bpo-36365: Rewrite structseq_repr() using _PyUnicodeWriter#12440

Merged
vstinner merged 2 commits intopython:masterfrom
vstinner:structseq_writer
Mar 19, 2019
Merged

bpo-36365: Rewrite structseq_repr() using _PyUnicodeWriter#12440
vstinner merged 2 commits intopython:masterfrom
vstinner:structseq_writer

Conversation

@vstinner
Copy link
Copy Markdown
Member

@vstinner vstinner commented Mar 19, 2019

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.

https://bugs.python.org/issue36365

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.
@vstinner vstinner merged commit c70ab02 into python:master Mar 19, 2019
@vstinner vstinner deleted the structseq_writer branch March 19, 2019 23:05
strlen(typ->tp_name),
NULL);
if (type_name == NULL) {
goto error;
Copy link
Copy Markdown
Contributor

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.

@vstinner
Copy link
Copy Markdown
Member Author

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants