You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This requires an extra .decode(), which is rather wasteful given that the str is not of any real use.
This came up for me in parsing the output of git cat-file --batch, which must be a binary stream because it contains bytes, but includes header lines like
Feature or enhancement
Proposal:
bytes.fromhex()
should accept abytes
:Background:
bytes.fromhex()
accepts astr
:However, it refuses to parse a byte string:
This requires an extra
.decode()
, which is rather wasteful given that thestr
is not of any real use.This came up for me in parsing the output of
git cat-file --batch
, which must be a binary stream because it contains bytes, but includes header lines likeThe integers are parseable directly from bytes:
so it seems like an omission that the SHAs are not.
Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
The text was updated successfully, but these errors were encountered: