| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
If the first and only write to a PyUnicodeWriter is a Python str object, PyUnicodeWriter_Finish() returns the object unchanged. Move test_unicode_equal() to the correct test case: CAPITest.
…158214) Since GH-157861, every writer uses the read-only optimization of _PyUnicodeWriter_WriteStr(), so the first write of a str subclass instance into an empty writer kept that object as the buffer, and PyUnicodeWriter_Finish() returned it. io.StringIO.getvalue() then returned the written object itself, and the next write re-read it through its __str__() method, which changed the contents and could make read() read past the end of the buffer. Only use the read-only optimization for exact str objects. A subclass is copied into a new buffer, as before GH-157861.
| Back | FazBrowse Home | New Git URL |
If the first and only write to a PyUnicodeWriter is a Python str object, PyUnicodeWriter_Finish() returns the object unchanged.
Move test_unicode_equal() to the correct test case: CAPITest.