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.

Title: bytes subclass __repr__ raise SystemError when set to bytes.decode
Type: Stage: resolved
Components: Versions: Python 3.6
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: benjamin.peterson, bup
Priority: normal Keywords:

Created on 2018-10-03 23:35 by bup, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Messages (2)
msg327015 - (view) Author: Dan Snider (bup) * Date: 2018-10-03 23:35
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

Traceback (most recent call last):
  File "<stdin>", line 6, in <module>
SystemError: <built-in function displayhook> returned NULL without setting an error
msg327035 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2018-10-04 03:07
Can't reproduce this on the 3.6 branch.
Date User Action Args
2022-04-11 14:59:06adminsetgithub: 79068
2018-10-04 03:07:06benjamin.petersonsetstatus: open -> closed

nosy: + benjamin.peterson
messages: + msg327035

resolution: works for me
stage: resolved
2018-10-03 23:35:58bupcreate