[pypy-svn] pypy out-of-line-guards-2: simplify
fijal
commits-noreply at bitbucket.org
Thu Apr 14 21:56:48 CEST 2011
Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: out-of-line-guards-2
Changeset: r43364:c66e3772da5e
Date: 2011-04-14 21:45 +0200
http://bitbucket.org/pypy/pypy/changeset/c66e3772da5e/
Log: simplify
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
@@ -764,12 +764,13 @@
if T is lltype.Void:
return None
if isinstance(T, lltype.Ptr):
- if not cobj or not ctypes.cast(cobj, ctypes.c_void_p).value: # NULL pointer
+ ptrval = ctypes.cast(cobj, ctypes.c_void_p).value
+ if not cobj or not ptrval: # NULL pointer
# CFunctionType.__nonzero__ is broken before Python 2.6
return lltype.nullptr(T.TO)
if isinstance(T.TO, lltype.Struct):
- if ctypes.addressof(cobj[0]) & 1: # a tagged pointer
- gcref = _opaque_objs[ctypes.addressof(cobj[0]) // 2].hide()
+ if ptrval & 1: # a tagged pointer
+ gcref = _opaque_objs[ptrval // 2].hide()
return lltype.cast_opaque_ptr(T, gcref)
REAL_TYPE = T.TO
if T.TO._arrayfld is not None:
More information about the Pypy-commit
mailing list