Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging inside function of API object throws RTE on Windows #1327

Closed
wehe64 opened this issue Mar 5, 2024 · 2 comments
Closed

Logging inside function of API object throws RTE on Windows #1327

wehe64 opened this issue Mar 5, 2024 · 2 comments

Comments

@wehe64
Copy link

wehe64 commented Mar 5, 2024

Specification

  • pywebview version: 5.0.4
  • operating system: Windows 11
  • web renderer:

Description

when pywebview.api.title() is called in Javascript, pywebview 5.0.4 throws "unsupported callable"
under 4.4.1 the same code works well

Practicalities

see stack trace and test-api.obj.py attached
try on windows with 5.0.4 (vs 4.4.1)
change line #23 DO_LOGGING=True/False

stacktrace_win-5x.txt
test-api-obj.py.txt

@r0x0r
Copy link
Owner

r0x0r commented Mar 5, 2024

The logger object causes an infinite recursion. I have implemented a simple check and the fix can be found in master.
If you do not want an API object attribute to be exposed, prefix its name with an underscore

@wehe64
Copy link
Author

wehe64 commented Mar 6, 2024

wow, underscore prefixing the logger attribute does the trick!

hm, so all my members are exposed now unless prefixed with _
obviously a byproduct of the new feature allowing the api object having sub-objects
which now implicitly exposes all member attributes.... this explains the break from 4.4.1
maybe exposing through a decorator explicitely w'd be a bit cleaner

anyway, I'm happy now, thanks a great lot!

@wehe64 wehe64 closed this as completed Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants