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 belopolsky
Recipients belopolsky, serhiy.storchaka
Date 2017-01-04.19:49:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1483559394.32.0.335371111214.issue29159@psf.upfronthosting.co.za>
In-reply-to
Content
Consider the following code:

$ cat bug.py
from array import array
class C(array):
    def __new__(cls):
        return array.__new__(cls, 'B', b'abc')
    def __index__(self):
        raise TypeError
x = C()
print(bytes(x))

It works under python 3.5:

$ python3.5 bug.py
b'abc'

but raises a TypeError under python 3.6:

$ python3.6 bug.py
Traceback (most recent call last):
  File "bug.py", line 8, in <module>
    print(bytes(x))
  File "bug.py", line 6, in __index__
    raise TypeError
TypeError

It looks like this was introduced in issue #27704.

(Ref: e/pyq#827)
History
Date User Action Args
2017-01-04 19:49:54belopolskysetrecipients: + belopolsky, serhiy.storchaka
2017-01-04 19:49:54belopolskysetmessageid: <1483559394.32.0.335371111214.issue29159@psf.upfronthosting.co.za>
2017-01-04 19:49:54belopolskylinkissue29159 messages
2017-01-04 19:49:54belopolskycreate