Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternate constructors bytes.fromhex() and bytearray.fromhex() return an instance of base type #71194

Closed
serhiy-storchaka opened this issue May 12, 2016 · 4 comments
Assignees
Labels
interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement

Comments

@serhiy-storchaka
Copy link
Member

BPO 27007
Nosy @birkenfeld, @serhiy-storchaka
Files
  • bytes_fromhex.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/serhiy-storchaka'
    closed_at = <Date 2016-07-01.14:23:58.898>
    created_at = <Date 2016-05-12.08:03:18.898>
    labels = ['interpreter-core', 'type-feature']
    title = 'Alternate constructors bytes.fromhex() and bytearray.fromhex() return an instance of base type'
    updated_at = <Date 2016-07-01.14:23:58.897>
    user = 'https://github.com/serhiy-storchaka'

    bugs.python.org fields:

    activity = <Date 2016-07-01.14:23:58.897>
    actor = 'serhiy.storchaka'
    assignee = 'serhiy.storchaka'
    closed = True
    closed_date = <Date 2016-07-01.14:23:58.898>
    closer = 'serhiy.storchaka'
    components = ['Interpreter Core']
    creation = <Date 2016-05-12.08:03:18.898>
    creator = 'serhiy.storchaka'
    dependencies = []
    files = ['42826']
    hgrepos = []
    issue_num = 27007
    keywords = ['patch']
    message_count = 4.0
    messages = ['265375', '265387', '269026', '269672']
    nosy_count = 3.0
    nosy_names = ['georg.brandl', 'python-dev', 'serhiy.storchaka']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue27007'
    versions = ['Python 3.6']

    @serhiy-storchaka
    Copy link
    Member Author

    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.

    [1] http://comments.gmane.org/gmane.comp.python.devel/157649

    @serhiy-storchaka serhiy-storchaka added interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement labels May 12, 2016
    @serhiy-storchaka
    Copy link
    Member Author

    Here is a patch.

    @serhiy-storchaka
    Copy link
    Member Author

    Ping.

    @serhiy-storchaka serhiy-storchaka self-assigned this Jul 1, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Jul 1, 2016

    New changeset 62375fd21de8 by Serhiy Storchaka in branch 'default':
    Issue bpo-27007: The fromhex() class methods of bytes and bytearray subclasses
    https://hg.python.org/cpython/rev/62375fd21de8

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    interpreter-core (Objects, Python, Grammar, and Parser dirs) type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant