Skip to content

Commit c562e2e

Browse files
encukouAA-Turner
andauthored
Apply suggestions from code review
Co-authored-by: Adam Turner <[email protected]>
1 parent e961fac commit c562e2e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

Doc/extending/extending.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -214,10 +214,10 @@ and initialize it by calling :c:func:`PyErr_NewException` in the module's
214214

215215
SpamError = PyErr_NewException("spam.error", NULL, NULL);
216216

217-
Since :c:data:`!SpamError` is a global variable, each call to the
218-
:c:data:`Py_mod_exec` function would overwrite it.
219-
For now, let's avoid the issue:
220-
we will block repeated initialization by raising an
217+
Since :c:data:`!SpamError` is a global variable, it will be overwitten every time
218+
the module is reinitialized, when the :c:data:`Py_mod_exec` function is called.
219+
220+
For now, let's avoid the issue: we will block repeated initialization by raising an
221221
:py:exc:`ImportError`::
222222

223223
static PyObject *SpamError = NULL;
@@ -269,8 +269,8 @@ become a dangling pointer. Should it become a dangling pointer, C code which
269269
raises the exception could cause a core dump or other unintended side effects.
270270

271271
For now, the :c:func:`Py_DECREF` call to remove this reference is missing.
272-
Even when the Python interpreter shuts down, :c:data:`!SpamError` will not be
273-
garbage-collected. It will "leak".
272+
Even when the Python interpreter shuts down, the global :c:data:`!SpamError`
273+
variable will not be garbage-collected. It will "leak".
274274
We did, however, ensure that this will happen at most once per process.
275275

276276
We discuss the use of :c:macro:`PyMODINIT_FUNC` as a function return type later in this

0 commit comments

Comments
 (0)