Skip to content

Commit 83aef9f

Browse files
Add dummy _Py_stackref_copy_borrowed_from
1 parent 983affc commit 83aef9f

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

Include/internal/pycore_stackref.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ PyAPI_FUNC(PyObject *) _Py_stackref_close(_PyStackRef ref, const char *filename,
6464
PyAPI_FUNC(_PyStackRef) _Py_stackref_create(PyObject *obj, uint16_t flags, const char *filename, int linenumber);
6565
PyAPI_FUNC(void) _Py_stackref_record_borrow(_PyStackRef ref, const char *filename, int linenumber);
6666
PyAPI_FUNC(void) _Py_stackref_set_borrowed_from(_PyStackRef ref, _PyStackRef borrowed_from, const char *filename, int linenumber);
67+
PyAPI_FUNC(void) _Py_stackref_copy_borrowed_from(_PyStackRef ref, _PyStackRef ref_orig, const char *filename, int linenumber);
6768
extern void _Py_stackref_associate(PyInterpreterState *interp, PyObject *obj, _PyStackRef ref);
6869

6970
static const _PyStackRef PyStackRef_NULL = { .index = 0 };
@@ -249,7 +250,11 @@ _PyStackRef_DUP(_PyStackRef ref, const char *filename, int linenumber)
249250
} else {
250251
flags = Py_TAG_REFCNT;
251252
}
252-
return _Py_stackref_create(obj, flags, filename, linenumber);
253+
_PyStackRef new_ref = _Py_stackref_create(obj, flags, filename, linenumber);
254+
if (flags == Py_TAG_REFCNT && !_Py_IsImmortal(obj)) {
255+
_Py_stackref_copy_borrowed_from(new_ref, ref, filename, linenumber);
256+
}
257+
return new_ref;
253258
}
254259
#define PyStackRef_DUP(REF) _PyStackRef_DUP(REF, __FILE__, __LINE__)
255260

Python/stackrefs.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ _Py_stackref_set_borrowed_from(_PyStackRef ref, _PyStackRef borrowed_from, const
205205
entry_borrowed->borrows++;
206206
}
207207

208+
void
209+
_Py_stackref_copy_borrowed_from(_PyStackRef ref, _PyStackRef ref_orig, const char *filename, int linenumber)
210+
{
211+
}
212+
208213
void
209214
_Py_stackref_associate(PyInterpreterState *interp, PyObject *obj, _PyStackRef ref)
210215
{

0 commit comments

Comments
 (0)