Open
Conversation
Tests pass against Python 2.7 and 3.4 so far. All changes were applied manually (that is, without any conversion tools), so I believe the meaning and intent of all functions have been preserved. Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
objecthash.py
Outdated
| r += chr(random.SystemRandom().getrandbits(8)) | ||
| return hexify(r) | ||
| r = random.SystemRandom().getrandbits(256) | ||
| return hex(r) |
Author
There was a problem hiding this comment.
Ugh, wait a second. I was trying to avoid messing around with types with this change, but this change doesn't ensure the returned str is of length 32.
The parent commit tried a silly substition for `hexify`, seeking to work around the problem that `chr` has a different return type in py3. This brings back `hexify` to ensure that the output of `redactable_rand` is always as expected: a hexadecimal `str` of length 64. Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
This fix is only necessary to run the tests on a platform that does not default to utf-8. To remain py2.7 compatible, we needed to replace `open()` as the built-in does not let you specify an encoding. Signed-off-by: Yung-Chin Oei <yungchin@yungchin.nl>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This set of changes to the Python implementation is sufficient for tests to pass both on 3.4 and 2.7 - if support for older versions is desirable, a bit more work would need doing.
I've aimed to keep changes as minimal as possible, and functional behaviour unchanged.