mirror of
https://github.com/python/cpython.git
synced 2025-07-23 03:05:38 +00:00
bpo-36379: __ipow__ must be a ternaryfunc, not a binaryfunc (GH-13546)
If a type's __ipow__ method was implemented in C, attempting to use the *modulo* parameter would cause crashes. https://bugs.python.org/issue36379
This commit is contained in:
parent
c7f7069e77
commit
c7f803b08e
4 changed files with 36 additions and 1 deletions
|
@ -184,6 +184,13 @@ class CAPITest(unittest.TestCase):
|
|||
o @= m1
|
||||
self.assertEqual(o, ("matmul", 42, m1))
|
||||
|
||||
def test_c_type_with_ipow(self):
|
||||
# When the __ipow__ method of a type was implemented in C, using the
|
||||
# modulo param would cause segfaults.
|
||||
o = _testcapi.ipowType()
|
||||
self.assertEqual(o.__ipow__(1), (1, None))
|
||||
self.assertEqual(o.__ipow__(2, 2), (2, 2))
|
||||
|
||||
def test_return_null_without_error(self):
|
||||
# Issue #23571: A function must not return NULL without setting an
|
||||
# error
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue