Skip to content

Commit 23defa4

Browse files
Add some comments.
1 parent a02c1ae commit 23defa4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

Include/internal/pycore_object.h

+11
Original file line numberDiff line numberDiff line change
@@ -217,13 +217,24 @@ extern void _Py_PrintReferences(FILE *);
217217
extern void _Py_PrintReferenceAddresses(FILE *);
218218
#endif
219219

220+
/* Return the *address* of the object's weaklist.
221+
*
222+
* For static builtin types this will always point to a NULL tp_weaklist.
223+
* This is fine for any deallocation cases, since static types are never
224+
* deallocated and static builtin types are only finalized at the end of
225+
* runtime finalization.
226+
*
227+
* If the weaklist for such types is actually needed then use
228+
* _PyObject_GET_WEAKREFS_LISTPTR().
229+
*/
220230
static inline PyObject **
221231
_PyObject_GET_BASIC_WEAKREFS_LISTPTR(PyObject *op)
222232
{
223233
Py_ssize_t offset = Py_TYPE(op)->tp_weaklistoffset;
224234
return (PyObject **)((char *)op + offset);
225235
}
226236

237+
/* Return the *address* of the object's weaklist. */
227238
static inline PyObject **
228239
_PyObject_GET_WEAKREFS_LISTPTR(PyObject *op)
229240
{

0 commit comments

Comments
 (0)