From 52b2bcd2c14a745c9762c35657f651205d2922ca Mon Sep 17 00:00:00 2001 From: "Travis E. Oliphant" Date: Thu, 21 Jun 2012 01:48:56 -0500 Subject: [PATCH] Fix the LLVM Object Cache key to include the class name as well.. --- llvm/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/llvm/__init__.py b/llvm/__init__.py index 91d4089..9128c70 100644 --- a/llvm/__init__.py +++ b/llvm/__init__.py @@ -118,10 +118,11 @@ class _ObjectCache(type): def __call__(cls, ptr, *args, **kwargs): objid = _core.PyCObjectVoidPtrToPyLong(ptr) - obj = _ObjectCache.__instances.get(objid) + key = "%s:%d" % (cls.__name__, objid) + obj = _ObjectCache.__instances.get(key) if obj is None: obj = super(_ObjectCache, cls).__call__(ptr, *args, **kwargs) - _ObjectCache.__instances[objid] = obj + _ObjectCache.__instances[key] = obj return obj @staticmethod