summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Huuhko <kai.huuhko@gmail.com>2015-03-12 16:19:35 +0200
committerKai Huuhko <kai.huuhko@gmail.com>2015-03-12 16:19:35 +0200
commit270ac10e0909b63f8aa8a935b3876a43fabf212e (patch)
tree58d4bb8bf97abad10363e65ebed26060a7312feb
parent179404e2796cd9ec3bb077403f6be46317b7722a (diff)
Evas.SmartObject: Optimize python cb call
-rw-r--r--efl/evas/efl.evas_object_smart.pxi16
1 files changed, 12 insertions, 4 deletions
diff --git a/efl/evas/efl.evas_object_smart.pxi b/efl/evas/efl.evas_object_smart.pxi
index 4831749..4cd32d0 100644
--- a/efl/evas/efl.evas_object_smart.pxi
+++ b/efl/evas/efl.evas_object_smart.pxi
@@ -19,7 +19,7 @@ from efl.utils.conversions cimport eina_list_objects_to_python_list
19from efl.c_eo cimport eo_do, eo_do_ret, eo_key_data_del, eo_key_data_set, eo_key_data_get 19from efl.c_eo cimport eo_do, eo_do_ret, eo_key_data_del, eo_key_data_set, eo_key_data_get
20from efl.eo cimport Eo, EoIterator 20from efl.eo cimport Eo, EoIterator
21 21
22from cpython cimport PyMem_Malloc, Py_INCREF, Py_DECREF 22from cpython cimport PyMem_Malloc, Py_INCREF, Py_DECREF, PyObject_Call
23 23
24#cdef object _smart_classes 24#cdef object _smart_classes
25#_smart_classes = list() 25#_smart_classes = list()
@@ -340,10 +340,13 @@ cdef void _smart_callback(void *data, Evas_Object *o, void *event_info) with gil
340 return 340 return
341 341
342 cdef _SmartCb spec = <_SmartCb>data 342 cdef _SmartCb spec = <_SmartCb>data
343 cdef list tmp_args
343 344
344 if event_info == NULL: 345 if event_info == NULL:
345 try: 346 try:
346 spec.func(spec.obj, *spec.args, **spec.kargs) 347 tmp_args = [spec.obj]
348 tmp_args.extend(spec.args)
349 PyObject_Call(spec.func, tuple(tmp_args), spec.kargs)
347 except Exception: 350 except Exception:
348 traceback.print_exc() 351 traceback.print_exc()
349 elif spec.event_conv == NULL: 352 elif spec.event_conv == NULL:
@@ -353,12 +356,17 @@ cdef void _smart_callback(void *data, Evas_Object *o, void *event_info) with gil
353 spec.event 356 spec.event
354 ) 357 )
355 try: 358 try:
356 spec.func(spec.obj, *spec.args, **spec.kargs) 359 tmp_args = [spec.obj]
360 tmp_args.extend(spec.args)
361 PyObject_Call(spec.func, tuple(tmp_args), spec.kargs)
357 except Exception: 362 except Exception:
358 traceback.print_exc() 363 traceback.print_exc()
359 else: 364 else:
360 try: 365 try:
361 spec.func(spec.obj, spec.event_conv(event_info), *spec.args, **spec.kargs) 366 tmp_args = [spec.obj]
367 tmp_args.append(spec.event_conv(event_info))
368 tmp_args.extend(spec.args)
369 PyObject_Call(spec.func, tuple(tmp_args), spec.kargs)
362 except Exception: 370 except Exception:
363 traceback.print_exc() 371 traceback.print_exc()
364 372