[issue35062] io.IncrementalNewlineDecoder assign out-of-range value to bitwise struct field

Xiang Zhang report at bugs.python.org
Thu Oct 25 00:03:41 EDT 2018


New submission from Xiang Zhang <angwerzx at 126.com>:

io.IncrementalNewlineDecoder gets a *translate* bitwise struct field, but it could be assigned arbitrary int value. This leads to inconsistent behaviour, evens are evaluated to False and odds to True.

>>> io.IncrementalNewlineDecoder(encodings.utf_8.IncrementalDecoder(), 4).decode(b"abcd\r\n")
u'abcd\r\n'
>>> io.IncrementalNewlineDecoder(encodings.utf_8.IncrementalDecoder(), 5).decode(b"abcd\r\n")
u'abcd\n'

----------
components: IO
messages: 328407
nosy: xiang.zhang
priority: normal
severity: normal
stage: needs patch
status: open
title: io.IncrementalNewlineDecoder assign out-of-range value to bitwise struct field
type: behavior
versions: Python 2.7, Python 3.6, Python 3.7, Python 3.8

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue35062>
_______________________________________


More information about the Python-bugs-list mailing list