@@ -121,6 +121,7 @@ All integers are implemented as "long" integer objects of arbitrary size.
121
121
Raise :exc:`OverflowError` if the value of *obj* is out of range for a
122
122
:c:type:`long`.
123
123
124
+
124
125
.. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow)
125
126
126
127
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.
133
134
occurs set *\* overflow * to ``0 `` and return ``-1 `` as usual.
134
135
135
136
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
+
137
149
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.
145
160
146
161
.. versionadded :: 3.2
147
162
@@ -175,16 +190,6 @@ All integers are implemented as "long" integer objects of arbitrary size.
175
190
:exc: `OverflowError ` is raised.
176
191
177
192
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
-
188
193
.. c :function :: unsigned PY_LONG_LONG PyLong_AsUnsignedLongLong (PyObject *pylong)
189
194
190
195
.. index ::
0 commit comments