From 53c6673032dc996b877c534ea0150a02e5651927 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Fri, 29 Aug 2014 17:34:41 +0200 Subject: [PATCH] Fix reference count problem when returning an already existing Python object from the native object user data. --- tools/python/apixml2python/linphone.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/python/apixml2python/linphone.py b/tools/python/apixml2python/linphone.py index 4cb724ffc..d42b2a46c 100644 --- a/tools/python/apixml2python/linphone.py +++ b/tools/python/apixml2python/linphone.py @@ -329,7 +329,7 @@ class MethodDefinition: get_user_data_function = return_type_class['class_c_function_prefix'] + "get_user_data" return_from_user_data_code = \ """if ((cresult != NULL) && ({func}(cresult) != NULL)) {{ - return (PyObject *){func}(cresult); + return Py_BuildValue("O", (PyObject *){func}(cresult)); }} """.format(func=get_user_data_function) new_from_native_pointer_code = "pyresult = pylinphone_{return_type}_new_from_native_ptr(&pylinphone_{return_type}Type, cresult);\n".format(return_type=stripped_return_type)