New submission from Sec <[email protected]>:
When trying to extend the builtin bytes class, slices fall back to the builtin
class.
```
class my_bytes(bytes):
def dummy(self):
print("dummy called")
x=my_bytes.fromhex("c0de c0de")
print(x.__class__)
print(x[1:].__class__)
```
x.__class__ returns <class '__main__.my_bytes'> as expected.
But x[1:].__class__ returns <class 'bytes'>
----------
components: Interpreter Core
files: bytes_test.py
messages: 414092
nosy: Sec42
priority: normal
severity: normal
status: open
title: bytes class extension with slices
type: behavior
versions: Python 3.9
Added file: https://bugs.python.org/file50646/bytes_test.py
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46866>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com