bpo-38070: visit_decref() calls _PyObject_IsFreed() (GH-15782) · python/cpython@5731172 (original) (raw)
Navigation Menu
- GitHub Copilot Write better code with AI
- GitHub Models New Manage and compare prompts
- GitHub Advanced Security Find and fix vulnerabilities
- Actions Automate any workflow
- Codespaces Instant dev environments
- Issues Plan and track work
- Code Review Manage code changes
- Discussions Collaborate outside of code
- Code Search Find more, search less
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Commit 5731172
and
authored
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. (cherry picked from commit d91d4de) Co-authored-by: Victor Stinner vstinner@redhat.com
File tree
1 file changed
lines changed
1 file changed
lines changed
Lines changed: 2 additions & 0 deletions
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 |