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.

classification
Title: bytearray.fromhex does not work with some hexes generated by hex
Type: behavior Stage:
Components: Library (Lib) Versions: Python 3.3
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Anatoly Belikov
Priority: normal Keywords:

Created on 2014-01-16 11:33 by Anatoly Belikov, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg208273 - (view) Author: Anatoly Belikov (Anatoly Belikov) Date: 2014-01-16 11:33
bytearray.fromhex(hex(434)[2:]) 

throws ValueError: non-hexadecimal number found in fromhex() arg at position 2

Strangely it works with leading zero:

bytearray.fromhex('0' + hex(438)[2:])
msg208274 - (view) Author: Anatoly Belikov (Anatoly Belikov) Date: 2014-01-16 11:48
ok i gave it half byte
History
Date User Action Args
2022-04-11 14:57:57adminsetgithub: 64478
2014-01-16 11:48:26Anatoly Belikovsetstatus: open -> closed
resolution: not a bug
messages: + msg208274
2014-01-16 11:33:15Anatoly Belikovcreate