Commit Graph

4 Commits

Author SHA1 Message Date
Serhiy Storchaka 7273a58a85
[3.11] gh-115011: Improve support of __index__() in setters of members with unsigned integer type (GH-115029) (GH-115295)
Setters for members with an unsigned integer type now support
the same range of valid values for objects that has a __index__()
method as for int.

Previously, Py_T_UINT, Py_T_ULONG and Py_T_ULLONG did not support
objects that has a __index__() method larger than LONG_MAX.

Py_T_ULLONG did not support negative ints. Now it supports them and
emits a RuntimeWarning.
(cherry picked from commit d9d6909697)
2024-02-11 12:03:48 +00:00
Serhiy Storchaka 89878141ed
[3.11] gh-114392: Improve test_capi.test_structmembers (GH-114393) (GH-115030)
Test all integer member types with extreme values and values outside of
the valid range. Test support of integer-like objects. Test warnings for
wrapped out values.
(cherry picked from commit 15f6f048a6)
2024-02-05 13:24:23 +02:00
Serhiy Storchaka 0244e96d10
[3.11] gh-114388: Fix warnings when assign an unsigned integer member (GH-114391) (GH-115002)
* Fix a RuntimeWarning emitted when assign an integer-like value that
  is not an instance of int to an attribute that corresponds to a C
  struct member of type T_UINT and T_ULONG.
* Fix a double RuntimeWarning emitted when assign a negative integer value
  to an attribute that corresponds to a C struct member of type T_UINT.
(cherry picked from commit 3ddc515255)
2024-02-04 17:54:26 +00:00
Miss Islington (bot) ecc164f350
bpo-34272: Reorganize C API tests. (GH-8551)
Move some C API tests into Lib/test/test_capi/.
(cherry picked from commit f883b7f8ee)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2022-11-12 09:36:42 -08:00