New submission from Alexander Belopolsky:
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)
----------
keywords: 3.6regression
messages: 284663
nosy: belopolsky, serhiy.storchaka
priority: normal
severity: normal
status: open
title: Regression in bytes constructor
type: behavior
versions: Python 3.6
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue29159>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com