◐ Shell
clean mode source ↗

Issue 1460: codecs utf7 decoding error

There is a utf-7 decoding error when decoding strings which have a shift
sequence at a certain place. To reproduce run the attached program on a
file containing the string:
"0123456789012345678901234567890123456789012345678901234567890123456789X+-".

The shift sequence starts at character 72. The culprit seems to be in
codecs.py: StreamReader.read. The input is split on the 72 character
boundary, and the first decode call raises an exception since the shift
sequence is not terminated. The second one falls back 1 character,
raises no exception, but the previous exception is raised since there is
no newline in the output (?).

The lines I don't understand are, and are the ones raising the exception.

if len(lines)<=1:
  raise