We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac9394e commit 336f4bcCopy full SHA for 336f4bc
1 file changed
libzim/libzim.pyx
@@ -89,10 +89,7 @@ cdef object call_method(object obj, string method):
89
cdef public api:
90
bool obj_has_attribute(object obj, string attribute) with gil:
91
"""Check if a object has a given attribute"""
92
- attr = getattr(obj, attribute.decode('UTF-8'), None)
93
- if not attr:
94
- return False
95
- return True
+ return hasattr(obj, attribute.decode('UTF-8'))
96
97
string string_cy_call_fct(object obj, string method, string *error) with gil:
98
"""Lookup and execute a pure virtual method on object returning a string"""
0 commit comments