Skip to content

Commit 6f75061

Browse files
committed
Add docstring for the mpz type
Closes #19
1 parent ebd630f commit 6f75061

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

main.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1663,6 +1663,21 @@ static PyMethodDef methods[] = {
16631663
};
16641664

16651665

1666+
PyDoc_STRVAR(mpz_doc,
1667+
"mpz(x, /)\n\
1668+
mpz(x, /, base=10)\n\
1669+
\n\
1670+
Convert a number or string to an integer, or return 0 if no arguments\n\
1671+
are given. If x is a number, return x.__int__(). For floating-point\n\
1672+
numbers, this truncates towards zero.\n\
1673+
\n\
1674+
If x is not a number or if base is given, then x must be a string,\n\
1675+
bytes, or bytearray instance representing an integer literal in the\n\
1676+
given base. The literal can be preceded by '+' or '-' and be surrounded\n\
1677+
by whitespace. The base defaults to 10. Valid bases are 0 and 2-36.\n\
1678+
Base 0 means to interpret the base from the string as an integer literal.");
1679+
1680+
16661681
PyTypeObject MPZ_Type = {
16671682
PyVarObject_HEAD_INIT(NULL, 0)
16681683
.tp_name = "gmp.mpz",
@@ -1676,6 +1691,7 @@ PyTypeObject MPZ_Type = {
16761691
.tp_hash = (hashfunc) hash,
16771692
.tp_getset = getsetters,
16781693
.tp_methods = methods,
1694+
.tp_doc = mpz_doc,
16791695
};
16801696

16811697

0 commit comments

Comments
 (0)