Author: Armin Rigo <[email protected]>
Branch: cpyext-ext
Changeset: r83719:bfdb061894ce
Date: 2016-04-17 18:35 +0200
http://bitbucket.org/pypy/pypy/changeset/bfdb061894ce/
Log: Raise a SystemError when the situation described in the test
happens. (The test itself needs to be fixed)
diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -1,5 +1,6 @@
import sys
+from pypy.interpreter.error import OperationError, oefmt
from pypy.interpreter.baseobjspace import W_Root, SpaceCache
from rpython.rtyper.lltypesystem import rffi, lltype
from rpython.rtyper.extregistry import ExtRegistryEntry
@@ -63,7 +64,15 @@
def realize(self, space, obj):
w_type = from_ref(space, rffi.cast(PyObject, obj.c_ob_type))
- w_obj = space.allocate_instance(self.W_BaseObject, w_type)
+ try:
+ w_obj = space.allocate_instance(self.W_BaseObject, w_type)
+ except OperationError as e:
+ if e.match(space, space.w_TypeError):
+ raise oefmt(space.w_SystemError,
+ "cpyext: don't know how to make a '%N' object "
+ "from a PyObject",
+ w_type)
+ raise
track_reference(space, obj, w_obj)
return w_obj
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit