Skip to content

Commit a2a1bc1

Browse files
committed
Consistent spacing is a pre-requisite to consistently good writing.
1 parent b74fb8e commit a2a1bc1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1356
-1356
lines changed

Doc/c-api/abstract.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Abstract Objects Layer
88

99
The functions in this chapter interact with Python objects regardless of their
1010
type, or with wide classes of object types (e.g. all numerical types, or all
11-
sequence types). When used on object types for which they do not apply, they
11+
sequence types). When used on object types for which they do not apply, they
1212
will raise a Python exception.
1313

1414
It is not possible to use these functions on objects that are not properly

Doc/c-api/allocation.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ Allocating Objects on the Heap
1515
.. c:function:: PyObject* PyObject_Init(PyObject *op, PyTypeObject *type)
1616
1717
Initialize a newly allocated object *op* with its type and initial
18-
reference. Returns the initialized object. Other fields of the object are
19-
not initialized. Despite its name, this function is unrelated to the
18+
reference. Returns the initialized object. Other fields of the object are
19+
not initialized. Despite its name, this function is unrelated to the
2020
object's :meth:`~object.__init__` method (:c:member:`~PyTypeObject.tp_init`
21-
slot). Specifically, this function does **not** call the object's
21+
slot). Specifically, this function does **not** call the object's
2222
:meth:`!__init__` method.
2323
2424
In general, consider this function to be a low-level routine. Use
@@ -29,7 +29,7 @@ Allocating Objects on the Heap
2929
.. note::
3030
3131
This function only initializes the object's memory corresponding to the
32-
initial :c:type:`PyObject` structure. It does not zero the rest.
32+
initial :c:type:`PyObject` structure. It does not zero the rest.
3333
3434
3535
.. c:function:: PyVarObject* PyObject_InitVar(PyVarObject *op, PyTypeObject *type, Py_ssize_t size)
@@ -39,7 +39,7 @@ Allocating Objects on the Heap
3939
4040
.. note::
4141
42-
This function only initializes some of the object's memory. It does not
42+
This function only initializes some of the object's memory. It does not
4343
zero the rest.
4444
4545
@@ -48,7 +48,7 @@ Allocating Objects on the Heap
4848
Allocates a new Python object using the C structure type *TYPE* and the
4949
Python type object *typeobj* (``PyTypeObject*``) by calling
5050
:c:func:`PyObject_Malloc` to allocate memory and initializing it like
51-
:c:func:`PyObject_Init`. The caller will own the only reference to the
51+
:c:func:`PyObject_Init`. The caller will own the only reference to the
5252
object (i.e. its reference count will be one).
5353
5454
Avoid calling this directly to allocate memory for an object; call the type's
@@ -77,8 +77,8 @@ Allocating Objects on the Heap
7777
7878
This macro does not construct a fully initialized object of the given
7979
type; it merely allocates memory and prepares it for further
80-
initialization by :c:member:`~PyTypeObject.tp_init`. To construct a
81-
fully initialized object, call *typeobj* instead. For example::
80+
initialization by :c:member:`~PyTypeObject.tp_init`. To construct a
81+
fully initialized object, call *typeobj* instead. For example::
8282
8383
PyObject *foo = PyObject_CallNoArgs((PyObject *)&PyFoo_Type);
8484
@@ -100,7 +100,7 @@ Allocating Objects on the Heap
100100
* The memory is initialized like :c:func:`PyObject_InitVar`.
101101

102102
This is useful for implementing objects like tuples, which are able to
103-
determine their size at construction time. Embedding the array of fields
103+
determine their size at construction time. Embedding the array of fields
104104
into the same allocation decreases the number of allocations, improving the
105105
memory management efficiency.
106106

@@ -127,8 +127,8 @@ Allocating Objects on the Heap
127127

128128
This macro does not construct a fully initialized object of the given
129129
type; it merely allocates memory and prepares it for further
130-
initialization by :c:member:`~PyTypeObject.tp_init`. To construct a
131-
fully initialized object, call *typeobj* instead. For example::
130+
initialization by :c:member:`~PyTypeObject.tp_init`. To construct a
131+
fully initialized object, call *typeobj* instead. For example::
132132

133133
PyObject *list_instance = PyObject_CallNoArgs((PyObject *)&PyList_Type);
134134

@@ -146,7 +146,7 @@ Allocating Objects on the Heap
146146
147147
.. c:var:: PyObject _Py_NoneStruct
148148
149-
Object which is visible in Python as ``None``. This should only be accessed
149+
Object which is visible in Python as ``None``. This should only be accessed
150150
using the :c:macro:`Py_None` macro, which evaluates to a pointer to this
151151
object.
152152

Doc/c-api/arg.rst

Lines changed: 63 additions & 63 deletions
Large diffs are not rendered by default.

Doc/c-api/bool.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
Boolean Objects
66
---------------
77

8-
Booleans in Python are implemented as a subclass of integers. There are only
9-
two booleans, :c:data:`Py_False` and :c:data:`Py_True`. As such, the normal
10-
creation and deletion functions don't apply to booleans. The following macros
8+
Booleans in Python are implemented as a subclass of integers. There are only
9+
two booleans, :c:data:`Py_False` and :c:data:`Py_True`. As such, the normal
10+
creation and deletion functions don't apply to booleans. The following macros
1111
are available, however.
1212

1313

@@ -19,13 +19,13 @@ are available, however.
1919

2020
.. c:function:: int PyBool_Check(PyObject *o)
2121
22-
Return true if *o* is of type :c:data:`PyBool_Type`. This function always
22+
Return true if *o* is of type :c:data:`PyBool_Type`. This function always
2323
succeeds.
2424
2525
2626
.. c:var:: PyObject* Py_False
2727
28-
The Python ``False`` object. This object has no methods and is
28+
The Python ``False`` object. This object has no methods and is
2929
:term:`immortal`.
3030
3131
.. versionchanged:: 3.12
@@ -34,7 +34,7 @@ are available, however.
3434
3535
.. c:var:: PyObject* Py_True
3636
37-
The Python ``True`` object. This object has no methods and is
37+
The Python ``True`` object. This object has no methods and is
3838
:term:`immortal`.
3939
4040
.. versionchanged:: 3.12

Doc/c-api/buffer.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ Buffer Protocol
1616

1717

1818
Certain objects available in Python wrap access to an underlying memory
19-
array or *buffer*. Such objects include the built-in :class:`bytes` and
19+
array or *buffer*. Such objects include the built-in :class:`bytes` and
2020
:class:`bytearray`, and some extension types like :class:`array.array`.
2121
Third-party libraries may define their own types for special purposes, such
2222
as image processing or numeric analysis.
2323

2424
While each of these types have their own semantics, they share the common
25-
characteristic of being backed by a possibly large memory buffer. It is
25+
characteristic of being backed by a possibly large memory buffer. It is
2626
then desirable, in some situations, to access that buffer directly and
2727
without intermediate copying.
2828

2929
Python provides such a facility at the C and Python level in the form of the
30-
:ref:`buffer protocol <bufferobjects>`. This protocol has two sides:
30+
:ref:`buffer protocol <bufferobjects>`. This protocol has two sides:
3131

3232
.. index:: single: PyBufferProcs (C type)
3333

@@ -41,15 +41,15 @@ Python provides such a facility at the C and Python level in the form of the
4141
Python see :class:`memoryview`.
4242

4343
Simple objects such as :class:`bytes` and :class:`bytearray` expose their
44-
underlying buffer in byte-oriented form. Other forms are possible; for example,
44+
underlying buffer in byte-oriented form. Other forms are possible; for example,
4545
the elements exposed by an :class:`array.array` can be multi-byte values.
4646

4747
An example consumer of the buffer interface is the :meth:`~io.BufferedIOBase.write`
4848
method of file objects: any object that can export a series of bytes through
49-
the buffer interface can be written to a file. While :meth:`!write` only
49+
the buffer interface can be written to a file. While :meth:`!write` only
5050
needs read-only access to the internal contents of the object passed to it,
5151
other methods such as :meth:`~io.BufferedIOBase.readinto` need write access
52-
to the contents of their argument. The buffer interface allows objects to
52+
to the contents of their argument. The buffer interface allows objects to
5353
selectively allow or reject exporting of read-write and read-only buffers.
5454

5555
There are two ways for a consumer of the buffer interface to acquire a buffer
@@ -61,7 +61,7 @@ over a target object:
6161
``y*``, ``w*`` or ``s*`` :ref:`format codes <arg-parsing>`.
6262

6363
In both cases, :c:func:`PyBuffer_Release` must be called when the buffer
64-
isn't needed anymore. Failure to do so could lead to various issues such as
64+
isn't needed anymore. Failure to do so could lead to various issues such as
6565
resource leaks.
6666

6767
.. versionadded:: 3.12
@@ -75,17 +75,17 @@ Buffer structure
7575
================
7676

7777
Buffer structures (or simply "buffers") are useful as a way to expose the
78-
binary data from another object to the Python programmer. They can also be
79-
used as a zero-copy slicing mechanism. Using their ability to reference a
78+
binary data from another object to the Python programmer. They can also be
79+
used as a zero-copy slicing mechanism. Using their ability to reference a
8080
block of memory, it is possible to expose any data to the Python programmer
81-
quite easily. The memory could be a large, constant array in a C extension,
81+
quite easily. The memory could be a large, constant array in a C extension,
8282
it could be a raw block of memory for manipulation before passing to an
8383
operating system library, or it could be used to pass around structured data
8484
in its native, in-memory format.
8585

8686
Contrary to most data types exposed by the Python interpreter, buffers
87-
are not :c:type:`PyObject` pointers but rather simple C structures. This
88-
allows them to be created and copied very simply. When a generic wrapper
87+
are not :c:type:`PyObject` pointers but rather simple C structures. This
88+
allows them to be created and copied very simply. When a generic wrapper
8989
around a buffer is needed, a :ref:`memoryview <memoryview-objects>` object
9090
can be created.
9191

@@ -142,7 +142,7 @@ a buffer, see :c:func:`PyObject_GetBuffer`.
142142

143143
Important exception: If a consumer requests a buffer without the
144144
:c:macro:`PyBUF_FORMAT` flag, :c:member:`~Py_buffer.format` will
145-
be set to ``NULL``, but :c:member:`~Py_buffer.itemsize` still has
145+
be set to ``NULL``, ut :c:member:`~Py_buffer.itemsize` still has
146146
the value for the original format.
147147

148148
If :c:member:`~Py_buffer.shape` is present, the equality

Doc/c-api/capsule.rst

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,15 @@ Refer to :ref:`using-capsules` for more information on using these objects.
1616
1717
This subtype of :c:type:`PyObject` represents an opaque value, useful for C
1818
extension modules who need to pass an opaque value (as a :c:expr:`void*`
19-
pointer) through Python code to other C code. It is often used to make a C
19+
pointer) through Python code to other C code. It is often used to make a C
2020
function pointer defined in one module available to other modules, so the
2121
regular import mechanism can be used to access C APIs defined in dynamically
2222
loaded modules.
2323

2424

2525
.. c:type:: PyCapsule_Destructor
2626
27-
The type of a destructor callback for a capsule. Defined as::
27+
The type of a destructor callback for a capsule. Defined as::
2828

2929
typedef void (*PyCapsule_Destructor)(PyObject *);
3030

@@ -34,81 +34,81 @@ Refer to :ref:`using-capsules` for more information on using these objects.
3434

3535
.. c:function:: int PyCapsule_CheckExact(PyObject *p)
3636
37-
Return true if its argument is a :c:type:`PyCapsule`. This function always
37+
Return true if its argument is a :c:type:`PyCapsule`. This function always
3838
succeeds.
3939
4040
4141
.. c:function:: PyObject* PyCapsule_New(void *pointer, const char *name, PyCapsule_Destructor destructor)
4242
43-
Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer*
43+
Create a :c:type:`PyCapsule` encapsulating the *pointer*. The *pointer*
4444
argument may not be ``NULL``.
4545
4646
On failure, set an exception and return ``NULL``.
4747
48-
The *name* string may either be ``NULL`` or a pointer to a valid C string. If
49-
non-``NULL``, this string must outlive the capsule. (Though it is permitted to
48+
The *name* string may either be ``NULL`` or a pointer to a valid C string. If
49+
non-``NULL``, this string must outlive the capsule. (Though it is permitted to
5050
free it inside the *destructor*.)
5151
5252
If the *destructor* argument is not ``NULL``, it will be called with the
5353
capsule as its argument when it is destroyed.
5454
5555
If this capsule will be stored as an attribute of a module, the *name* should
56-
be specified as ``modulename.attributename``. This will enable other modules
56+
be specified as ``modulename.attributename``. This will enable other modules
5757
to import the capsule using :c:func:`PyCapsule_Import`.
5858
5959
6060
.. c:function:: void* PyCapsule_GetPointer(PyObject *capsule, const char *name)
6161
62-
Retrieve the *pointer* stored in the capsule. On failure, set an exception
62+
Retrieve the *pointer* stored in the capsule. On failure, set an exception
6363
and return ``NULL``.
6464
6565
The *name* parameter must compare exactly to the name stored in the capsule.
6666
If the name stored in the capsule is ``NULL``, the *name* passed in must also
67-
be ``NULL``. Python uses the C function :c:func:`!strcmp` to compare capsule
67+
be ``NULL``. Python uses the C function :c:func:`!strcmp` to compare capsule
6868
names.
6969
7070
7171
.. c:function:: PyCapsule_Destructor PyCapsule_GetDestructor(PyObject *capsule)
7272
73-
Return the current destructor stored in the capsule. On failure, set an
73+
Return the current destructor stored in the capsule. On failure, set an
7474
exception and return ``NULL``.
7575
76-
It is legal for a capsule to have a ``NULL`` destructor. This makes a ``NULL``
76+
It is legal for a capsule to have a ``NULL`` destructor. This makes a ``NULL``
7777
return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
7878
:c:func:`PyErr_Occurred` to disambiguate.
7979
8080
8181
.. c:function:: void* PyCapsule_GetContext(PyObject *capsule)
8282
83-
Return the current context stored in the capsule. On failure, set an
83+
Return the current context stored in the capsule. On failure, set an
8484
exception and return ``NULL``.
8585
86-
It is legal for a capsule to have a ``NULL`` context. This makes a ``NULL``
86+
It is legal for a capsule to have a ``NULL`` context. This makes a ``NULL``
8787
return code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
8888
:c:func:`PyErr_Occurred` to disambiguate.
8989
9090
9191
.. c:function:: const char* PyCapsule_GetName(PyObject *capsule)
9292
93-
Return the current name stored in the capsule. On failure, set an exception
93+
Return the current name stored in the capsule. On failure, set an exception
9494
and return ``NULL``.
9595
96-
It is legal for a capsule to have a ``NULL`` name. This makes a ``NULL`` return
96+
It is legal for a capsule to have a ``NULL`` name. This makes a ``NULL`` return
9797
code somewhat ambiguous; use :c:func:`PyCapsule_IsValid` or
9898
:c:func:`PyErr_Occurred` to disambiguate.
9999
100100
101101
.. c:function:: void* PyCapsule_Import(const char *name, int no_block)
102102
103-
Import a pointer to a C object from a capsule attribute in a module. The
103+
Import a pointer to a C object from a capsule attribute in a module. The
104104
*name* parameter should specify the full name to the attribute, as in
105-
``module.attribute``. The *name* stored in the capsule must match this
105+
``module.attribute``. The *name* stored in the capsule must match this
106106
string exactly.
107107
108108
This function splits *name* on the ``.`` character, and imports the first
109109
element. It then processes further elements using attribute lookups.
110110
111-
Return the capsule's internal *pointer* on success. On failure, set an
111+
Return the capsule's internal *pointer* on success. On failure, set an
112112
exception and return ``NULL``.
113113
114114
.. note::
@@ -124,9 +124,9 @@ Refer to :ref:`using-capsules` for more information on using these objects.
124124
125125
.. c:function:: int PyCapsule_IsValid(PyObject *capsule, const char *name)
126126
127-
Determines whether or not *capsule* is a valid capsule. A valid capsule is
127+
Determines whether or not *capsule* is a valid capsule. A valid capsule is
128128
non-``NULL``, passes :c:func:`PyCapsule_CheckExact`, has a non-``NULL`` pointer
129-
stored in it, and its internal name matches the *name* parameter. (See
129+
stored in it, and its internal name matches the *name* parameter. (See
130130
:c:func:`PyCapsule_GetPointer` for information on how capsule names are
131131
compared.)
132132
@@ -135,35 +135,35 @@ Refer to :ref:`using-capsules` for more information on using these objects.
135135
guaranteed to succeed.
136136
137137
Return a nonzero value if the object is valid and matches the name passed in.
138-
Return ``0`` otherwise. This function will not fail.
138+
Return ``0`` otherwise. This function will not fail.
139139
140140
141141
.. c:function:: int PyCapsule_SetContext(PyObject *capsule, void *context)
142142
143143
Set the context pointer inside *capsule* to *context*.
144144
145-
Return ``0`` on success. Return nonzero and set an exception on failure.
145+
Return ``0`` on success. Return nonzero and set an exception on failure.
146146
147147
148148
.. c:function:: int PyCapsule_SetDestructor(PyObject *capsule, PyCapsule_Destructor destructor)
149149
150150
Set the destructor inside *capsule* to *destructor*.
151151
152-
Return ``0`` on success. Return nonzero and set an exception on failure.
152+
Return ``0`` on success. Return nonzero and set an exception on failure.
153153
154154
155155
.. c:function:: int PyCapsule_SetName(PyObject *capsule, const char *name)
156156
157-
Set the name inside *capsule* to *name*. If non-``NULL``, the name must
158-
outlive the capsule. If the previous *name* stored in the capsule was not
157+
Set the name inside *capsule* to *name*. If non-``NULL``, the name must
158+
outlive the capsule. If the previous *name* stored in the capsule was not
159159
``NULL``, no attempt is made to free it.
160160
161-
Return ``0`` on success. Return nonzero and set an exception on failure.
161+
Return ``0`` on success. Return nonzero and set an exception on failure.
162162
163163
164164
.. c:function:: int PyCapsule_SetPointer(PyObject *capsule, void *pointer)
165165
166-
Set the void pointer inside *capsule* to *pointer*. The pointer may not be
166+
Set the void pointer inside *capsule* to *pointer*. The pointer may not be
167167
``NULL``.
168168
169-
Return ``0`` on success. Return nonzero and set an exception on failure.
169+
Return ``0`` on success. Return nonzero and set an exception on failure.

0 commit comments

Comments
 (0)