New submission from Serhiy Storchaka:
PyObject_Size(), PySequence_Size() and PyMapping_Size() can raise an exception.
But not always this is checked after using them. This can lead to a crash. For
example:
>>> import io
>>> class R(io.IOBase):
... def readline(self): return None
...
>>> next(R())
Fatal Python error: a function returned a result with an error set
TypeError: object of type 'NoneType' has no len()
The above exception was the direct cause of the following exception:
SystemError: <built-in function next> returned a result with an error set
Current thread 0xb749c700 (most recent call first):
File "<stdin>", line 1 in <module>
----------
components: Extension Modules, IO, Interpreter Core
messages: 291573
nosy: serhiy.storchaka
priority: normal
severity: normal
status: open
title: Check if PyObject_Size() raised an error
type: crash
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue30061>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com