bpo-38070: visit_decref() calls _PyObject_IsFreed() (GH-15782) · python/cpython@d91d4de (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit d91d4de
In debug mode, visit_decref() now calls _PyObject_IsFreed() to ensure that the object is not freed. If it's freed, the program fails with an assertion error and Python dumps informations about the freed object.
File tree
1 file changed
lines changed
1 file changed
lines changed
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -376,6 +376,8 @@ static int | ||
376 | 376 | visit_decref(PyObject *op, void *data) |
377 | 377 | { |
378 | 378 | assert(op != NULL); |
379 | +_PyObject_ASSERT(op, !_PyObject_IsFreed(op)); | |
380 | + | |
379 | 381 | if (PyObject_IS_GC(op)) { |
380 | 382 | PyGC_Head *gc = AS_GC(op); |
381 | 383 | /* We're only interested in gc_refs for objects in the |