New submission from Serhiy Storchaka <[email protected]>:
Constructing bytes from mutating list can cause a crash.
class X:
def __index__(self):
if len(a) < 1000:
a.append(self)
return 0
a = [X()]
bytes(a)
This is not an issue about weird integer-like objects. It is about . The size
of the list can be changed in other thread while iterate it in the bytes
constructor.
The optimization for the case of the list argument was added in issue6688. The
code was refactored several times since, but this flaw was always.
----------
assignee: serhiy.storchaka
components: Interpreter Core
messages: 327653
nosy: alexandre.vassalotti, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Crash in bytes constructor with mutating list
type: crash
versions: Python 3.6, Python 3.7, Python 3.8
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34973>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com