summaryrefslogtreecommitdiffstats
path: root/Modules/_testcapimodule.c
diff options
context:
space:
mode:
authorVictor Stinner <vstinner@python.org>2024-08-28 10:16:13 (GMT)
committerGitHub <noreply@github.com>2024-08-28 10:16:13 (GMT)
commit4c6dca82925bd4be376a3e4a53c8104ad0b0cb5f (patch)
treede2034d6cf355311457c02ba37a73a7932568639 /Modules/_testcapimodule.c
parent1a0b828994ed4ec1f2ba05123995a7d1e852f4b4 (diff)
downloadcpython-4c6dca82925bd4be376a3e4a53c8104ad0b0cb5f.zip
cpython-4c6dca82925bd4be376a3e4a53c8104ad0b0cb5f.tar.gz
cpython-4c6dca82925bd4be376a3e4a53c8104ad0b0cb5f.tar.bz2
gh-120389: Add PyLong_FromInt64() and PyLong_AsInt64() (#120390)
Add new functions to convert C <stdint.h> numbers from/to Python int: * PyLong_FromInt32() * PyLong_FromUInt32() * PyLong_FromInt64() * PyLong_FromUInt64() * PyLong_AsInt32() * PyLong_AsUInt32() * PyLong_AsInt64() * PyLong_AsUInt64()
Diffstat (limited to 'Modules/_testcapimodule.c')
-rw-r--r--Modules/_testcapimodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/_testcapimodule.c b/Modules/_testcapimodule.c
index 981efb9..7ffa87d 100644
--- a/Modules/_testcapimodule.c
+++ b/Modules/_testcapimodule.c
@@ -4046,6 +4046,12 @@ PyInit__testcapi(void)
PyModule_AddIntConstant(m, "the_number_three", 3);
PyModule_AddIntMacro(m, Py_C_RECURSION_LIMIT);
+ PyModule_AddObject(m, "INT32_MIN", PyLong_FromInt32(INT32_MIN));
+ PyModule_AddObject(m, "INT32_MAX", PyLong_FromInt32(INT32_MAX));
+ PyModule_AddObject(m, "UINT32_MAX", PyLong_FromUInt32(UINT32_MAX));
+ PyModule_AddObject(m, "INT64_MIN", PyLong_FromInt64(INT64_MIN));
+ PyModule_AddObject(m, "INT64_MAX", PyLong_FromInt64(INT64_MAX));
+ PyModule_AddObject(m, "UINT64_MAX", PyLong_FromUInt64(UINT64_MAX));
if (PyModule_AddIntMacro(m, Py_single_input)) {
return NULL;