[pygobject/invoke-rewrite] [invoke] don't hold on to the constructor class, just add a TODO



commit c94bcf4ae7e36f90c356c89712b00609f9f849bd
Author: John (J5) Palmieri <johnp redhat com>
Date:   Wed Jul 13 15:16:17 2011 -0400

    [invoke] don't hold on to the constructor class, just add a TODO

 gi/pygi-invoke-ng.c           |   11 +++++------
 gi/pygi-invoke-state-struct.h |    1 -
 2 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/gi/pygi-invoke-ng.c b/gi/pygi-invoke-ng.c
index a85f204..6da58cb 100644
--- a/gi/pygi-invoke-ng.c
+++ b/gi/pygi-invoke-ng.c
@@ -93,13 +93,14 @@ _invoke_state_init_from_callable_cache (PyGIInvokeState *state,
     state->py_in_args = py_args;
     state->n_py_in_args = PySequence_Length (py_args);
 
-    /* We don't use the class parameter sent in by  the structure
-     * so we remove it from the py_args tuple but we keep it 
-     * around just in case we want to call actual gobject constructors
+    /* TODO: We don't use the class parameter sent in by  the structure
+     * so we remove it from the py_args tuple but we can keep it 
+     * around if we want to call actual gobject constructors
      * in the future instead of calling g_object_new
      */
     if  (cache->function_type == PYGI_FUNCTION_TYPE_CONSTRUCTOR) {
-        state->constructor_class = PyTuple_GetItem (py_args, 0);
+        PyObject *constructor_class;
+        constructor_class = PyTuple_GetItem (py_args, 0);
 
         if (state->constructor_class == NULL) {
             PyErr_Clear ();
@@ -111,8 +112,6 @@ _invoke_state_init_from_callable_cache (PyGIInvokeState *state,
             return FALSE;
         }
 
-        Py_INCREF (state->constructor_class);
-
         /* we could optimize this by using offsets instead of modifying the tuple but it makes the
          * code more error prone and confusing so don't do that unless profiling shows
          * significant gain
diff --git a/gi/pygi-invoke-state-struct.h b/gi/pygi-invoke-state-struct.h
index 924e511..a4072b7 100644
--- a/gi/pygi-invoke-state-struct.h
+++ b/gi/pygi-invoke-state-struct.h
@@ -10,7 +10,6 @@ G_BEGIN_DECLS
 typedef struct _PyGIInvokeState
 {
     PyObject *py_in_args;
-    PyObject *constructor_class;
     gssize n_py_in_args;
     gssize current_arg;
 



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