From a2f532c158a957591761cfbcc96e24d81096899f Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Sun, 7 Jul 2013 20:13:29 -0400
Subject: [PATCH] Fix Array.finish()

---
 pyopencl/array.py | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/pyopencl/array.py b/pyopencl/array.py
index 56ff13c2..69f81f6c 100644
--- a/pyopencl/array.py
+++ b/pyopencl/array.py
@@ -1183,8 +1183,9 @@ class Array(object):
 
     def finish(self):
         # undoc
-        cl.wait_for_events(self.events)
-        del self.events[:]
+        if self.events:
+            cl.wait_for_events(self.events)
+            del self.events[:]
 
     def __getitem__(self, index):
         """
-- 
GitLab