Author: Armin Rigo <ar...@tunes.org> Branch: cpyext-gc-support Changeset: r80399:09aca01b9997 Date: 2015-10-23 08:54 +0200 http://bitbucket.org/pypy/pypy/changeset/09aca01b9997/
Log: Fighting ll2ctypes diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py --- a/pypy/module/cpyext/api.py +++ b/pypy/module/cpyext/api.py @@ -649,6 +649,7 @@ llop.gc_stack_bottom(lltype.Void) # marker for trackgcroot.py retval = fatal_value boxed_args = () + tb = None try: if not we_are_translated() and DEBUG_WRAPPER: print >>sys.stderr, callable, @@ -672,6 +673,7 @@ except BaseException, e: failed = True if not we_are_translated(): + tb = sys.exc_info()[2] message = repr(e) import traceback traceback.print_exc() @@ -706,7 +708,8 @@ print 'Fatal error in cpyext, CPython compatibility layer, calling', callable.__name__ print 'Either report a bug or consider not using this particular extension' if not we_are_translated(): - tb = sys.exc_info()[2] + if tb is None: + tb = sys.exc_info()[2] import traceback traceback.print_exc() if sys.stdout == sys.__stdout__: diff --git a/pypy/module/cpyext/stringobject.py b/pypy/module/cpyext/stringobject.py --- a/pypy/module/cpyext/stringobject.py +++ b/pypy/module/cpyext/stringobject.py @@ -137,6 +137,7 @@ # XXX move to C py_str = new_empty_str(space, length) if char_p: + py_str = rffi.cast(PyStringObject, py_str) # needed for ll2ctypes support.memcpy_fn(py_str.c_ob_sval_pypy, char_p, length) return rffi.cast(PyObject, py_str) 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 @@ -569,6 +569,7 @@ raise Exception("internal ll2ctypes error - " "double conversion from lltype to ctypes?") # XXX don't store here immortal structures + print "LL2CTYPES:", self._getid() ALLOCATED[addr] = self def _addressof_storage(self): @@ -578,6 +579,7 @@ return intmask(ctypes.cast(self._storage, ctypes.c_void_p).value) def _free(self): + print "LL2C FREE:", self._getid() self._check() # no double-frees # allow the ctypes object to go away now addr = ctypes.cast(self._storage, ctypes.c_void_p).value _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit