kuuko pushed a commit to branch master. http://git.enlightenment.org/bindings/python/python-efl.git/commit/?id=be547283f0b832c7027e7a1e184a0ac8507f65d9
commit be547283f0b832c7027e7a1e184a0ac8507f65d9 Author: Kai Huuhko <[email protected]> Date: Wed Oct 30 03:12:35 2013 +0200 Eo: Speed up, and fix a cornercase in, _properties_from_keyword_args. hasattr tries getattr which can be variedly slow, so check dict instead. This also fixes it in cases where the property doesn't have a __get__ function. --- efl/eo/efl.eo.pyx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/efl/eo/efl.eo.pyx b/efl/eo/efl.eo.pyx index 45a113e..b0d40fe 100644 --- a/efl/eo/efl.eo.pyx +++ b/efl/eo/efl.eo.pyx @@ -200,8 +200,9 @@ cdef class Eo(object): Py_INCREF(self) cdef void _set_properties_from_keyword_args(self, dict kwargs) except *: + cdef list cls_list = dir(self) for k, v in kwargs.items(): - assert hasattr(self, k), "%s has no attribute with the name %s." % (self, k) + assert k in cls_list, "%s has no attribute with the name %s." % (self, k) setattr(self, k, v) def is_deleted(self): --
