Author: Wim Lavrijsen <wlavrij...@lbl.gov> Branch: cppyy-packaging Changeset: r94877:e3f75a873428 Date: 2018-07-18 21:20 -0700 http://bitbucket.org/pypy/pypy/changeset/e3f75a873428/
Log: vector<bool>'s base class has no 'data' 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 @@ -459,12 +459,13 @@ pyclass.__init__ = vector_init # size-up the return of data() - pyclass.__real_data = pyclass.data - def data_with_len(self): - arr = self.__real_data() - arr.reshape((len(self),)) - return arr - pyclass.data = data_with_len + if hasattr(pyclass, 'data'): # not the case for e.g. vector<bool> + pyclass.__real_data = pyclass.data + def data_with_len(self): + arr = self.__real_data() + arr.reshape((len(self),)) + return arr + pyclass.data = data_with_len # combine __getitem__ and __len__ to make a pythonized __getitem__ if '__getitem__' in pyclass.__dict__ and '__len__' in pyclass.__dict__: _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit