Message282811
bytes.fromhex ignores space characters now (yay!) but still barfs if fed newlines or tabs:
>>> bytes.fromhex('ab\ncd')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: non-hexadecimal number found in fromhex() arg at position 2
>>> bytes.fromhex('ab\tcd')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: non-hexadecimal number found in fromhex() arg at position 2
It's often quite useful to paste blobs of hex into source code (or the REPL) and call ".fromhex" on them. These might include spaces, tabs and/or newlines, and barfing on these other whitespace characters is inconvenient.
I propose that bytes.fromhex should ignore all whitespace. A patch + test is attached. |
|
Date |
User |
Action |
Args |
2016-12-10 00:07:26 | nneonneo | set | recipients:
+ nneonneo |
2016-12-10 00:07:26 | nneonneo | set | messageid: <1481328446.9.0.450435696311.issue28927@psf.upfronthosting.co.za> |
2016-12-10 00:07:26 | nneonneo | link | issue28927 messages |
2016-12-10 00:07:26 | nneonneo | create | |
|