Imported Upstream version 3.7.91.1
[platform/upstream/pygobject2.git] / gi / pygi-cache.c
index 0848ccf..99f49cf 100644 (file)
@@ -1462,6 +1462,20 @@ _pygi_callable_cache_new (GICallableInfo *callable_info, gboolean is_ccallback)
 
     cache->name = g_base_info_get_name ((GIBaseInfo *)callable_info);
 
+    if (g_base_info_is_deprecated (callable_info)) {
+        const gchar *deprecated = g_base_info_get_attribute (callable_info, "deprecated");
+        gchar *warning;
+        if (deprecated != NULL)
+            warning = g_strdup_printf ("%s.%s is deprecated: %s",
+                                       g_base_info_get_namespace (callable_info), cache->name,
+                                       deprecated);
+        else
+            warning = g_strdup_printf ("%s.%s is deprecated",
+                                       g_base_info_get_namespace (callable_info), cache->name);
+        PyErr_WarnEx(PyExc_DeprecationWarning, warning, 0);
+        g_free (warning);
+    }
+
     if (type == GI_INFO_TYPE_FUNCTION) {
         GIFunctionInfoFlags flags;