Issue 4564: bytearray.fromhex doesn't respect bytearray subclass (original) (raw)

Created on 2008-12-06 14:56 by pitrou, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (2)
msg77130 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2008-12-06 14:56
The following code says it all: >>> class B(bytearray): pass ... >>> b = B.fromhex("0c0a") >>> b bytearray(b'\x0c\n') >>> isinstance(b, B) False
msg77139 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-12-06 15:53
The same kind of request has been rejected several times: , . The explanation given is here: http://mail.python.org/pipermail/python-list/2005-January/300791.html """a base class has no idea what requirements may exist for invoking a subclass's constructor"""
History
Date User Action Args
2022-04-11 14:56:42 admin set github: 48814
2008-12-06 15:53:57 amaury.forgeotdarc set status: open -> closedresolution: wont fixmessages: + nosy: + amaury.forgeotdarc
2008-12-06 14:56:43 pitrou create