-
Notifications
You must be signed in to change notification settings - Fork 19
jit, stdlib: PR 1187 review follow-ups; cpython_tests: per-host baseline overlay #1196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,19 @@ def __setattr__(cls, name, value): | |
| _MISSING = object() | ||
|
|
||
|
|
||
| def _buffer_size(value): | ||
| """Byte length of a buffer parameter, the `Py_buffer.len` the clinic | ||
| converter measures. | ||
|
|
||
| Not `len()`: a memoryview over a wider itemsize counts items, so | ||
| `array('I', [0] * 5)` is 5 there and 20 bytes here, and only the byte | ||
| count decides whether the salt fits. | ||
| """ | ||
| if type(value) is bytes: | ||
| return len(value) | ||
| return memoryview(value).nbytes | ||
|
|
||
|
|
||
| def _make_blake_type(class_name, _salt_size, _person_size, _key_size, | ||
| _digest_size, max_offset, _block_size): | ||
| class _Blake(metaclass=_Immutable): | ||
|
|
@@ -99,6 +112,17 @@ def __new__(cls, *args, **kwargs): | |
| "digest_size must be between 1 and %d bytes" % | ||
| cls.MAX_DIGEST_SIZE | ||
| ) | ||
| # Salt and person are rejected before the tree parameters and the | ||
| # key after them, the order lib_pypy/_blake2 sets each field in. | ||
| # `blake2b(salt=b'x' * 17, fanout=256)` reports the salt. | ||
| if _buffer_size(salt) > cls.SALT_SIZE: | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When Useful? React with 👍 / 👎. |
||
| raise ValueError( | ||
| "maximum salt length is %d bytes" % cls.SALT_SIZE | ||
| ) | ||
| if _buffer_size(person) > cls.PERSON_SIZE: | ||
| raise ValueError( | ||
| "maximum person length is %d bytes" % cls.PERSON_SIZE | ||
| ) | ||
| if not 0 <= fanout <= 255: | ||
| raise ValueError("fanout must be between 0 and 255") | ||
| if not 1 <= depth <= 255: | ||
|
|
@@ -118,6 +142,10 @@ def __new__(cls, *args, **kwargs): | |
| "inner_size must be between 0 and %d" % | ||
| cls.MAX_DIGEST_SIZE | ||
| ) | ||
| if _buffer_size(key) > cls.MAX_KEY_SIZE: | ||
| raise ValueError( | ||
| "maximum key length is %d bytes" % cls.MAX_KEY_SIZE | ||
| ) | ||
|
|
||
| # Both clinic bool converters are observable through __bool__. | ||
| bool(usedforsecurity) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a host overlay has only a
dynasmoverride but the shared baseline has an explicitcraneliftverdict, a cranelift run returns the overlay's dynasm fallback before consulting the shared cranelift entry. This can deselect a shared-PASS cranelift module or gate it against the wrong status; resolve exact backend entries across overlay and shared baseline first, and only then apply the dynasm fallback.Useful? React with 👍 / 👎.