Repository navigation
gh-160185: Fix CJK StreamWriter.reset() not returning to ASCII - #160186
Conversation
reset() returned early when nothing was pending, so the shift-back sequence of hz and iso2022_* was never written (regression from pythongh-67436). Also fix a reference leak of the stream.write() result.
345ec10 to
d86d637
Compare
# Conflicts: # Lib/test/test_multibytecodec.py
|
Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15. |
|
GH-161067 is a backport of this pull request to the 3.15 branch. |
|
GH-161068 is a backport of this pull request to the 3.14 branch. |
|
…GH-160186) (#161067) gh-160185: Fix CJK StreamWriter.reset() not returning to ASCII (GH-160186) reset() returned early when nothing was pending, so the shift-back sequence of hz and iso2022_* was never written (regression from gh-67436). Also fix a reference leak of the stream.write() result. (cherry picked from commit aa4f541) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
…GH-160186) (#161068) gh-160185: Fix CJK StreamWriter.reset() not returning to ASCII (GH-160186) reset() returned early when nothing was pending, so the shift-back sequence of hz and iso2022_* was never written (regression from gh-67436). Also fix a reference leak of the stream.write() result. (cherry picked from commit aa4f541) Co-authored-by: Gregory P. Smith <68491+gpshead@users.noreply.github.com>
|
MultibyteStreamWriter.reset()now passes an empty string to the encoder when nothing is pending instead of returning early, so the codec's reset hook writes the shift-back sequence again, as it did before gh-67436. It also drops the leakedstream.write()result.Since
reset()can now write bytes,StreamWriter.seek(),StreamReaderWriter.seek()andStreamRecoder.seek()reset the writer before moving the stream; otherwiseseek(0)would writeESC ( Bover offset 0. Other codecs'StreamWriter.reset()writes nothing, so the reorder doesn't change them.Fixes #160185
ANT-2026-4AU4SRS4