kuuko pushed a commit to branch master.

commit 606bf8694dff3d0191ccf164610c56be82cb1b95
Author: Kai Huuhko <[email protected]>
Date:   Fri Aug 2 13:16:40 2013 +0000

    elementary ObjectItem: Handle the case where an Elm_Object_Item was
    created in the C library code, thus not containing the Python object
    within it's data.
    
    Fixes phab T268
    
    Reported by: grapemix (Kingston Fung)
---
 efl/elementary/object_item.pyx | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/efl/elementary/object_item.pyx b/efl/elementary/object_item.pyx
index cb28cfc..d57c09c 100644
--- a/efl/elementary/object_item.pyx
+++ b/efl/elementary/object_item.pyx
@@ -35,29 +35,33 @@ cdef Elm_Object_Item * _object_item_from_python(ObjectItem 
item) except NULL:
     return item.item
 
 cdef _object_item_to_python(Elm_Object_Item *it):
-    cdef void *data
-    cdef object item
+    cdef:
+        void *data
+        ObjectItem item
 
     if it == NULL:
         return None
 
     data = elm_object_item_data_get(it)
+
     if data == NULL:
-        return None
+        # Attempt to create a dummy object item
+        item = ObjectItem.__new__(ObjectItem)
+        item._set_obj(it)
+    else:
+        item = <object>data
 
-    item = <object>data
     return item
 
 cdef _object_item_list_to_python(const_Eina_List *lst):
     cdef Elm_Object_Item *it
     ret = []
-    ret_append = ret.append
     while lst:
         it = <Elm_Object_Item *>lst.data
         lst = lst.next
         o = _object_item_to_python(it)
         if o is not None:
-            ret_append(o)
+            ret.append(o)
     return ret
 
 cdef void _object_item_del_cb(void *data, Evas_Object *o, void *event_info) 
with gil:

-- 

------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk

Reply via email to