Author: Armin Rigo <[email protected]>
Branch:
Changeset: r72061:611f53f81fb1
Date: 2014-06-15 16:09 +0200
http://bitbucket.org/pypy/pypy/changeset/611f53f81fb1/
Log: Bug fix in ll2ctypes
diff --git a/rpython/rtyper/lltypesystem/ll2ctypes.py
b/rpython/rtyper/lltypesystem/ll2ctypes.py
--- a/rpython/rtyper/lltypesystem/ll2ctypes.py
+++ b/rpython/rtyper/lltypesystem/ll2ctypes.py
@@ -948,6 +948,11 @@
REAL_T = lltype.Ptr(REAL_TYPE)
cobj = ctypes.cast(cobj, get_ctypes_type(REAL_T))
container = lltype._struct(REAL_TYPE)
+ # obscuuuuuuuuure: 'cobj' is a ctypes pointer, which is
+ # mutable; and so if we save away the 'cobj' object
+ # itself, it might suddenly later be unexpectedly
+ # modified! Make a copy.
+ cobj = ctypes.cast(cobj, type(cobj))
struct_use_ctypes_storage(container, cobj)
if REAL_TYPE != T.TO:
p = container._as_ptr()
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit