bip-0327: use a portable monotonic clock in the reference self-test - #2278
Open
fametrano wants to merge 1 commit into
Open
bip-0327: use a portable monotonic clock in the reference self-test#2278fametrano wants to merge 1 commit into
fametrano wants to merge 1 commit into
Conversation
reference.py reads time.clock_gettime_ns(time.CLOCK_MONOTONIC) to vary extra_in across signing iterations. Both symbols are documented "Availability: Unix", so `python3 reference.py` raises AttributeError on Windows. time.monotonic_ns() is the portable monotonic clock CPython documents for measuring elapsed time, available on all platforms since 3.7. Not tested on Windows.
Member
|
I’m a bit on the fence regarding maintenance updates to the reference implementations, as this repository is not intended to maintain living code, but allows attaching reference implementations o illustrate how features could be implemented. From the linked report, it sounds like this is fixes a crash, though. Since Python 3.7 has been out since 2018, this seems low-risk and benign, so SGTM. Will wait for a few days to see if the owners have an opinion. |
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.
bip-0327/reference.py's self-test readstime.clock_gettime_ns(time.CLOCK_MONOTONIC)forextra_in. Both symbols are documented "Availability: Unix" in CPython, sopython3 reference.pyraisesAttributeErroron Windows.time.monotonic_ns()is the portable monotonic clock CPython documents for measuring elapsed time, available on all platforms since 3.7. It returns the same nanosecond int, so.to_bytes(8, 'big')is unaffected.Not tested on Windows; verified against CPython's platform-availability docs.