[pygobject/wip/gio-async-awaitable-return] fixup! cache: Resolve and store information about async functions



commit ff0b6971d8ede5089f75a1b426d5beec5af6a7d9
Author: Benjamin Berg <bberg redhat com>
Date:   Tue Nov 17 10:20:32 2020 +0100

    fixup! cache: Resolve and store information about async functions

 gi/pygi-cache.c | 7 ++++---
 gi/pygi-cache.h | 2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/gi/pygi-cache.c b/gi/pygi-cache.c
index d25e4b39..99210a3a 100644
--- a/gi/pygi-cache.c
+++ b/gi/pygi-cache.c
@@ -795,7 +795,7 @@ _function_cache_deinit_real (PyGICallableCache *callable_cache)
     PyGIFunctionCache *function_cache = (PyGIFunctionCache *) callable_cache;
     g_function_invoker_destroy (&((PyGIFunctionCache *) callable_cache)->invoker);
 
-    g_clear_pointer ((GIBaseInfo **) &function_cache->async_finish, g_base_info_unref);
+    Py_CLEAR (function_cache->async_finish);
 
     _callable_cache_deinit_real (callable_cache);
 }
@@ -878,8 +878,9 @@ _function_cache_init (PyGIFunctionCache *function_cache,
             }
 
             if (async_finish && g_base_info_get_type (async_finish))
-                function_cache->async_finish = (GIFunctionInfo *) async_finish;
-            else if (async_finish)
+                function_cache->async_finish = _pygi_info_new ((GIBaseInfo *) async_finish);
+
+            if (async_finish)
                 g_base_info_unref (async_finish);
 
             g_free (finish_name);
diff --git a/gi/pygi-cache.h b/gi/pygi-cache.h
index 0371df91..33444e36 100644
--- a/gi/pygi-cache.h
+++ b/gi/pygi-cache.h
@@ -225,7 +225,7 @@ struct _PyGIFunctionCache {
     PyGICallableCache callable_cache;
 
     /* Information about async functions. */
-    GIFunctionInfo *async_finish;
+    PyObject *async_finish;
 
     /* An invoker with ffi_cif already setup */
     GIFunctionInvoker invoker;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]