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: Alternate constructors bytes.fromhex() and bytearray.fromhex() return an instance of base type
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: serhiy.storchaka Nosy List: georg.brandl, python-dev, serhiy.storchaka
Priority: normal Keywords: patch

Created on 2016-05-12 08:03 by serhiy.storchaka, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
bytes_fromhex.patch serhiy.storchaka, 2016-05-12 10:09 review
Messages (4)
msg265375 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-12 08:03
According to the discussion on Python-Dev [1] alternate constructors should return an instance of the subclass (else why invoke it through the subclass). bytes.fromhex() and bytearray.fromhex() are the only exceptions.

I think bytes.fromhex() and bytearray.fromhex() should be changed to match the behavior of all other alternate constructors.

msg265387 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-05-12 10:09
Here is a patch.
msg269026 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2016-06-21 21:08
msg269672 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-07-01 14:23
New changeset 62375fd21de8 by Serhiy Storchaka in branch 'default':
Issue #27007: The fromhex() class methods of bytes and bytearray subclasses
Date User Action Args
2022-04-11 14:58:31adminsetgithub: 71194
2016-07-01 14:23:58serhiy.storchakasetstatus: open -> closed
resolution: fixed
stage: patch review -> resolved
2016-07-01 14:23:16python-devsetnosy: + python-dev
messages: + msg269672
2016-07-01 14:22:16serhiy.storchakasetassignee: serhiy.storchaka
2016-06-21 21:08:54serhiy.storchakasetmessages: + msg269026
2016-05-12 10:09:08serhiy.storchakasetfiles: + bytes_fromhex.patch
keywords: + patch
messages: + msg265387

stage: patch review
2016-05-12 08:03:19serhiy.storchakacreate