@@ -664,6 +664,108 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
664664 float(o).
665665 */
666666
667+ /* In-place variants of (some of) the above number protocol functions */
668+
669+ DL_IMPORT (PyObject * ) PyNumber_InPlaceAdd (PyObject * o1 , PyObject * o2 );
670+
671+ /*
672+ Returns the result of adding o2 to o1, possibly in-place, or null
673+ on failure. This is the equivalent of the Python expression:
674+ o1 += o2.
675+
676+ */
677+
678+ DL_IMPORT (PyObject * ) PyNumber_InPlaceSubtract (PyObject * o1 , PyObject * o2 );
679+
680+ /*
681+ Returns the result of subtracting o2 from o1, possibly in-place or
682+ null on failure. This is the equivalent of the Python expression:
683+ o1 -= o2.
684+
685+ */
686+
687+ DL_IMPORT (PyObject * ) PyNumber_InPlaceMultiply (PyObject * o1 , PyObject * o2 );
688+
689+ /*
690+ Returns the result of multiplying o1 by o2, possibly in-place, or
691+ null on failure. This is the equivalent of the Python expression:
692+ o1 *= o2.
693+
694+ */
695+
696+ DL_IMPORT (PyObject * ) PyNumber_InPlaceDivide (PyObject * o1 , PyObject * o2 );
697+
698+ /*
699+ Returns the result of dividing o1 by o2, possibly in-place, or null
700+ on failure. This is the equivalent of the Python expression:
701+ o1 /= o2.
702+
703+ */
704+
705+ DL_IMPORT (PyObject * ) PyNumber_InPlaceRemainder (PyObject * o1 , PyObject * o2 );
706+
707+ /*
708+ Returns the remainder of dividing o1 by o2, possibly in-place, or
709+ null on failure. This is the equivalent of the Python expression:
710+ o1 %= o2.
711+
712+ */
713+
714+ DL_IMPORT (PyObject * ) PyNumber_InPlacePower (PyObject * o1 , PyObject * o2 ,
715+ PyObject * o3 );
716+
717+ /*
718+ Returns the result of raising o1 to the power of o2, possibly
719+ in-place, or null on failure. This is the equivalent of the Python
720+ expression: o1 **= o2, or pow(o1, o2, o3) if o3 is present.
721+
722+ */
723+
724+ DL_IMPORT (PyObject * ) PyNumber_InPlaceLshift (PyObject * o1 , PyObject * o2 );
725+
726+ /*
727+ Returns the result of left shifting o1 by o2, possibly in-place, or
728+ null on failure. This is the equivalent of the Python expression:
729+ o1 <<= o2.
730+
731+ */
732+
733+ DL_IMPORT (PyObject * ) PyNumber_InPlaceRshift (PyObject * o1 , PyObject * o2 );
734+
735+ /*
736+ Returns the result of right shifting o1 by o2, possibly in-place or
737+ null on failure. This is the equivalent of the Python expression:
738+ o1 >>= o2.
739+
740+ */
741+
742+ DL_IMPORT (PyObject * ) PyNumber_InPlaceAnd (PyObject * o1 , PyObject * o2 );
743+
744+ /*
745+ Returns the result of bitwise and of o1 and o2, possibly in-place,
746+ or null on failure. This is the equivalent of the Python
747+ expression: o1 &= o2.
748+
749+ */
750+
751+ DL_IMPORT (PyObject * ) PyNumber_InPlaceXor (PyObject * o1 , PyObject * o2 );
752+
753+ /*
754+ Returns the bitwise exclusive or of o1 by o2, possibly in-place, or
755+ null on failure. This is the equivalent of the Python expression:
756+ o1 ^= o2.
757+
758+ */
759+
760+ DL_IMPORT (PyObject * ) PyNumber_InPlaceOr (PyObject * o1 , PyObject * o2 );
761+
762+ /*
763+ Returns the result of bitwise or or o1 and o2, possibly in-place,
764+ or null on failure. This is the equivalent of the Python
765+ expression: o1 |= o2.
766+
767+ */
768+
667769
668770/* Sequence protocol:*/
669771
@@ -824,6 +926,26 @@ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx*/
824926 expression: o.index(value).
825927 */
826928
929+ /* In-place versions of some of the above Sequence functions. */
930+
931+ DL_IMPORT (PyObject * ) PySequence_InPlaceConcat (PyObject * o1 , PyObject * o2 );
932+
933+ /*
934+ Append o2 to o1, in-place when possible. Return the resulting
935+ object, which could be o1, or NULL on failure. This is the
936+ equivalent of the Python expression: o1 += o2.
937+
938+ */
939+
940+ DL_IMPORT (PyObject * ) PySequence_InPlaceRepeat (PyObject * o , int count );
941+
942+ /*
943+ Repeat o1 by count, in-place when possible. Return the resulting
944+ object, which could be o1, or NULL on failure. This is the
945+ equivalent of the Python expression: o1 *= count.
946+
947+ */
948+
827949/* Mapping protocol:*/
828950
829951 DL_IMPORT (int ) PyMapping_Check (PyObject * o );
0 commit comments