Optimize backslashreplace error handler · TheByteKnight/cpython@e7bf86c · GitHub
Skip to content

Commit e7bf86c

Browse files
committed
Optimize backslashreplace error handler
Issue python#25318: Optimize backslashreplace and xmlcharrefreplace error handlers in UTF-8 encoder. Optimize also backslashreplace error handler for ASCII and Latin1 encoders. Use the new _PyBytesWriter API to optimize these error handlers for the encoders. It avoids to create an exception and call the slow implementation of the error handler.
1 parent fdfbf78 commit e7bf86c

2 files changed

Lines changed: 160 additions & 51 deletions

File tree

Objects/stringlib/codecs.h

Lines changed: 16 additions & 2 deletions

Objects/unicodeobject.c

Lines changed: 144 additions & 49 deletions

0 commit comments

Comments
 (0)