From fafa5794dee4081a39e897e3888b94c203d75cc7 Mon Sep 17 00:00:00 2001
From: Stephan Seitz <stephan.seitz@fau.de>
Date: Wed, 14 Aug 2019 08:22:15 +0200
Subject: [PATCH] Check pyopencl.{CommandQueue,Context} in opencljit

---
 pystencils/opencl/opencljit.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pystencils/opencl/opencljit.py b/pystencils/opencl/opencljit.py
index ed7ba7e..caea978 100644
--- a/pystencils/opencl/opencljit.py
+++ b/pystencils/opencl/opencljit.py
@@ -14,6 +14,8 @@ def make_python_function(kernel_function_node, opencl_queue, opencl_ctx, argumen
     or :func:`pystencils.gpucuda.created_indexed_cuda_kernel`
 
     Args:
+        opencl_queue: a valid :class:`pyopencl.CommandQueue`
+        opencl_ctx: a valid :class:`pyopencl.Context`
         kernel_function_node: the abstract syntax tree
         argument_dict: parameters passed here are already fixed. Remaining parameters have to be passed to the
                        returned kernel functor.
@@ -22,6 +24,8 @@ def make_python_function(kernel_function_node, opencl_queue, opencl_ctx, argumen
         compiled kernel as Python function
     """
     import pyopencl as cl
+    assert opencl_ctx, "No valid OpenCL context"
+    assert opencl_queue, "No valid OpenCL queue"
 
     if argument_dict is None:
         argument_dict = {}
-- 
GitLab