Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3.5 Changeset: r90057:e06ef56cac01 Date: 2017-02-11 19:16 +0000 http://bitbucket.org/pypy/pypy/changeset/e06ef56cac01/
Log: Since 3.3, 0-D memoryviews return an empty tuple for .shape and .strides (hard to test at app-level) diff --git a/pypy/module/cpyext/slotdefs.py b/pypy/module/cpyext/slotdefs.py --- a/pypy/module/cpyext/slotdefs.py +++ b/pypy/module/cpyext/slotdefs.py @@ -323,11 +323,11 @@ self.w_obj = w_obj # kept alive self.pyobj = make_ref(space, w_obj) self.format = format - if not shape: + if shape is None: self.shape = [size] else: self.shape = shape - if not strides: + if strides is None: self.strides = [1] else: self.strides = strides diff --git a/pypy/objspace/std/memoryobject.py b/pypy/objspace/std/memoryobject.py --- a/pypy/objspace/std/memoryobject.py +++ b/pypy/objspace/std/memoryobject.py @@ -428,14 +428,10 @@ def w_get_shape(self, space): self._check_released(space) - if self.getndim() == 0: - return space.w_None return space.newtuple([space.wrap(x) for x in self.getshape()]) def w_get_strides(self, space): self._check_released(space) - if self.getndim() == 0: - return space.w_None return space.newtuple([space.wrap(x) for x in self.getstrides()]) def w_get_suboffsets(self, space): _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit