[pypy-commit] pypy py3k: s/buffer/memoryview
antocuni
noreply at buildbot.pypy.org
Thu Mar 22 11:03:22 CET 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r53883:ba50bd9d0176
Date: 2012-03-22 10:31 +0100
http://bitbucket.org/pypy/pypy/changeset/ba50bd9d0176/
Log: s/buffer/memoryview
diff --git a/pypy/module/struct/app_struct.py b/pypy/module/struct/app_struct.py
--- a/pypy/module/struct/app_struct.py
+++ b/pypy/module/struct/app_struct.py
@@ -11,12 +11,12 @@
# XXX inefficient
def pack_into(fmt, buf, offset, *args):
data = struct.pack(fmt, *args)
- buffer(buf)[offset:offset+len(data)] = data
+ memoryview(buf)[offset:offset+len(data)] = data
# XXX inefficient
def unpack_from(fmt, buf, offset=0):
size = _struct.calcsize(fmt)
- data = buffer(buf)[offset:offset+size]
+ data = memoryview(buf)[offset:offset+size]
if len(data) != size:
raise error("unpack_from requires a buffer of at least %d bytes"
% (size,))
More information about the pypy-commit
mailing list