This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients alexandre.vassalotti, serhiy.storchaka
Date 2018-10-13.13:37:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1539437867.82.0.788709270274.issue34973@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-10-13 13:37:47serhiy.storchakasetrecipients: + serhiy.storchaka, alexandre.vassalotti
2018-10-13 13:37:47serhiy.storchakasetmessageid: <1539437867.82.0.788709270274.issue34973@psf.upfronthosting.co.za>
2018-10-13 13:37:47serhiy.storchakalinkissue34973 messages
2018-10-13 13:37:47serhiy.storchakacreate