@@ -69,12 +69,32 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
69
69
on failure.
70
70
71
71
72
+ .. c:function:: PyObject* PyLong_FromInt32(int32_t value)
73
+ PyObject* PyLong_FromInt64(int64_t value)
74
+
75
+ Return a new :c:type:`PyLongObject` object from a signed C
76
+ :c:expr:`int32_t` or :c:expr:`int64_t`, or ``NULL``
77
+ with an exception set on failure.
78
+
79
+ .. versionadded:: 3.14
80
+
81
+
72
82
.. c:function:: PyObject* PyLong_FromUnsignedLongLong(unsigned long long v)
73
83
74
84
Return a new :c:type:`PyLongObject` object from a C :c:expr:`unsigned long long`,
75
85
or ``NULL`` on failure.
76
86
77
87
88
+ .. c:function:: PyObject* PyLong_FromUInt32(uint32_t value)
89
+ PyObject* PyLong_FromUInt64(uint64_t value)
90
+
91
+ Return a new :c:type:`PyLongObject` object from an unsigned C
92
+ :c:expr:`uint32_t` or :c:expr:`uint64_t`, or ``NULL``
93
+ with an exception set on failure.
94
+
95
+ .. versionadded:: 3.14
96
+
97
+
78
98
.. c:function:: PyObject* PyLong_FromDouble(double v)
79
99
80
100
Return a new :c:type:`PyLongObject` object from the integer part of *v*, or
@@ -337,6 +357,43 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
337
357
This function will no longer use :meth:`~object.__int__`.
338
358
339
359
360
+ .. c:function:: int PyLong_AsInt32(PyObject *obj, int32_t *value)
361
+ int PyLong_AsInt64(PyObject *obj, int64_t *value)
362
+
363
+ Set *\* value * to a signed C :c:expr: `int32_t ` or :c:expr: `int64_t `
364
+ representation of *obj *.
365
+
366
+ If the *obj * value is out of range, raise an :exc: `OverflowError `.
367
+
368
+ Set *\* value * and return ``0 `` on success.
369
+ Set an exception and return ``-1 `` on error.
370
+
371
+ *value * must not be ``NULL ``.
372
+
373
+ .. versionadded :: 3.14
374
+
375
+
376
+ .. c :function :: int PyLong_AsUInt32 (PyObject *obj, uint32_t *value)
377
+ int PyLong_AsUInt64(PyObject *obj, uint64_t *value)
378
+
379
+ Set *\* value * to an unsigned C :c:expr: `uint32_t ` or :c:expr: `uint64_t `
380
+ representation of *obj *.
381
+
382
+ If *obj * is not an instance of :c:type: `PyLongObject `, first call its
383
+ :meth: `~object.__index__ ` method (if present) to convert it to a
384
+ :c:type:`PyLongObject`.
385
+
386
+ * If *obj* is negative, raise a :exc:`ValueError`.
387
+ * If the *obj* value is out of range, raise an :exc:`OverflowError`.
388
+
389
+ Set *\*value* and return ``0`` on success.
390
+ Set an exception and return ``-1`` on error.
391
+
392
+ *value* must not be ``NULL``.
393
+
394
+ .. versionadded:: 3.14
395
+
396
+
340
397
.. c:function:: double PyLong_AsDouble(PyObject *pylong)
341
398
342
399
Return a C :c:expr: `double ` representation of *pylong *. *pylong * must be
0 commit comments