@@ -121,6 +121,7 @@ All integers are implemented as "long" integer objects of arbitrary size.
121121 Raise :exc:`OverflowError` if the value of *obj* is out of range for a
122122 :c:type:`long`.
123123
124+
124125.. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow)
125126
126127 Return a C :c:type: `long ` representation of *obj *. If *obj * is not an
@@ -133,15 +134,29 @@ All integers are implemented as "long" integer objects of arbitrary size.
133134 occurs set *\* overflow * to ``0 `` and return ``-1 `` as usual.
134135
135136
136- .. c :function :: PY_LONG_LONG PyLong_AsLongLongAndOverflow (PyObject *pylong, int *overflow)
137+ .. c :function :: PY_LONG_LONG PyLong_AsLongLong (PyObject *obj)
138+
139+ .. index ::
140+ single: OverflowError (built-in exception)
141+
142+ Return a C :c:type:`long long` representation of *obj*. If *obj* is not an
143+ instance of :c:type:`PyLongObject`, first call its :meth:`__int__` method
144+ (if present) to convert it to a :c:type:`PyLongObject`.
145+
146+ Raise :exc:`OverflowError` if the value of *obj* is out of range for a
147+ :c:type:`long`.
148+
137149
138- Return a C :c:type: `long long ` representation of the contents of
139- *pylong *. If *pylong * is greater than :const: `PY_LLONG_MAX ` or less
140- than :const: `PY_LLONG_MIN `, set *\* overflow * to ``1 `` or ``-1 ``,
141- respectively, and return ``-1 ``; otherwise, set *\* overflow * to
142- ``0 ``. If any other exception occurs (for example a TypeError or
143- MemoryError), then ``-1`` will be returned and *\*overflow* will
144- be ``0``.
150+ .. c:function:: PY_LONG_LONG PyLong_AsLongLongAndOverflow(PyObject *obj, int *overflow)
151+
152+ Return a C :c:type: `long long ` representation of *obj *. If *obj * is not an
153+ instance of :c:type: `PyLongObject `, first call its :meth: `__int__ ` method
154+ (if present) to convert it to a :c:type:`PyLongObject`.
155+
156+ If the value of *obj* is greater than :const :`PY_LLONG_MAX` or less than
157+ :const :`PY_LLONG_MIN`, set *\*overflow* to ``1`` or ``-1``, respectively,
158+ and return ``-1``; otherwise, set *\*overflow* to ``0 ``. If any other
159+ exception occurs set *\* overflow * to ``0 `` and return ``-1 `` as usual.
145160
146161 .. versionadded :: 3.2
147162
@@ -175,16 +190,6 @@ All integers are implemented as "long" integer objects of arbitrary size.
175190 :exc: `OverflowError ` is raised.
176191
177192
178- .. c :function :: PY_LONG_LONG PyLong_AsLongLong (PyObject *pylong)
179-
180- .. index ::
181- single: OverflowError (built-in exception)
182-
183- Return a C :c:type:`long long` from a Python integer. If *pylong*
184- cannot be represented as a :c:type:`long long`, an
185- :exc:`OverflowError` is raised and ``-1`` is returned.
186-
187-
188193.. c :function :: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong (PyObject *pylong)
189194
190195 .. index ::
0 commit comments