summaryrefslogtreecommitdiff
path: root/numpy/distutils/conv_template.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/distutils/conv_template.py')
-rw-r--r--numpy/distutils/conv_template.py15
1 files changed, 10 insertions, 5 deletions
diff --git a/numpy/distutils/conv_template.py b/numpy/distutils/conv_template.py
index 6079a4f08..368cdd457 100644
--- a/numpy/distutils/conv_template.py
+++ b/numpy/distutils/conv_template.py
@@ -85,6 +85,8 @@ import os
import sys
import re
+from numpy.distutils.compat import get_exception
+
# names for replacement that are already global.
global_names = {}
@@ -218,7 +220,7 @@ def parse_string(astr, env, level, line) :
name = match.group(1)
try :
val = env[name]
- except KeyError, e :
+ except KeyError:
msg = 'line %d: no definition of key "%s"'%(line, name)
raise ValueError(msg)
return val
@@ -238,7 +240,8 @@ def parse_string(astr, env, level, line) :
code.append(replace_re.sub(replace, pref))
try :
envlist = parse_loop_header(head)
- except ValueError, e :
+ except ValueError:
+ e = get_exception()
msg = "line %d: %s" % (newline, e)
raise ValueError(msg)
for newenv in envlist :
@@ -273,7 +276,7 @@ def resolve_includes(source):
if not os.path.isabs(fn):
fn = os.path.join(d,fn)
if os.path.isfile(fn):
- print 'Including file',fn
+ print ('Including file',fn)
lines.extend(resolve_includes(fn))
else:
lines.append(line)
@@ -287,7 +290,8 @@ def process_file(source):
sourcefile = os.path.normcase(source).replace("\\","\\\\")
try:
code = process_str(''.join(lines))
- except ValueError, e:
+ except ValueError:
+ e = get_exception()
raise ValueError('In "%s" loop at %s' % (sourcefile, e))
return '#line 1 "%s"\n%s' % (sourcefile, code)
@@ -325,6 +329,7 @@ if __name__ == "__main__":
allstr = fid.read()
try:
writestr = process_str(allstr)
- except ValueError, e:
+ except ValueError:
+ e = get_exception()
raise ValueError("In %s loop at %s" % (file, e))
outfile.write(writestr)