Skip to content

Commit

Permalink
Prevent ref count error
Browse files Browse the repository at this point in the history
  • Loading branch information
juliannguyen4 committed Sep 24, 2024
1 parent 9469959 commit 8e512bc
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/aerospike.c
Original file line number Diff line number Diff line change
Expand Up @@ -558,6 +558,11 @@ PyMODINIT_FUNC PyInit_aerospike(void)
goto GLOBAL_HOSTS_CLEANUP_ON_ERROR;
}

if (PyType_Check(py_member)) {
// Documentation example shows that we need to increment reference count for static types before adding to module
// It doesn't make clear why though
Py_INCREF(py_member);
}
retval = PyModule_AddObject(py_aerospike_module,
module_pyobjects[i].obj_name, py_member);
if (retval == -1) {
Expand Down

0 comments on commit 8e512bc

Please sign in to comment.