Closed wall-git closed 1 week ago
This occurs because of it tries to expose to win
object of ViewApi
class and goes into an infinite loop. Prefix win
with an underscore to prevent exposing.
Thank you so much, buddy,It has indeed solved my problem. I analyzed that it may be caused by the following code, and I will pay attention to it. Thank you util.py
def get_functions(obj: object, base_name: str = '', functions: dict[str, object] = None):
if obj in exposed_objects:
return functions
else:
exposed_objects.append(obj)
if functions is None:
functions = {}
for name in dir(obj):
full_name = f"{base_name}.{name}" if base_name else name
if name.startswith('_'):
continue
#wall : this line will get stuck
attr = getattr(obj, name)
if inspect.ismethod(attr):
functions[full_name] = get_args(attr)[1:]
# If the attribute is a class or a non-callable object, make a recursive call
elif inspect.isclass(attr) or (isinstance(attr, object) and not callable(attr) and hasattr(attr, "__module__")):
get_functions(attr, full_name, functions)
Having said that, there is still a bug in JS code loading logic that results in this bug. The root of the problem is that objects under window.pywebview
are referenced, before they are created.
I will address this.
Looking forward to your solution👍
Fixed in this PR https://github.com/r0x0r/pywebview/pull/1533 among other improvements
Specification
Description
When I try to pass window into an object instance ,If there is a new URL redirect program, it will get stuck thanks
code example