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
Turtle module crashes python #51323
Comments
Attached file run from IDLE edit window with 3.1, winxp works fine-- Disabling the undo buffer did not solve the problem. Running the file from regular interpreter with
gave essentially same result -- same traceback with slightly different The demo/test at the bottem of turtle.py works fine -- but it does not I do not see the recursion, but calling the configuration merge with |
resubmitting file |
I can reproduce the crash on OSX. After ~ 100 keystrokes, I get the following diagnostics: Exception in Tkinter callback
Traceback (most recent call last):
File "/Users/sasha/Work/python-svn/py3k-commit/Lib/tkinter/__init__.py", line 1399, in __call__
return self.func(*args)
File "/Users/sasha/Work/python-svn/py3k-commit/Lib/turtle.py", line 701, in eventfun
fun()
File "turtlecrash.py", line 12, in klt
def klt(): seth(180); fd(vel)
File "<string>", line 1, in seth
File "/Users/sasha/Work/python-svn/py3k-commit/Lib/turtle.py", line 1936, in setheading
self._rotate(angle)
File "/Users/sasha/Work/python-svn/py3k-commit/Lib/turtle.py", line 3277, in _rotate
self._update()
File "/Users/sasha/Work/python-svn/py3k-commit/Lib/turtle.py", line 2660, in _update
self._update_data()
File "/Users/sasha/Work/python-svn/py3k-commit/Lib/turtle.py", line 2651, in _update_data
self._pencolor, self._pensize)
File "/Users/sasha/Work/python-svn/py3k-commit/Lib/turtle.py", line 545, in _drawline
self.cv.coords(lineitem, *cl)
File "<string>", line 1, in coords
RuntimeError: maximum recursion depth exceeded
Fatal Python error: Cannot recover from stack overflow.
Abort trap |
This looks like a duplicate of bpo-11029. It is not safe to call graphic primitives in event callbacks. A workaround is described at <http://effbot.org/zone/tkinter-threads.htm\>. |
This is not a duplicate because this issue is about the stdlib turtle module doing something wrong and needing to be fixed. Also, this issue does not involve threads, at least none that I starting. "It is not safe to call graphic primitives in event callbacks." This is a confusing statement. The tutorial at def addLine(event):
global lastx, lasty
canvas.create_line((lastx, lasty, event.x, event.y))
lastx, lasty = event.x, event.y Is canvas.create_line a primitive or not? At the very least, unless I missed something, some change to turtle doc is needed. |
"It is not safe to call graphic primitives in event callbacks." |
Ran the turtlecrash.py example with Python 3.6 on MacOS 10.12.4. I was unable to create a crash using keypresses. I recommend closing as 3.2 has reached EOL and 3.3 will reach EOL in less than 5 months. I'm going to change status to Pending and Resolution to out of date. I will close in 2 weeks if there is no further feedback on the issue. Thanks. |
I copied and pasted my code from turtlecrash.py into 3.7 editor, ran, and probably held key down for 3000 clicks, and it worked as it should. |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: