[New-bugs-announce] [issue27737] email.header.Header.encode() crashes with IndexError on spaces only value
Tim Graham
report at bugs.python.org
Thu Aug 11 09:51:04 EDT 2016
New submission from Tim Graham:
Python 2.7:
>>> from email.header import Header
>>> Header(' ').encode()
''
Python 3.2+ (I didn't check older versions of Python 3):
>>> Header(' ').encode()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/tim/code/cpython/Lib/email/header.py", line 391, in encode
value = formatter._str(linesep)
File "/home/tim/code/cpython/Lib/email/header.py", line 427, in _str
self.newline()
File "/home/tim/code/cpython/Lib/email/header.py", line 439, in newline
self._lines[-1] += str(self._current_line)
IndexError: list index out of range
(Originally reported at https://code.djangoproject.com/ticket/27051)
----------
components: Library (Lib)
files: whitespace-header-test.diff
keywords: patch
messages: 272447
nosy: Tim.Graham
priority: normal
severity: normal
status: open
title: email.header.Header.encode() crashes with IndexError on spaces only value
versions: Python 3.2, Python 3.3, Python 3.4, Python 3.5, Python 3.6
Added file: http://bugs.python.org/file44077/whitespace-header-test.diff
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue27737>
_______________________________________
More information about the New-bugs-announce
mailing list