Skip to content

Commit c355f71

Browse files
Check if the name starts with '_' prior to getattr. See #1762. (#1776)
1 parent e7ac972 commit c355f71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

webview/util.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,12 +190,13 @@ def get_functions(obj: object, base_name: str = '', functions: dict[str, object]
190190
for name in dir(obj):
191191
try:
192192
full_name = f'{base_name}.{name}' if base_name else name
193-
target_obj = getattr(obj, name)
194-
195-
if name.startswith('_') or not getattr(target_obj, '_serializable', True):
193+
if name.startswith('_'):
196194
continue
197195

198196
attr = getattr(obj, name)
197+
if not getattr(attr, '_serializable', True):
198+
continue
199+
199200
if inspect.ismethod(attr) or inspect.isfunction(attr):
200201
functions[full_name] = get_args(attr)[1:]
201202
# If the attribute is a class or a non-callable object, make a recursive call

0 commit comments

Comments
 (0)