From a954832d5573c174e798a061b230932ae4f45fd3 Mon Sep 17 00:00:00 2001
From: Yichao Yu <yyc1992@gmail.com>
Date: Sat, 20 Sep 2014 09:10:52 -0400
Subject: [PATCH] remove dtype hash hack since it is fixed in pypy

---
 pyopencl/array.py |  3 +--
 pyopencl/tools.py | 23 +++--------------------
 2 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/pyopencl/array.py b/pyopencl/array.py
index 01eaf395..b43756f9 100644
--- a/pyopencl/array.py
+++ b/pyopencl/array.py
@@ -38,7 +38,6 @@ from pyopencl.compyte.array import (
         c_contiguous_strides as _c_contiguous_strides,
         ArrayFlags as _ArrayFlags,
         get_common_dtype as _get_common_dtype_base)
-from pyopencl.compyte.dtypes import DTypeDict as _DTypeDict
 from pyopencl.characterize import has_double_support
 
 
@@ -70,7 +69,7 @@ def _create_vector_types():
     from pyopencl.tools import get_or_register_dtype
 
     vec.types = {}
-    vec.type_to_scalar_and_count = _DTypeDict()
+    vec.type_to_scalar_and_count = {}
 
     counts = [2, 3, 4, 8, 16]
 
diff --git a/pyopencl/tools.py b/pyopencl/tools.py
index bc760a94..92bf3a80 100644
--- a/pyopencl/tools.py
+++ b/pyopencl/tools.py
@@ -37,9 +37,7 @@ import re
 
 from pyopencl.compyte.dtypes import (  # noqa
         get_or_register_dtype, TypeNameNotKnown,
-        register_dtype, dtype_to_ctype,
-        dtype_hashable as _dtype_hashable,
-        dtype_to_key as _dtype_to_key)
+        register_dtype, dtype_to_ctype)
 
 
 def _register_types():
@@ -515,16 +513,8 @@ class _CDeclList:
 
         return result
 
-if _dtype_hashable:
-    _memoize_match_dtype_to_c_struct = memoize
-else:
-    import json as _json
-    _memoize_match_dtype_to_c_struct = memoize(
-        key=lambda device, name, dtype, context=None:
-        (device, name, _dtype_to_key(dtype), context))
 
-
-@_memoize_match_dtype_to_c_struct
+@memoize
 def match_dtype_to_c_struct(device, name, dtype, context=None):
     """Return a tuple `(dtype, c_decl)` such that the C struct declaration
     in `c_decl` and the structure :class:`numpy.dtype` instance `dtype`
@@ -672,15 +662,8 @@ def match_dtype_to_c_struct(device, name, dtype, context=None):
 
     return dtype, c_decl
 
-if _dtype_hashable:
-    _memoize_dtype_to_c_struct = memoize
-else:
-    import json as _json  # noqa
-    _memoize_dtype_to_c_struct = memoize(
-        key=lambda device, dtype: (device, _dtype_to_key(dtype)))
-
 
-@_memoize_dtype_to_c_struct
+@memoize
 def dtype_to_c_struct(device, dtype):
     matched_dtype, c_decl = match_dtype_to_c_struct(
             device, dtype_to_ctype(dtype), dtype)
-- 
GitLab