GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||
GeezerVison is showing github.com — gh-111140: Fix edge case in PyLong_AsNativeBytes where large negative longs may require an extra byte by zooba · Pull Request #116053 · python/cpython Conversation
|
|
I've improved detection of the two edge cases, though for now there isn't a full solution for the positive input->MSB set output case. What I have tried though is returning a wildly different value from those cases and specifically testing for that, and it comes up just fine. So when we decide how we want to say "it's okay for positive inputs to set the MSB in the result", those TODOs can just come out and set |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Updated the I still need to add new tests. @encukou you are likely interested in the parameter change here |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
The feature looks good to me. (I haven't looked at the implementation yet though.)
The docs need another pass: change remaining endianness args, ensure all the text is in sync, consider making it clearer that -1 isn't a combinable “flag”.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| *[rng.randrange(256) for _ in range(n - 1)] | ||
| ]) | ||
| bytes_le = bytes_be[::-1] | ||
| v = int.from_bytes(bytes_le, 'little') |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Could you use subTest here, to have the chosen value show up on failure?
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
I don't know that subTest is a good idea for non-repeatable values? But I'll see if I can tweak the failure handling to include the value when not running verbose (currently it'll be printed in verbose mode).
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
I updated the failing fuzz test output to look more like this: In verbose mode: Thoughts? I don't think making it a subTest is helpful, since there's no reasonable way to request the test run with a particular value, or to efficiently request a value be skipped. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Thank you! This looks great; I did find a few nitpicks.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Also, please consider these changes to the docs: zooba#33 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Thank you! |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…just *endianness* (pythonGH-116053)
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.