From 54f57d7e8e89f052ba81f7571b229e2795c7bce9 Mon Sep 17 00:00:00 2001
From: "[6~" <inform@tiker.net>
Date: Thu, 9 Jan 2020 13:28:08 -0600
Subject: [PATCH] Ensure that Program._context is available, to permit
 context-based caching to work (Closes gh-322)

---
 pyopencl/__init__.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index 683382d6..19cb0ea2 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -381,6 +381,7 @@ class Program(object):
         if arg2 is None:
             # 1-argument form: program
             self._prg = arg1
+            self._context = self._prg.context
 
         elif arg3 is None:
             # 2-argument form: context, source
@@ -422,7 +423,6 @@ class Program(object):
                     stacklevel=3)
 
             self._prg = _cl._Program(self._context, self._source)
-            del self._context
             return self._prg
 
     def get_info(self, arg):
-- 
GitLab