Skip to content

Commit b37e4f5

Browse files
committed
Provide explicit signatures for METH_NOARGS methods
Autogenerated signatures available since 3.13 (python/cpython#107794)
1 parent 62fc751 commit b37e4f5

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

gmp.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2045,24 +2045,32 @@ The signed argument indicates whether two’s complement is used.");
20452045

20462046
extern PyObject * __format__(PyObject *self, PyObject *format_spec);
20472047

2048+
/* Explicit signatures for METH_NOARGS methods are redundant
2049+
since CPython 3.13. */
2050+
20482051
static PyMethodDef methods[] = {
20492052
{"conjugate", (PyCFunction)plus, METH_NOARGS,
2050-
"Returns self."},
2053+
"conjugate($self, /)\n--\n\nReturns self."},
20512054
{"bit_length", bit_length, METH_NOARGS,
2052-
"Number of bits necessary to represent self in binary."},
2055+
("bit_length($self, /)\n--\n\nNumber of bits necessary "
2056+
"to represent self in binary.")},
20532057
{"bit_count", bit_count, METH_NOARGS,
2054-
("Number of ones in the binary representation of the "
2055-
"absolute value of self.")},
2058+
("bit_count($self, /)\n--\n\nNumber of ones in the binary "
2059+
"representation of the absolute value of self.")},
20562060
{"to_bytes", (PyCFunction)to_bytes, METH_FASTCALL | METH_KEYWORDS,
20572061
to_bytes__doc__},
20582062
{"from_bytes", (PyCFunction)from_bytes,
20592063
METH_FASTCALL | METH_KEYWORDS | METH_CLASS, from_bytes__doc__},
20602064
{"as_integer_ratio", as_integer_ratio, METH_NOARGS,
2061-
("Return a pair of integers, whose ratio is equal to self.\n\n"
2065+
("as_integer_ratio($self, /)\n--\n\nReturn a pair of integers, "
2066+
"whose ratio is equal to self.\n\n"
20622067
"The ratio is in lowest terms and has a positive denominator.")},
2063-
{"__trunc__", (PyCFunction)plus, METH_NOARGS, "Returns self."},
2064-
{"__floor__", (PyCFunction)plus, METH_NOARGS, "Returns self."},
2065-
{"__ceil__", (PyCFunction)plus, METH_NOARGS, "Returns self."},
2068+
{"__trunc__", (PyCFunction)plus, METH_NOARGS,
2069+
"__trunc__($self, /)\n--\n\nReturns self."},
2070+
{"__floor__", (PyCFunction)plus, METH_NOARGS,
2071+
"__floor__($self, /)\n--\n\nReturns self."},
2072+
{"__ceil__", (PyCFunction)plus, METH_NOARGS,
2073+
"__ceil__($self, /)\n--\n\nReturns self."},
20662074
{"__round__", (PyCFunction)__round__, METH_FASTCALL,
20672075
("__round__($self, ndigits=0, /)\n--\n\n"
20682076
"Round self to to the closest multiple of 10**-ndigits\n\n"
@@ -2075,8 +2083,9 @@ static PyMethodDef methods[] = {
20752083
("__format__($self, format_spec, /)\n--\n\n"
20762084
"Convert self to a string according to format_spec.")},
20772085
{"__sizeof__", __sizeof__, METH_NOARGS,
2078-
"Returns size of self in memory, in bytes."},
2079-
{"is_integer", is_integer, METH_NOARGS, "Returns True."},
2086+
"__sizeof__($self, /)\n--\n\nReturns size of self in memory, in bytes."},
2087+
{"is_integer", is_integer, METH_NOARGS,
2088+
"is_integer($self, /)\n--\n\nReturns True."},
20802089
{"digits", (PyCFunction)digits, METH_FASTCALL | METH_KEYWORDS,
20812090
("digits($self, base=10)\n--\n\n"
20822091
"Return string representing self in the given base.\n\n"

0 commit comments

Comments
 (0)