From 814691acdd36ae38cc569def77527cec52b90026 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Tue, 22 Mar 2011 09:35:45 +0000 Subject: avoid flag day by detecting when lc is 1st arg to myblock() --- (limited to 'TurtleArt') diff --git a/TurtleArt/tajail.py b/TurtleArt/tajail.py index c8cea7f..3fcf997 100644 --- a/TurtleArt/tajail.py +++ b/TurtleArt/tajail.py @@ -25,6 +25,7 @@ from math import * def myfunc(f, args): + ''' Run inline Python code ''' # check to make sure no import calls are made if len(args) == 1: myf = 'def f(x): return ' + f.replace('import', '') @@ -44,10 +45,15 @@ def myfunc(f, args): def myfunc_import(parent, f, x): + ''' Run Python code imported from Journal ''' + if 'def myblock(lc,' in f: + base_class = parent.tw.lc # pre-v107, we passed lc + else: + base_class = parent.tw # as of v107, we pass tw userdefined = {} try: exec f in globals(), userdefined - return userdefined['myblock'](parent.tw, x) + return userdefined['myblock'](base_class, x) except: traceback.print_exc() return None -- cgit v0.9.1