Author: Wim Lavrijsen <wlavrij...@lbl.gov> Branch: cppyy-packaging Changeset: r94850:5b42ae224e5e Date: 2018-07-11 22:28 -0700 http://bitbucket.org/pypy/pypy/changeset/5b42ae224e5e/
Log: do not allow instantiation of namespaces diff --git a/pypy/module/_cppyy/pythonify.py b/pypy/module/_cppyy/pythonify.py --- a/pypy/module/_cppyy/pythonify.py +++ b/pypy/module/_cppyy/pythonify.py @@ -73,7 +73,8 @@ # C++ namespace base class (the C++ class base class defined in _post_import_startup) class CPPNamespace(with_metaclass(CPPNamespaceMeta, object)): - pass + def __init__(self): + raise TypeError("cannot instantiate namespace '%s'", self.__cppname__) # TODO: this can be moved to the interp level (and share template argument 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 @@ -148,6 +148,8 @@ assert gbl.a_ns.d_ns.e_class.f_class.s_f == 66 assert gbl.a_ns.d_ns.e_class.f_class().m_f == -6 + raises(TypeError, gbl.a_ns) + def test03a_namespace_lookup_on_update(self): """Test whether namespaces can be shared across dictionaries.""" _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit