Skip to content

newbytes and newstr don't work together with fromhex #452

Open
@tsx

Description

@tsx

Python 2 with future:

>>> from builtins import bytes, str
>>> bytes.fromhex(str('aa'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "venv/lib/python2.7/site-packages/future/types/newbytes.py", line 212, in fromhex
    return cls(string.replace(' ', '').decode('hex'))
  File "venv/lib/python2.7/site-packages/future/types/newstr.py", line 334, in __getattribute__
    raise AttributeError("decode method has been disabled in newstr")
AttributeError: decode method has been disabled in newstr

Python 3:

>>> bytes.fromhex(str('aa'))
b'\xaa'

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions