Skip to content

Commit 06de7a9

Browse files
Clearer comments in the C internals
1 parent 4cde2f9 commit 06de7a9

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

Objects/typevarobject.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ PyTypeObject _PyNoDefault_Type = {
123123

124124
PyObject _Py_NoDefaultStruct = _PyObject_HEAD_INIT(&_PyNoDefault_Type);
125125

126-
/* NoExtraItems: a marker object for TypeDict extra-items when it's unset. */
126+
/* NoExtraItems: a marker object for TypeDict extra_items when it's unset. */
127127

128128
static PyObject *
129129
NoExtraItems_repr(PyObject *op)
@@ -155,7 +155,10 @@ noextraitems_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
155155
static void
156156
noextraitems_dealloc(PyObject *obj)
157157
{
158-
/* Immortal singleton: never actually deallocates. */
158+
/* This should never get called, but we also don't want to SEGV if
159+
* we accidentally decref NoDefault out of existence. Instead,
160+
* since NoDefault is an immortal object, re-set the reference count.
161+
*/
159162
_Py_SetImmortal(obj);
160163
}
161164

0 commit comments

Comments
 (0)