Skip to content

Commit a4762ae

Browse files
committed
fix the reference count for dicts test_get_default_not_found in Python 3.11
Something is double-free-ed during the final finalization: in a debug build of Python, `./Include/object.h:602: _Py_NegativeRefcount: Assertion failed: object has negative ref count` In non-debug build of Python, it simply segfaults at the end during finalization.
1 parent 5b9deec commit a4762ae

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/JSObjectProxy.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,6 +638,7 @@ PyObject *JSObjectProxyMethodDefinitions::JSObjectProxy_get_method(JSObjectProxy
638638

639639
PyObject *value = JSObjectProxy_get(self, key);
640640
if (value == Py_None) {
641+
Py_INCREF(default_value);
641642
value = default_value;
642643
}
643644

0 commit comments

Comments
 (0)