Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r44099:176802d75314 Date: 2011-05-12 14:46 +0200 http://bitbucket.org/pypy/pypy/changeset/176802d75314/
Log: Fix: this opaque pointer dance is only for gc references. This fixes test_rsocket, which takes pointers to individual bytes in a non-gc structure, ending up at odd-valued addresses. 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 @@ -616,7 +616,7 @@ container = llobj._obj.container T = lltype.Ptr(lltype.typeOf(container)) # otherwise it came from integer and we want a c_void_p with - # the same valu + # the same value if getattr(container, 'llopaque', None): no = len(_opaque_objs) _opaque_objs.append(container) @@ -774,7 +774,7 @@ # CFunctionType.__nonzero__ is broken before Python 2.6 return lltype.nullptr(T.TO) if isinstance(T.TO, lltype.Struct): - if ptrval & 1: # a tagged pointer + if T.TO._gckind == 'gc' and ptrval & 1: # a tagged pointer gcref = _opaque_objs[ptrval // 2].hide() return lltype.cast_opaque_ptr(T, gcref) REAL_TYPE = T.TO _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit