mirror of
https://github.com/python/cpython.git
synced 2026-04-20 19:01:14 +00:00
bpo-38237: Let pow() support keyword arguments (GH-16302) (GH-16320)
Backported with release manager approval
This commit is contained in:
parent
865bb685a6
commit
37bc935523
6 changed files with 72 additions and 48 deletions
|
|
@ -1797,22 +1797,22 @@ builtin_ord(PyObject *module, PyObject *c)
|
|||
/*[clinic input]
|
||||
pow as builtin_pow
|
||||
|
||||
x: object
|
||||
y: object
|
||||
z: object = None
|
||||
/
|
||||
base: object
|
||||
exp: object
|
||||
mod: object = None
|
||||
|
||||
Equivalent to x**y (with two arguments) or x**y % z (with three arguments)
|
||||
Equivalent to base**exp (with two arguments) or base**exp % mod (with three arguments)
|
||||
|
||||
Some types, such as ints, are able to use a more efficient algorithm when
|
||||
invoked using the three argument form.
|
||||
[clinic start generated code]*/
|
||||
|
||||
static PyObject *
|
||||
builtin_pow_impl(PyObject *module, PyObject *x, PyObject *y, PyObject *z)
|
||||
/*[clinic end generated code: output=50a14d5d130d404b input=653d57d38d41fc07]*/
|
||||
builtin_pow_impl(PyObject *module, PyObject *base, PyObject *exp,
|
||||
PyObject *mod)
|
||||
/*[clinic end generated code: output=3ca1538221bbf15f input=bd72d0a0ec8e5eb5]*/
|
||||
{
|
||||
return PyNumber_Power(x, y, z);
|
||||
return PyNumber_Power(base, exp, mod);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue