Serhiy Storchaka
32c7dbb2bc
gh-121485: Always use 64-bit integers for integers bits count (GH-121486)
...
Use 64-bit integers instead of platform specific size_t or Py_ssize_t
to represent the number of bits in Python integer.
2024-08-30 08:13:24 +03:00
Victor Stinner
4c6dca8292
gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() ( #120390 )
...
Add new functions to convert C <stdint.h> numbers from/to Python int:
* PyLong_FromInt32()
* PyLong_FromUInt32()
* PyLong_FromInt64()
* PyLong_FromUInt64()
* PyLong_AsInt32()
* PyLong_AsUInt32()
* PyLong_AsInt64()
* PyLong_AsUInt64()
2024-08-28 10:16:13 +00:00
Serhiy Storchaka
69f2dc5c06
Refactor test_capi.test_long (GH-122113)
...
Share common code for tests for PyLong_As*() functions.
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-07-22 21:43:00 +03:00
Steve Dower
2894aa14f2
gh-121115: Skip __index__ in PyLong_AsNativeBytes by default (GH-121118)
2024-06-28 16:26:21 +01:00
Sergey B Kirpichev
61d3ab32da
gh-116560: Add PyLong_GetSign() public function ( #116561 )
...
Co-authored-by: Victor Stinner <vstinner@python.org>
2024-06-03 14:06:31 +02:00
Steve Dower
687616877b
gh-111140: PyLong_From/AsNativeBytes: Take *flags* rather than just *endianness* (GH-116053)
2024-04-05 16:21:16 +02:00
Serhiy Storchaka
519b2ae22b
gh-117021: Fix integer overflow in PyLong_AsPid() on non-Windows 64-bit platforms (GH-117064)
2024-03-20 15:39:53 +02:00
Victor Stinner
3cac2af5ec
gh-116417: Move limited C API long.c tests to _testlimitedcapi ( #117001 )
...
* Split long.c tests of _testcapi into two parts: limited C API tests
in _testlimitedcapi and non-limited C API tests in _testcapi.
* Move testcapi_long.h from Modules/_testcapi/ to
Modules/_testlimitedcapi/.
* Add MODULE__TESTLIMITEDCAPI_DEPS to Makefile.pre.in.
2024-03-19 14:04:23 +00:00
Gregory P. Smith
fac99b8b0d
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>
2024-02-22 03:27:16 +00:00
Steve Dower
7861dfd26a
gh-111140: Adds PyLong_AsNativeBytes and PyLong_FromNative[Unsigned]Bytes functions (GH-114886)
2024-02-12 20:13:13 +00:00
Serhiy Storchaka
9d40ebf190
gh-110628: Add tests for PyLong C API (GH-110629)
2023-10-14 08:53:57 +03:00
Victor Stinner
be436e08b8
gh-108444: Add PyLong_AsInt() public function ( #108445 )
...
* Rename _PyLong_AsInt() to PyLong_AsInt().
* Add documentation.
* Add test.
* For now, keep _PyLong_AsInt() as an alias to PyLong_AsInt().
2023-08-24 23:55:30 +02:00
Mark Shannon
93923793f6
GH-101291: Add low level, unstable API for pylong (GH-101685)
...
Co-authored-by: Petr Viktorin <encukou@gmail.com>
2023-05-21 14:45:48 +01:00