From ab6511e6521d9ade15e0a8097b47fc5c745138e6 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Mon, 6 Sep 2010 17:15:24 -0400
Subject: [PATCH] Sanity check for scalar argument count.

---
 pyopencl/__init__.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/pyopencl/__init__.py b/pyopencl/__init__.py
index e9c44745..0108257c 100644
--- a/pyopencl/__init__.py
+++ b/pyopencl/__init__.py
@@ -224,6 +224,10 @@ def _add_functionality():
                 self.set_arg(i, arg)
         else:
             from struct import pack
+
+            if len(args) != len(arg_type_chars):
+                raise ValueError("length of argument type array and "
+                        "length of argument list do not agree")
             for i, (arg, arg_type_char) in enumerate(
                     zip(args, arg_type_chars)):
                 if arg_type_char:
-- 
GitLab