Skip to content

Commit 5bb0005

Browse files
Make formatting of some return codes conforming to the general style. (#5587)
1 parent 23cdbfa commit 5bb0005

File tree

6 files changed

+18
-18
lines changed

6 files changed

+18
-18
lines changed

Doc/c-api/init.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ Initializing and finalizing the interpreter
273273
the last call to :c:func:`Py_Initialize`. Ideally, this frees all memory
274274
allocated by the Python interpreter. This is a no-op when called for a second
275275
time (without calling :c:func:`Py_Initialize` again first). Normally the
276-
return value is 0. If there were errors during finalization
277-
(flushing buffered data), -1 is returned.
276+
return value is ``0``. If there were errors during finalization
277+
(flushing buffered data), ``-1`` is returned.
278278
279279
This function is provided for a number of reasons. An embedding application
280280
might want to restart Python without having to restart the application itself.
@@ -1018,7 +1018,7 @@ All of the following functions must be called after :c:func:`Py_Initialize`.
10181018
.. c:function:: PY_INT64_T PyInterpreterState_GetID(PyInterpreterState *interp)
10191019
10201020
Return the interpreter's unique ID. If there was any error in doing
1021-
so then -1 is returned and an error is set.
1021+
so then ``-1`` is returned and an error is set.
10221022
10231023
.. versionadded:: 3.7
10241024

Doc/c-api/long.rst

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
137137
Raise :exc:`OverflowError` if the value of *obj* is out of range for a
138138
:c:type:`long`.
139139
140-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
140+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
141141
142142
143143
.. c:function:: long PyLong_AsLongAndOverflow(PyObject *obj, int *overflow)
@@ -151,7 +151,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
151151
return ``-1``; otherwise, set *\*overflow* to ``0``. If any other exception
152152
occurs set *\*overflow* to ``0`` and return ``-1`` as usual.
153153
154-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
154+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
155155
156156
157157
.. c:function:: long long PyLong_AsLongLong(PyObject *obj)
@@ -166,7 +166,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
166166
Raise :exc:`OverflowError` if the value of *obj* is out of range for a
167167
:c:type:`long`.
168168
169-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
169+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
170170
171171
172172
.. c:function:: long long PyLong_AsLongLongAndOverflow(PyObject *obj, int *overflow)
@@ -180,7 +180,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
180180
and return ``-1``; otherwise, set *\*overflow* to ``0``. If any other
181181
exception occurs set *\*overflow* to ``0`` and return ``-1`` as usual.
182182
183-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
183+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
184184
185185
.. versionadded:: 3.2
186186
@@ -197,7 +197,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
197197
Raise :exc:`OverflowError` if the value of *pylong* is out of range for a
198198
:c:type:`Py_ssize_t`.
199199
200-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
200+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
201201
202202
203203
.. c:function:: unsigned long PyLong_AsUnsignedLong(PyObject *pylong)
@@ -259,7 +259,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
259259
If the value of *obj* is out of range for an :c:type:`unsigned long`,
260260
return the reduction of that value modulo ``ULONG_MAX + 1``.
261261
262-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
262+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
263263
264264
265265
.. c:function:: unsigned long long PyLong_AsUnsignedLongLongMask(PyObject *obj)
@@ -271,7 +271,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
271271
If the value of *obj* is out of range for an :c:type:`unsigned long long`,
272272
return the reduction of that value modulo ``PY_ULLONG_MAX + 1``.
273273
274-
Returns -1 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
274+
Returns ``-1`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
275275
276276
277277
.. c:function:: double PyLong_AsDouble(PyObject *pylong)
@@ -282,7 +282,7 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
282282
Raise :exc:`OverflowError` if the value of *pylong* is out of range for a
283283
:c:type:`double`.
284284
285-
Returns -1.0 on error. Use :c:func:`PyErr_Occurred` to disambiguate.
285+
Returns ``-1.0`` on error. Use :c:func:`PyErr_Occurred` to disambiguate.
286286
287287
288288
.. c:function:: void* PyLong_AsVoidPtr(PyObject *pylong)
@@ -292,4 +292,4 @@ distinguished from a number. Use :c:func:`PyErr_Occurred` to disambiguate.
292292
is only assured to produce a usable :c:type:`void` pointer for values created
293293
with :c:func:`PyLong_FromVoidPtr`.
294294
295-
Returns NULL on error. Use :c:func:`PyErr_Occurred` to disambiguate.
295+
Returns *NULL* on error. Use :c:func:`PyErr_Occurred` to disambiguate.

Doc/c-api/memory.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ tracemalloc C API
530530
531531
Track an allocated memory block in the :mod:`tracemalloc` module.
532532
533-
Return 0 on success, return ``-1`` on error (failed to allocate memory to
533+
Return ``0`` on success, return ``-1`` on error (failed to allocate memory to
534534
store the trace). Return ``-2`` if tracemalloc is disabled.
535535
536536
If memory block is already tracked, update the existing trace.

Doc/extending/newtypes.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,8 +384,8 @@ is used to initialize an object after it's created. Unlike the new method, we
384384
can't guarantee that the initializer is called. The initializer isn't called
385385
when unpickling objects and it can be overridden. Our initializer accepts
386386
arguments to provide initial values for our instance. Initializers always accept
387-
positional and keyword arguments. Initializers should return either 0 on
388-
success or -1 on error.
387+
positional and keyword arguments. Initializers should return either ``0`` on
388+
success or ``-1`` on error.
389389

390390
Initializers can be called multiple times. Anyone can call the :meth:`__init__`
391391
method on our objects. For this reason, we have to be extra careful when

Doc/faq/extending.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ How can I execute arbitrary Python statements from C?
6262

6363
The highest-level function to do this is :c:func:`PyRun_SimpleString` which takes
6464
a single string argument to be executed in the context of the module
65-
``__main__`` and returns 0 for success and -1 when an exception occurred
65+
``__main__`` and returns ``0`` for success and ``-1`` when an exception occurred
6666
(including ``SyntaxError``). If you want more control, use
6767
:c:func:`PyRun_String`; see the source for :c:func:`PyRun_SimpleString` in
6868
``Python/pythonrun.c``.

Doc/whatsnew/3.3.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2480,12 +2480,12 @@ Porting C code
24802480
:c:func:`PyUnicode_FromFormat()`, your code will automatically take
24812481
advantage of the new unicode representations.
24822482

2483-
* :c:func:`PyImport_GetMagicNumber` now returns -1 upon failure.
2483+
* :c:func:`PyImport_GetMagicNumber` now returns ``-1`` upon failure.
24842484

24852485
* As a negative value for the *level* argument to :func:`__import__` is no
24862486
longer valid, the same now holds for :c:func:`PyImport_ImportModuleLevel`.
24872487
This also means that the value of *level* used by
2488-
:c:func:`PyImport_ImportModuleEx` is now 0 instead of -1.
2488+
:c:func:`PyImport_ImportModuleEx` is now ``0`` instead of ``-1``.
24892489

24902490

24912491
Building C extensions

0 commit comments

Comments
 (0)