Author: Brian Kearns <bdkea...@gmail.com> Branch: refactor-buffer-api Changeset: r70944:73a08eb40847 Date: 2014-04-24 16:58 -0400 http://bitbucket.org/pypy/pypy/changeset/73a08eb40847/
Log: correct a use of bufferstr_w in marshal_impl diff --git a/pypy/module/marshal/test/test_marshalimpl.py b/pypy/module/marshal/test/test_marshalimpl.py --- a/pypy/module/marshal/test/test_marshalimpl.py +++ b/pypy/module/marshal/test/test_marshalimpl.py @@ -43,6 +43,8 @@ s = marshal.dumps(array.array('c', 'asd')) t = marshal.loads(s) assert type(t) is str and t == 'asd' + exc = raises(ValueError, marshal.dumps, memoryview('asd')) + assert str(exc.value) == "unmarshallable object" def test_unmarshal_evil_long(self): import marshal diff --git a/pypy/objspace/std/marshal_impl.py b/pypy/objspace/std/marshal_impl.py --- a/pypy/objspace/std/marshal_impl.py +++ b/pypy/objspace/std/marshal_impl.py @@ -460,12 +460,12 @@ # any unknown object implementing the buffer protocol is # accepted and encoded as a plain string try: - s = space.bufferstr_w(w_obj) + s = space.readbuf_w(w_obj) except OperationError, e: if not e.match(space, space.w_TypeError): raise else: - m.atom_str(TYPE_STRING, s) + m.atom_str(TYPE_STRING, s.as_str()) return raise_exception(space, "unmarshallable object") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit