New submission from Xiang Zhang <angwe...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue35062>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to