RecursionError on iterated function call
mgraczyk opened this issue · comments
Michael Graczyk commented
Cool Tool, thanks for sharing (I saw it on Hacker News).
I found this bug while playing around with it.
Steps To Reproduce
- Open Math Inspector ( version 0.9.0 Beta )
- Run the following
Math Inspector 0.9.0 (Beta)
Type "help", "copyright", "credits", "license" for more information
>>> def f(x):
... return x
>>> f(f(1))
Exception in Tkinter callback
Traceback (most recent call last):
File "tkinter/__init__.py", line 1705, in __call__
File "console/prompt.py", line 64, in _on_key
File "console/prompt.py", line 131, in push
File "console/interpreter.py", line 153, in push
File "console/codeparser.py", line 37, in preprocess
File "ast.py", line 271, in visit
File "ast.py", line 279, in generic_visit
File "ast.py", line 271, in visit
File "ast.py", line 281, in generic_visit
File "ast.py", line 271, in visit
File "console/codeparser.py", line 94, in visit_Call
File "util/vdict.py", line 41, in __setitem__
File "node/item.py", line 261, in setarg
File "util/vdict.py", line 41, in __setitem__
File "node/item.py", line 261, in setarg
# ... repeats many times
File "util/vdict.py", line 41, in __setitem__
File "node/item.py", line 255, in setarg
File "tkinter/ttk.py", line 1384, in item
File "tkinter/ttk.py", line 298, in _val_or_dict
File "tkinter/ttk.py", line 73, in _format_optdict
File "tkinter/ttk.py", line 58, in _format_optvalue
File "tkinter/__init__.py", line 57, in _join
File "tkinter/__init__.py", line 61, in _stringify
RecursionError: maximum recursion depth exceeded in __instancecheck__
Expected Result
No error
Actual Result
RecursionError
TheOneThreeSeven commented
Nice catch. This is happening because in the code parsing file there is a bug for this type of scenario. It's going to take a bit of digging into, but should hopefully be very straight forward to resolve. I'll take a shot at it next week.
https://github.com/MathInspector/MathInspector/blob/master/mathinspector/console/codeparser.py
TheOneThreeSeven commented
this has been fixed in this commit c810f3b
the solution was to prevent objects from being allowed to plug their own wire into themselves in node/item.py