[New-bugs-announce] [issue34887] bytes subclass __repr__ raise SystemError when set to bytes.decode

Dan Snider report at bugs.python.org
Wed Oct 3 19:35:58 EDT 2018


New submission from Dan Snider <mr.assume.away at gmail.com>:

I've tested it on at least one of each minor version since 3.4 but it looks like it may be specific to 3.6.0. The developer's guide isn't clear enough for me to understand what's eligible for bug fixes but since I'm not sure if it actually is 3.6.0 exclusive I'll post it just in case.

Here's how to cause it:

if 1:
    class Bytes(bytes):
        def __new__(cls, name, encoding='ascii'):
            return bytes.__new__(cls, name.encode())
        __repr__ = bytes.decode
    print(repr(Bytes("LOAD_NAME")))

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
SystemError: <built-in function displayhook> returned NULL without setting an error

----------
messages: 327015
nosy: bup
priority: normal
severity: normal
status: open
title: bytes subclass __repr__ raise SystemError when set to bytes.decode
versions: Python 3.6

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


More information about the New-bugs-announce mailing list