Skip to content

webassembly/objpyproxy: Avoid throwing on symbols or iterator. #17604

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

Merged
merged 1 commit into from
Jul 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions ports/webassembly/objpyproxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,12 @@ const py_proxy_handler = {
};
},
has(target, prop) {
// avoid throwing on `Symbol() in proxy` checks
if (typeof prop !== "string") {
// returns true only on iterator because other
// symbols are not considered in the `get` trap
return prop === Symbol.iterator;
}
return Module.ccall(
"proxy_c_to_js_has_attr",
"number",
Expand Down
2 changes: 2 additions & 0 deletions tests/ports/webassembly/py_proxy_has.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ x = []
const x = mp.globals.get("x");
console.log("no_exist" in x);
console.log("sort" in x);
console.log(Symbol.toStringTag in x);
console.log(Symbol.iterator in x);
2 changes: 2 additions & 0 deletions tests/ports/webassembly/py_proxy_has.mjs.exp
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
false
true
false
true
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy