[pygobject] Add deprecation warning when setting gpointers to anything other than int.



commit 3ada408434860d0c8eee6c6a869b5a3d801cfbc8
Author: Simon Feltman <s feltman gmail com>
Date:   Thu Sep 13 20:53:22 2012 -0700

    Add deprecation warning when setting gpointers to anything other than int.
    
    This is a first pass which does not change anything except add a warning
    when anything other than an int is set on a gpointer on a boxed type.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=683599

 gi/pygi-info.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gi/pygi-info.c b/gi/pygi-info.c
index dd117ee..a4570ed 100644
--- a/gi/pygi-info.c
+++ b/gi/pygi-info.c
@@ -1427,6 +1427,14 @@ _wrap_g_field_info_set_value (PyGIBaseInfo *self,
             && g_type_info_get_tag (field_type_info) == GI_TYPE_TAG_VOID) {
         int offset;
 
+        if (py_value != Py_None && !PYGLIB_PyLong_Check(py_value)) {
+            if (PyErr_WarnEx(PyExc_RuntimeWarning,
+                         "Usage of gpointers to store objects has been deprecated. "
+                         "Please integer values instead, see: https://bugzilla.gnome.org/show_bug.cgi?id=683599";,
+                         1))
+                goto out;
+        }
+
         offset = g_field_info_get_offset ((GIFieldInfo *) self->info);
         value = _pygi_argument_from_object (py_value, field_type_info, GI_TRANSFER_NOTHING);
 



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