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:
Zackery Spytz 2019-05-31 03:46:36 -06:00 committed by Miss Islington (bot)
parent c7f7069e77
commit c7f803b08e
4 changed files with 36 additions and 1 deletions

View file

@ -7016,7 +7016,7 @@ static slotdef slotdefs[] = {
IBSLOT("__imod__", nb_inplace_remainder, slot_nb_inplace_remainder,
wrap_binaryfunc, "%="),
IBSLOT("__ipow__", nb_inplace_power, slot_nb_inplace_power,
wrap_binaryfunc, "**="),
wrap_ternaryfunc, "**="),
IBSLOT("__ilshift__", nb_inplace_lshift, slot_nb_inplace_lshift,
wrap_binaryfunc, "<<="),
IBSLOT("__irshift__", nb_inplace_rshift, slot_nb_inplace_rshift,