From 400686764f1495807b0ab8b854549bb8a4235594 Mon Sep 17 00:00:00 2001 From: furkanonder Date: Sat, 11 Apr 2020 02:04:42 +0300 Subject: [PATCH 1/2] bpo-26571: fix Terminator Exception --- Lib/turtle.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/Lib/turtle.py b/Lib/turtle.py index ee67a351b54f19..04319a3363292a 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -140,7 +140,7 @@ _tg_utilities = ['write_docstringdict', 'done'] __all__ = (_tg_classes + _tg_screen_functions + _tg_turtle_functions + - _tg_utilities + ['Terminator']) # + _math_functions) + _tg_utilities) # + _math_functions) _alias_list = ['addshape', 'backward', 'bk', 'fd', 'ht', 'lt', 'pd', 'pos', 'pu', 'rt', 'seth', 'setpos', 'setposition', 'st', @@ -854,13 +854,6 @@ def numinput(self, title, prompt, default=None, minval=None, maxval=None): ############################################################################## -class Terminator (Exception): - """Will be raised in TurtleScreen.update, if _RUNNING becomes False. - - This stops execution of a turtle graphics script. - Main purpose: use in the Demo-Viewer turtle.Demo.py. - """ - pass class TurtleGraphicsError(Exception): @@ -1289,7 +1282,6 @@ def _incrementudc(self): """Increment update counter.""" if not TurtleScreen._RUNNING: TurtleScreen._RUNNING = True - raise Terminator if self._tracing > 0: self._updatecounter += 1 self._updatecounter %= self._tracing @@ -3944,14 +3936,12 @@ def {name}{paramslist}: if {obj} is None: if not TurtleScreen._RUNNING: TurtleScreen._RUNNING = True - raise Terminator {obj} = {init} try: return {obj}.{name}{argslist} except TK.TclError: if not TurtleScreen._RUNNING: TurtleScreen._RUNNING = True - raise Terminator raise """ From f2e9f057abf119bfb86f4e2f937ed3c971c55b78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Furkan=20=C3=96nder?= Date: Mon, 4 May 2020 00:28:40 +0300 Subject: [PATCH 2/2] add Terminator class --- Lib/turtle.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Lib/turtle.py b/Lib/turtle.py index 04319a3363292a..a553c2569bb905 100644 --- a/Lib/turtle.py +++ b/Lib/turtle.py @@ -854,6 +854,13 @@ def numinput(self, title, prompt, default=None, minval=None, maxval=None): ############################################################################## +class Terminator (Exception): + """Will be raised in TurtleScreen.update, if _RUNNING becomes False. + + This stops execution of a turtle graphics script. + Main purpose: use in the Demo-Viewer turtle.Demo.py. + """ + pass class TurtleGraphicsError(Exception): @@ -3936,12 +3943,14 @@ def {name}{paramslist}: if {obj} is None: if not TurtleScreen._RUNNING: TurtleScreen._RUNNING = True + raise Terminator {obj} = {init} try: return {obj}.{name}{argslist} except TK.TclError: if not TurtleScreen._RUNNING: TurtleScreen._RUNNING = True + raise Terminator raise """