Author: Armin Rigo <[email protected]>
Branch: py3.5
Changeset: r88807:4e784ab053d6
Date: 2016-12-01 22:36 +0100
http://bitbucket.org/pypy/pypy/changeset/4e784ab053d6/
Log: merge heads
diff --git a/pypy/module/_rawffi/array.py b/pypy/module/_rawffi/array.py
--- a/pypy/module/_rawffi/array.py
+++ b/pypy/module/_rawffi/array.py
@@ -185,7 +185,7 @@
def setslice(self, space, w_slice, w_value):
start, stop = self.decodeslice(space, w_slice)
- value = space.str_w(w_value)
+ value = space.bytes_w(w_value)
if start + len(value) != stop:
raise oefmt(space.w_ValueError, "cannot resize array")
ll_buffer = self.ll_buffer
diff --git a/pypy/module/array/interp_array.py
b/pypy/module/array/interp_array.py
--- a/pypy/module/array/interp_array.py
+++ b/pypy/module/array/interp_array.py
@@ -308,7 +308,7 @@
""" fromfile(f, n)
Read n objects from the file object f and append them to the end of the
- array. Also called as read.
+ array.
"""
try:
size = ovfcheck(self.itemsize * n)
@@ -323,7 +323,7 @@
item = item[0:elems]
self._frombytes(space, item)
raise oefmt(space.w_EOFError, "not enough items in file")
- self.descr_fromstring(space, w_item)
+ self._frombytes(space, item)
def descr_tofile(self, space, w_f):
""" tofile(f)
diff --git a/pypy/module/array/test/test_array.py
b/pypy/module/array/test/test_array.py
--- a/pypy/module/array/test/test_array.py
+++ b/pypy/module/array/test/test_array.py
@@ -227,6 +227,19 @@
raises(EOFError, a.fromfile, myfile(b'\x01', 2 + i), 2)
assert len(a) == 1 and a[0] == 257
+ def test_fromfile_no_warning(self):
+ import warnings
+ # check that fromfile defers to frombytes, not fromstring
+ class FakeF(object):
+ def read(self, n):
+ return b"a" * n
+ a = self.array('b')
+ with warnings.catch_warnings(record=True) as w:
+ # Cause all warnings to always be triggered.
+ warnings.simplefilter("always")
+ a.fromfile(FakeF(), 4)
+ assert len(w) == 0
+
def test_fromlist(self):
a = self.array('b')
raises(OverflowError, a.fromlist, [1, 2, 400])
diff --git a/pypy/module/imp/interp_imp.py b/pypy/module/imp/interp_imp.py
--- a/pypy/module/imp/interp_imp.py
+++ b/pypy/module/imp/interp_imp.py
@@ -9,7 +9,7 @@
def extension_suffixes(space):
suffixes_w = []
- if space.config.objspace.usemodules.cpyext:
+ if 1: #if space.config.objspace.usemodules.cpyext:
suffixes_w.append(space.wrap(importing.get_so_extension(space)))
return space.newlist(suffixes_w)
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit