Author: Armin Rigo <[email protected]>
Branch: remove-globals-in-jit
Changeset: r58933:2a2a1ac4f4a4
Date: 2012-11-15 21:43 +0100
http://bitbucket.org/pypy/pypy/changeset/2a2a1ac4f4a4/
Log: Forgot to check this in.
diff --git a/pypy/rpython/lltypesystem/ll2ctypes.py
b/pypy/rpython/lltypesystem/ll2ctypes.py
--- a/pypy/rpython/lltypesystem/ll2ctypes.py
+++ b/pypy/rpython/lltypesystem/ll2ctypes.py
@@ -168,7 +168,12 @@
fields.append((fieldname, cls))
CStruct._fields_ = fields
- class CStruct(ctypes.Structure):
+ if S._hints.get('union', False):
+ base = ctypes.Union
+ else:
+ base = ctypes.Structure
+
+ class CStruct(base):
# no _fields_: filled later by builder()
def _malloc(cls, n=None):
@@ -680,6 +685,7 @@
_int2obj = {}
_callback_exc_info = None
_opaque_objs = [None]
+_opaque_objs_seen = {}
def get_rtyper():
llinterp = LLInterpreter.current_interpreter
@@ -721,8 +727,12 @@
# otherwise it came from integer and we want a c_void_p with
# the same value
if getattr(container, 'llopaque', None):
- no = len(_opaque_objs)
- _opaque_objs.append(container)
+ try:
+ no = _opaque_objs_seen[container]
+ except KeyError:
+ no = len(_opaque_objs)
+ _opaque_objs.append(container)
+ _opaque_objs_seen[container] = no
return no * 2 + 1
else:
container = llobj._obj
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit