Skip to content

Commit 41cce07

Browse files
committed
Add location information when accessing already closed stackref
1 parent 54965f3 commit 41cce07

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Objects/object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2984,7 +2984,7 @@ _Py_Dealloc(PyObject *op)
29842984
destructor dealloc = type->tp_dealloc;
29852985
#ifdef Py_DEBUG
29862986
PyThreadState *tstate = _PyThreadState_GET();
2987-
#ifndef Py_GIL_DISABLED
2987+
#if !defined(Py_GIL_DISABLED) && !defined(Py_STACKREF_DEBUG)
29882988
/* This assertion doesn't hold for the free-threading build, as
29892989
* PyStackRef_CLOSE_SPECIALIZED is not implemented */
29902990
assert(tstate->current_frame == NULL || tstate->current_frame->stackpointer != NULL);

Python/stackrefs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ _Py_stackref_record_borrow(_PyStackRef ref, const char *filename, int linenumber
105105
PyInterpreterState *interp = PyInterpreterState_Get();
106106
TableEntry *entry = _Py_hashtable_get(interp->stackref_debug_table, (void *)ref.index);
107107
if (entry == NULL) {
108-
_Py_FatalErrorFormat(__func__, "Invalid StackRef with ID %" PRIu64 "\n", (void *)ref.index);
108+
_Py_FatalErrorFormat(__func__, "Invalid StackRef with ID %" PRIu64 " at %s:%d\n", (void *)ref.index, filename, linenumber);
109109
}
110110
entry->filename_borrow = filename;
111111
entry->linenumber_borrow = linenumber;

0 commit comments

Comments
 (0)