diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index 8bf931eda83ae6722ac67dde28a19cc576785679..b2e437fd1ce7bc3f56917cad1294989e9c14a0e6 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 5893fc24b33f13aef44cd56674e46b88ecdfa44b..b23fbae179142a6a54e83bc569213f872ef5b5d9 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