]> git.ipfire.org Git - thirdparty/Python/cpython.git/commit
gh-111140: Improve PyLong_AsNativeBytes API doc example & improve the test (#115380)
authorGregory P. Smith <greg@krypto.org>
Thu, 22 Feb 2024 03:27:16 +0000 (19:27 -0800)
committerGitHub <noreply@github.com>
Thu, 22 Feb 2024 03:27:16 +0000 (03:27 +0000)
commitfac99b8b0df209ca6546545193b1873672d536ca
tree8f5861020e44f45a8cdf5c5af004750c4aa57d96
parent7f5e3f04f838686d65f1053a5e47f5d3faf0b228
gh-111140: Improve PyLong_AsNativeBytes API doc example & improve the test (#115380)

This expands the examples to cover both realistic use cases for the API.

I noticed thing in the test that could be done better so I added those as well: We need to guarantee that all bytes of the result are overwritten and that too many are not written.  Tests now pre-fills the result with data in order to ensure that.

Co-authored-by: Steve Dower <steve.dower@microsoft.com>
Doc/c-api/long.rst
Lib/test/test_capi/test_long.py