You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
utf-7-imap incremental decoder and stream reader fail on split input #156965
utf-7-imap registers an incremental decoder and a stream reader that call the one-shot decoder with no state, so a shift sequence split across chunks raises instead of being buffered. io.TextIOWrapper.read(n), codecs.iterdecode and codecs.StreamReader.read all fail on bytes the codec's own encoder produced.
UnicodeDecodeError: 'utf-7-imap' codec can't decode bytes in position 0-8191: unterminated shift sequence
Expected: True. Doc/library/codecs.rst says the joined output of calls to the incremental decode method is the same as decoding the joined input with the stateless decoder.
The incremental encoder breaks the same sentence more mildly: encoding '~peter/mail/台北/日本語' one character at a time joins to b'~peter/mail/&U,A-&Uxc-/&ZeU-&Zyw-&ip4-' where one shot gives b'~peter/mail/&U,BTFw-/&ZeVnLIqe-', though both decode back to the same text.
The codec is new in 3.16, so no released version is affected.
Activity