[New-bugs-announce] [issue31718] some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError

Oren Milman report at bugs.python.org
Fri Oct 6 14:09:48 EDT 2017


New submission from Oren Milman <orenmn at gmail.com>:

Given an uninitialized IncrementalNewlineDecoder:
uninitialized = io.IncrementalNewlineDecoder.__new__(io.IncrementalNewlineDecoder)

each of the following calls would raise a SystemError ('null argument to
internal routine'):
uninitialized.getstate()
uninitialized.setstate((b'foo', 0))
uninitialized.reset()

In contrast, the following call would raise a ValueError
('IncrementalNewlineDecoder.__init__ not called'):
uninitialized.decode(b'bar')

ISTM that getstate(), setstate(), and reset() should have the same behavior as
decode(). (Though i think that including the actual type name in the error
message would be better, as it could be a subclass of IncrementalNewlineDecoder).

----------
components: IO
messages: 303842
nosy: Oren Milman
priority: normal
severity: normal
status: open
title: some methods of uninitialized io.IncrementalNewlineDecoder objects raise SystemError
type: behavior
versions: Python 3.7

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


More information about the New-bugs-announce mailing list