Fixed issue #1610: leaking reference in Python debugger (#1618)

Co-authored-by: Matthias Koefferlein <matthias@klayout.de>
This commit is contained in:
Matthias Köfferlein 2024-02-11 10:27:53 +01:00 committed by GitHub
parent 6a27a046ba
commit 2be4066856
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 0 deletions

View File

@ -103,6 +103,7 @@ public:
PythonStackTraceProvider (PyFrameObject *frame, const std::string &scope)
: m_scope (scope)
{
PythonRef frame_object_ref;
while (frame != NULL) {
#if PY_VERSION_HEX >= 0x030A0000
@ -123,6 +124,8 @@ public:
#if PY_VERSION_HEX >= 0x030A0000
frame = PyFrame_GetBack(frame);
// PyFrame_GetBack returns a strong reference, hence we need to make sure it is released
frame_object_ref = (PyObject *) frame;
#else
frame = frame->f_back;
#endif