Skip to content

Commit ede4b1c

Browse files
No need to synthetically add the keys method for JSObjectProxy now that the real method is implemented
1 parent e66ea2f commit ede4b1c

File tree

1 file changed

+1
-16
lines changed

1 file changed

+1
-16
lines changed

python/pythonmonkey/__init__.py

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,4 @@
1414
require("base64")
1515
require("timers")
1616
require("url")
17-
require("XMLHttpRequest")
18-
19-
# Add the `.keys()` method on `Object.prototype` to get JSObjectProxy dict() conversion working
20-
# Conversion from a dict-subclass to a strict dict by `dict(subclass)` internally calls the .keys() method to read the dictionary keys,
21-
# but .keys on a JSObjectProxy can only come from the JS side
22-
pythonmonkey.eval("""
23-
(makeList) => {
24-
const keysMethod = {
25-
get() {
26-
return () => makeList(...Object.keys(this))
27-
}
28-
}
29-
Object.defineProperty(Object.prototype, "keys", keysMethod)
30-
Object.defineProperty(Array.prototype, "keys", keysMethod)
31-
}
32-
""", { 'filename': __file__, 'fromPythonFrame': True })(lambda *args: list(args))
17+
require("XMLHttpRequest")

0 commit comments

Comments
 (0)