From: Richard Kreckel Date: Sun, 17 Feb 2019 19:43:28 +0000 (+0100) Subject: Convert YAPTU to Python3. X-Git-Tag: release_1-7-6~7 X-Git-Url: https://www.ginac.de/ginac.git/static/gitweb.css/ginac.git?a=commitdiff_plain;h=8643e3cba4f229faba5d1aeb9a7b31ba609f81fb;p=ginac.git Convert YAPTU to Python3. It should now work with python2 and python3. --- diff --git a/scripts/yaptu.py b/scripts/yaptu.py index ddf18f50..cffb1905 100644 --- a/scripts/yaptu.py +++ b/scripts/yaptu.py @@ -33,7 +33,7 @@ class copier: def repl(match, self=self): "return the eval of a found expression, for replacement" # uncomment for debug: - # print '!!! replacing',match.group(1) + # print '!!! replacing',match.group(1) expr = self.preproc(match.group(1), 'eval') try: return str(eval(expr, self.globals, self.locals)) except: return str(self.handle(expr)) @@ -65,8 +65,8 @@ class copier: stat = self.preproc(stat, 'exec') stat = '%s _cb(%s,%s)' % (stat,i+1,j) # for debugging, uncomment...: - # print "-> Executing: {"+stat+"}" - exec stat in self.globals,self.locals + # print "-> Executing: {"+stat+"}" + exec(stat, self.globals, self.locals) i=j+1 else: # normal line, just copy with substitution self.ouf.write(self.regex.sub(repl,line))