Skip to content

Commit 2f74db1

Browse files
committed
Merge in the GitHub branch
2 parents 1eb82d7 + 30a602f commit 2f74db1

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Doc/c-api/gcsupport.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,10 @@ The :c:member:`~PyTypeObject.tp_traverse` handler must have the following type:
288288
:c:member:`~PyTypeObject.tp_flags` field, the traverse function must call
289289
:c:func:`PyObject_VisitManagedDict` like this::
290290
291-
PyObject_VisitManagedDict((PyObject*)self, visit, arg);
291+
int err = PyObject_VisitManagedDict((PyObject*)self, visit, arg);
292+
if (err) {
293+
return err;
294+
}
292295
293296
Only the members that the instance *owns* (by having
294297
:term:`strong references <strong reference>` to them) must be
@@ -382,14 +385,14 @@ The following functions and macros are safe to use in a
382385
"DuringGC" functions
383386
^^^^^^^^^^^^^^^^^^^^
384387
385-
The following functions should *only* used in a
388+
The following functions should *only* be used in a
386389
:c:member:`~PyTypeObject.tp_traverse` handler; calling them in other
387390
contexts may have unintended consequences.
388391
389392
These functions act like their counterparts without the ``_DuringGC`` suffix,
390393
but they are guaranteed to not have side effects, they do not set an exception
391394
on failure, and they return/set :term:`borrowed references <borrowed reference>`
392-
as detailed in the individual documentation..
395+
as detailed in the individual documentation.
393396
394397
Note that these functions may fail (return ``NULL`` or ``-1``),
395398
but as they do not set an exception, no error information is available.

Modules/_testcapi/heaptype.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ static PyObject *
537537
pytype_getmodulebydef(PyObject *self, PyObject *type)
538538
{
539539
PyObject *mod = PyType_GetModuleByDef((PyTypeObject *)type, _testcapimodule);
540-
assert(mod == PyType_GetModuleByDef((PyTypeObject *)type, _testcapimodule));
540+
assert(mod == PyType_GetModuleByDef_DuringGC((PyTypeObject *)type, _testcapimodule));
541541
return Py_XNewRef(mod);
542542
}
543543

Objects/typeobject.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5745,9 +5745,6 @@ PyType_GetModule_DuringGC(PyTypeObject *type)
57455745
return NULL;
57465746
}
57475747
PyHeapTypeObject* et = (PyHeapTypeObject*)type;
5748-
if (!et->ht_module) {
5749-
return NULL;
5750-
}
57515748
return et->ht_module;
57525749
}
57535750

0 commit comments

Comments
 (0)