Author: Wim Lavrijsen <[email protected]>
Branch: reflex-support
Changeset: r62601:1689e35140bf
Date: 2013-03-20 17:35 -0700
http://bitbucket.org/pypy/pypy/changeset/1689e35140bf/
Log: better error reporting for bind_object and associated test
diff --git a/pypy/module/cppyy/interp_cppyy.py
b/pypy/module/cppyy/interp_cppyy.py
--- a/pypy/module/cppyy/interp_cppyy.py
+++ b/pypy/module/cppyy/interp_cppyy.py
@@ -1111,5 +1111,8 @@
w_cppclass = space.findattr(w_pycppclass, space.wrap("_cpp_proxy"))
if not w_cppclass:
w_cppclass = scope_byname(space, space.str_w(w_pycppclass))
+ if not w_cppclass:
+ raise OperationError(space.w_TypeError,
+ space.wrap("no such class: %s" % space.str_w(w_pycppclass)))
cppclass = space.interp_w(W_CPPClass, w_cppclass, can_be_None=False)
return wrap_cppobject(space, rawobject, cppclass, do_cast=False,
python_owns=owns)
diff --git a/pypy/module/cppyy/test/test_advancedcpp.py
b/pypy/module/cppyy/test/test_advancedcpp.py
--- a/pypy/module/cppyy/test/test_advancedcpp.py
+++ b/pypy/module/cppyy/test/test_advancedcpp.py
@@ -417,6 +417,7 @@
assert o == cppyy.bind_object(addr, type(o))
assert o == cppyy.bind_object(addr, o.__class__)
assert o == cppyy.bind_object(addr, "some_concrete_class")
+ raises(TypeError, cppyy.bind_object, addr, "does_not_exist")
raises(TypeError, cppyy.bind_object, addr, 1)
def test10_object_identity(self):
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit