Skip to content

Commit fa2edad

Browse files
Calling tupledealloc() on the empty singleton is an error.
1 parent 597f1bd commit fa2edad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

Objects/tupleobject.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ tupledealloc(PyTupleObject *op)
184184
if (Py_SIZE(op) == 0) {
185185
/* The empty tuple is statically allocated. */
186186
if (op == &_Py_SINGLETON(tuple_empty)) {
187+
#ifdef Py_DEBUG
188+
_Py_FatalRefcountError("deallocating the empty tuple singleton");
189+
#else
187190
return;
191+
#endif
188192
}
189193
/* tuple subclasses have their own empty instances. */
190194
assert(!PyTuple_CheckExact(op));

0 commit comments

Comments
 (0)