[issue36907] Crash due to borrowed references in _PyStack_UnpackDict()

Petr Viktorin report at bugs.python.org
Wed May 22 07:41:44 EDT 2019


Petr Viktorin <encukou at gmail.com> added the comment:

We do, but here the test will need to be changed:

Python 3.7.3+ (heads/3.7:791e5fcbab, May 22 2019, 13:37:27) 
[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> class IntWithDict:
...     def __init__(self, **kwargs):
...         self.kwargs = kwargs
...     def __index__(self):
...         self.kwargs.clear()
...         return 0
... 
>>> x = IntWithDict(dont_inherit=float())
>>> compile("", "", "", x, **x.kwargs)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: an integer is required (got type IntWithDict)

----------

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


More information about the Python-bugs-list mailing list