From f20d9ec6ef876dad99751916cd0b6288b349caa8 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner <inform@tiker.net> Date: Sun, 7 Aug 2016 15:29:21 -0500 Subject: [PATCH] Fix compiler diagnostic generation --- pyopencl/__init__.py | 12 ++++++------ pyopencl/cffi_cl.py | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py index 8bf931ed..b2e437fd 100644 --- a/pyopencl/__init__.py +++ b/pyopencl/__init__.py @@ -443,9 +443,9 @@ class Program(object): try: return build_func() except _cl.RuntimeError as e: - what = e.what + msg = e.what if options_bytes: - what = what + "\n(options: %s)" % options_bytes.decode("utf-8") + msg = msg + "\n(options: %s)" % options_bytes.decode("utf-8") if source is not None: from tempfile import NamedTemporaryFile @@ -455,16 +455,16 @@ class Program(object): finally: srcfile.close() - what = what + "\n(source saved as %s)" % srcfile.name + msg = msg + "\n(source saved as %s)" % srcfile.name code = e.code routine = e.routine err = _cl.RuntimeError( _cl.Error._ErrorRecord( - what=lambda: what, - code=lambda: code, - routine=lambda: routine)) + msg=msg, + code=code, + routine=routine)) # Python 3.2 outputs the whole list of currently active exceptions # This serves to remove one (redundant) level from that nesting. diff --git a/pyopencl/cffi_cl.py b/pyopencl/cffi_cl.py index 5893fc24..b23fbae1 100644 --- a/pyopencl/cffi_cl.py +++ b/pyopencl/cffi_cl.py @@ -1450,7 +1450,7 @@ class _Program(_Common): try: self._build(options=options_bytes, devices=devices) except Error as e: - what = e.what + "\n\n" + (75*"="+"\n").join( + msg = e.what + "\n\n" + (75*"="+"\n").join( "Build on %s:\n\n%s" % (dev, log) for dev, log in self._get_build_logs()) code = e.code @@ -1458,9 +1458,9 @@ class _Program(_Common): err = RuntimeError( Error._ErrorRecord( - what=lambda: what, - code=lambda: code, - routine=lambda: routine)) + msg=msg, + code=code, + routine=routine)) if err is not None: # Python 3.2 outputs the whole list of currently active exceptions -- GitLab