Open
Description
Issue type
Bug
How did you install PythonMonkey?
Installed from pip
OS platform and distribution
Ubuntu
Python version (python --version
)
3.12
PythonMonkey version (pip show pythonmonkey
)
1.1.0
Bug Description
Hello! Love this project! I have a Python class inheriting from a list
with a couple extra methods and am passing that to JavaScript (see the example below). It seems that my added methods don't exist in JavaScript. If the class inherits from set
or tuple
it works, but then the value is not ordered anymore. I might be doing something wrong, but any help with this would be hugely appreciated!
Standalone code to reproduce the issue
import pythonmonkey as pm
class Collection(list):
def item(self):
print("Do something")
pm.eval("(function(pyFunc) { globalThis.document = pyFunc; })")(Collection((1,2,3)))
pm.eval("console.log(document.item())")
Relevant log output or backtrace
Traceback (most recent call last):
File "/home/andrew/Downloads/TkinterWebBrowser.py", line 10, in <module>
pm.eval("console.log(document.item())")
pythonmonkey.SpiderMonkeyError: Error in file evaluate, on line 1, column 22:
TypeError: document.item is not a function
Stack Trace:
@evaluate:1:22
Additional info if applicable
What branch of PythonMonkey were you developing on? (If applicable)
No response
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Backlog