Skip to content

Commit 0fe3047

Browse files
Update documentation.
1 parent be91dfa commit 0fe3047

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Doc/c-api/number.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,9 @@ Number Protocol
196196
197197
See the built-in function :func:`pow`. Returns ``NULL`` on failure. The operation
198198
is done *in-place* when *o1* supports it. This is the equivalent of the Python
199-
statement ``o1 **= o2`` when o3 is :c:data:`Py_None`, or an in-place variant of
200-
``pow(o1, o2, o3)`` otherwise. If *o3* is to be ignored, pass :c:data:`Py_None`
199+
statement ``o1 **= o2`` when o3 is :c:data:`Py_None`, or hypothetical in-place variant of
200+
``pow(o1, o2, o3)`` (not supported in Python) otherwise.
201+
If *o3* is to be ignored, pass :c:data:`Py_None`
201202
in its place (passing ``NULL`` for *o3* would cause an illegal memory access).
202203
203204

Doc/reference/datamodel.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3398,6 +3398,13 @@ left undefined.
33983398
:ref:`faq-augmented-assignment-tuple-error`), but this behavior is in fact
33993399
part of the data model.
34003400

3401+
Note that :meth:`__ipow__` should be defined to accept an optional third
3402+
argument if the third non-``None`` argument of
3403+
:c:func:`PyNumber_InPlacePower` is to be supported.
3404+
3405+
.. versionchanged:: next
3406+
:meth:`!__ipow__` can now be called with three arguments in
3407+
:c:func:`!PyNumber_InPlacePower`.
34013408

34023409
.. method:: object.__neg__(self)
34033410
object.__pos__(self)

Doc/whatsnew/3.14.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ Other language changes
307307
The testbed can also be used to run the test suite of projects other than
308308
CPython itself. (Contributed by Russell Keith-Magee in :gh:`127592`.)
309309

310+
* The :meth:`~object.__ipow__` method should be defined to accept an optional
311+
third argument (as it was documented) to support non-``None`` third argument
312+
in :c:func:`PyNumber_InPlacePower` which no longer ignored if
313+
:meth:`!__ipow__` is defined.
314+
(Contributed by Serhiy Storchaka in :gh:`86069`.)
315+
310316
New modules
311317
===========
312318

0 commit comments

Comments
 (0)