[pypy-commit] cffi default: Issue #405

2019-03-11 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r3240:0ad3630d7fb3
Date: 2019-03-11 10:09 +0100
http://bitbucket.org/cffi/cffi/changeset/0ad3630d7fb3/

Log:Issue #405

Fix for nested struct types that end in a var-sized array

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -174,7 +174,7 @@
 #define CT_IS_BOOL 0x0008
 #define CT_IS_FILE 0x0010
 #define CT_IS_VOID_PTR 0x0020
-#define CT_WITH_VAR_ARRAY  0x0040
+#define CT_WITH_VAR_ARRAY  0x0040 /* with open-ended array, anywhere */
 /* unused  0x0080 */
 #define CT_LAZY_FIELD_LIST 0x0100
 #define CT_WITH_PACKED_CHANGE  0x0200
@@ -1331,6 +1331,29 @@
 }
 
 static int
+add_varsize_length(Py_ssize_t offset, Py_ssize_t itemsize,
+   Py_ssize_t varsizelength, Py_ssize_t *optvarsize)
+{
+/* update '*optvarsize' to account for an array of 'varsizelength'
+   elements, each of size 'itemsize', that starts at 'offset'. */
+Py_ssize_t size = ADD_WRAPAROUND(offset,
+  MUL_WRAPAROUND(itemsize, varsizelength));
+if (size < 0 ||
+((size - offset) / itemsize) != varsizelength) {
+PyErr_SetString(PyExc_OverflowError,
+"array size would overflow a Py_ssize_t");
+return -1;
+}
+if (size > *optvarsize)
+*optvarsize = size;
+return 0;
+}
+
+static int
+convert_struct_from_object(char *data, CTypeDescrObject *ct, PyObject *init,
+   Py_ssize_t *optvarsize);  /* forward */
+
+static int
 convert_vfield_from_object(char *data, CFieldObject *cf, PyObject *value,
Py_ssize_t *optvarsize)
 {
@@ -1343,20 +1366,11 @@
 if (optvarsize != NULL) {
 /* in this mode, the only purpose of this function is to compute
the real size of the structure from a var-sized C99 array */
-Py_ssize_t size, itemsize;
 assert(data == NULL);
-itemsize = cf->cf_type->ct_itemdescr->ct_size;
-size = ADD_WRAPAROUND(cf->cf_offset,
-  MUL_WRAPAROUND(itemsize, varsizelength));
-if (size < 0 ||
-((size - cf->cf_offset) / itemsize) != varsizelength) {
-PyErr_SetString(PyExc_OverflowError,
-"array size would overflow a Py_ssize_t");
-return -1;
-}
-if (size > *optvarsize)
-*optvarsize = size;
-return 0;
+return add_varsize_length(cf->cf_offset,
+cf->cf_type->ct_itemdescr->ct_size,
+varsizelength,
+optvarsize);
 }
 /* if 'value' was only an integer, get_new_array_length() returns
it and convert 'value' to be None.  Detect if this was the case,
@@ -1365,8 +1379,16 @@
 if (value == Py_None)
 return 0;
 }
-if (optvarsize == NULL)
+if (optvarsize == NULL) {
 return convert_field_from_object(data, cf, value);
+}
+else if ((cf->cf_type->ct_flags & CT_WITH_VAR_ARRAY) != 0 &&
+ !CData_Check(value)) {
+Py_ssize_t subsize = cf->cf_type->ct_size;
+if (convert_struct_from_object(NULL, cf->cf_type, value, &subsize) < 0)
+return -1;
+return add_varsize_length(cf->cf_offset, 1, subsize, optvarsize);
+}
 else
 return 0;
 }
@@ -4951,6 +4973,15 @@
 goto error;
 }
 }
+else if (ftype->ct_flags & CT_WITH_VAR_ARRAY) {
+/* GCC (or maybe C99) accepts var-sized struct fields that are not
+   the last field of a larger struct.  That's why there is no
+   check here for "last field": we propagate the flag
+   CT_WITH_VAR_ARRAY to any struct that contains either an open-
+   ended array or another struct that recursively contains an
+   open-ended array. */
+ct->ct_flags |= CT_WITH_VAR_ARRAY;
+}
 
 if (is_union)
 boffset = 0;   /* reset each field at offset 0 */
diff --git a/testing/cffi0/test_ffi_backend.py 
b/testing/cffi0/test_ffi_backend.py
--- a/testing/cffi0/test_ffi_backend.py
+++ b/testing/cffi0/test_ffi_backend.py
@@ -129,6 +129,36 @@
 alloc5 = ffi.new_allocator(myalloc5)
 py.test.raises(MemoryError, alloc5, "int[5]")
 
+def test_new_struct_containing_struct_containing_array_varsize(self):
+ffi = FFI(backend=self.Backend())
+ffi.cdef("""
+struct foo_s { int len[100]; short data[]; };
+struct bar_s { int abc[100]; struct foo_s tail; };
+""")
+# loop to try to detect heap overwrites, if the size allocated
+# is too small
+for i in range(1, 501, 100):
+p = ffi.new("struct bar_s *", [[10], [[20], [3,4,5,6,7,8,9

[pypy-commit] cffi default: Add an extra test directly here, for pypy

2019-03-11 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r3241:042594ebfddc
Date: 2019-03-11 10:19 +0100
http://bitbucket.org/cffi/cffi/changeset/042594ebfddc/

Log:Add an extra test directly here, for pypy

diff --git a/c/test_c.py b/c/test_c.py
--- a/c/test_c.py
+++ b/c/test_c.py
@@ -3452,6 +3452,15 @@
 assert p.a[1] == 20
 assert p.a[2] == 30
 assert p.a[3] == 0
+#
+# struct of struct of varsized array
+BStruct2 = new_struct_type("bar")
+complete_struct_or_union(BStruct2, [('head', BInt),
+('tail', BStruct)])
+for i in range(2):   # try to detect heap overwrites
+p = newp(new_pointer_type(BStruct2), [100, [200, list(range(50))]])
+assert p.tail.y[49] == 49
+
 
 def test_struct_array_no_length_explicit_position():
 BInt = new_primitive_type("int")
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] cffi default: Fix (corner case, hard to test)

2019-03-11 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r3242:ff25b4e68195
Date: 2019-03-11 10:27 +0100
http://bitbucket.org/cffi/cffi/changeset/ff25b4e68195/

Log:Fix (corner case, hard to test)

diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c
--- a/c/_cffi_backend.c
+++ b/c/_cffi_backend.c
@@ -4973,14 +4973,18 @@
 goto error;
 }
 }
-else if (ftype->ct_flags & CT_WITH_VAR_ARRAY) {
+else if (ftype->ct_flags & (CT_STRUCT|CT_UNION)) {
+if (force_lazy_struct(ftype) < 0)   /* for CT_WITH_VAR_ARRAY */
+return NULL;
+
 /* GCC (or maybe C99) accepts var-sized struct fields that are not
the last field of a larger struct.  That's why there is no
check here for "last field": we propagate the flag
CT_WITH_VAR_ARRAY to any struct that contains either an open-
ended array or another struct that recursively contains an
open-ended array. */
-ct->ct_flags |= CT_WITH_VAR_ARRAY;
+if (ftype->ct_flags & CT_WITH_VAR_ARRAY)
+ct->ct_flags |= CT_WITH_VAR_ARRAY;
 }
 
 if (is_union)
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: update to cffi/ff25b4e68195

2019-03-11 Thread arigo
Author: Armin Rigo 
Branch: 
Changeset: r96269:fd0c6116edcd
Date: 2019-03-11 10:46 +0100
http://bitbucket.org/pypy/pypy/changeset/fd0c6116edcd/

Log:update to cffi/ff25b4e68195

diff --git a/pypy/module/_cffi_backend/ctypestruct.py 
b/pypy/module/_cffi_backend/ctypestruct.py
--- a/pypy/module/_cffi_backend/ctypestruct.py
+++ b/pypy/module/_cffi_backend/ctypestruct.py
@@ -238,26 +238,32 @@
 else:
 self.ctype.convert_from_object(cdata, w_ob)
 
+def add_varsize_length(self, space, itemsize, varsizelength, optvarsize):
+# returns an updated 'optvarsize' to account for an array of
+# 'varsizelength' elements, each of size 'itemsize', that starts
+# at 'self.offset'.
+try:
+varsize = ovfcheck(itemsize * varsizelength)
+size = ovfcheck(self.offset + varsize)
+except OverflowError:
+raise oefmt(space.w_OverflowError,
+"array size would overflow a ssize_t")
+assert size >= 0
+return max(size, optvarsize)
+
 def write_v(self, cdata, w_ob, optvarsize):
 # a special case for var-sized C99 arrays
 from pypy.module._cffi_backend import ctypearray
 ct = self.ctype
+space = ct.space
 if isinstance(ct, ctypearray.W_CTypeArray) and ct.length < 0:
-space = ct.space
 w_ob, varsizelength = ct.get_new_array_length(w_ob)
 if optvarsize != -1:
 # in this mode, the only purpose of this function is to compute
 # the real size of the structure from a var-sized C99 array
 assert cdata == lltype.nullptr(rffi.CCHARP.TO)
-itemsize = ct.ctitem.size
-try:
-varsize = ovfcheck(itemsize * varsizelength)
-size = ovfcheck(self.offset + varsize)
-except OverflowError:
-raise oefmt(space.w_OverflowError,
-"array size would overflow a ssize_t")
-assert size >= 0
-return max(size, optvarsize)
+return self.add_varsize_length(space, ct.ctitem.size,
+varsizelength, optvarsize)
 # if 'value' was only an integer, get_new_array_length() returns
 # w_ob = space.w_None.  Detect if this was the case,
 # and if so, stop here, leaving the content uninitialized
@@ -267,6 +273,12 @@
 #
 if optvarsize == -1:
 self.write(cdata, w_ob)
+elif (isinstance(ct, W_CTypeStructOrUnion) and ct._with_var_array and
+  not isinstance(w_ob, cdataobj.W_CData)):
+subsize = ct.size
+subsize = ct.convert_struct_from_object(
+lltype.nullptr(rffi.CCHARP.TO), w_ob, subsize)
+optvarsize = self.add_varsize_length(space, 1, subsize, optvarsize)
 return optvarsize
 
 def convert_bitfield_to_object(self, cdata):
diff --git a/pypy/module/_cffi_backend/newtype.py 
b/pypy/module/_cffi_backend/newtype.py
--- a/pypy/module/_cffi_backend/newtype.py
+++ b/pypy/module/_cffi_backend/newtype.py
@@ -368,6 +368,16 @@
 raise oefmt(space.w_TypeError,
 "field '%s.%s' has ctype '%s' of unknown size",
 w_ctype.name, fname, ftype.name)
+elif isinstance(ftype, ctypestruct.W_CTypeStructOrUnion):
+ftype.force_lazy_struct()
+# GCC (or maybe C99) accepts var-sized struct fields that are not
+# the last field of a larger struct.  That's why there is no
+# check here for "last field": we propagate the flag
+# '_with_var_array' to any struct that contains either an open-
+# ended array or another struct that recursively contains an
+# open-ended array.
+if ftype._with_var_array:
+with_var_array = True
 #
 if is_union:
 boffset = 0 # reset each field at offset 0
@@ -419,7 +429,6 @@
 # a nested anonymous struct or union
 # note: it seems we only get here with ffi.verify()
 srcfield2names = {}
-ftype.force_lazy_struct()
 for name, srcfld in ftype._fields_dict.items():
 srcfield2names[srcfld] = name
 for srcfld in ftype._fields_list:
diff --git a/pypy/module/_cffi_backend/test/_backend_test_c.py 
b/pypy/module/_cffi_backend/test/_backend_test_c.py
--- a/pypy/module/_cffi_backend/test/_backend_test_c.py
+++ b/pypy/module/_cffi_backend/test/_backend_test_c.py
@@ -3441,6 +3441,15 @@
 assert p.a[1] == 20
 assert p.a[2] == 30
 assert p.a[3] == 0
+#
+# struct of struct of varsized array
+BStruct2 = new_struct_type("bar")
+complete_struct_or_union(BStruct2, [('head', BInt),
+('tail', BStruct)])
+for 

[pypy-commit] pypy default: fix test

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r96270:c035c7de5e39
Date: 2019-03-11 09:12 +0200
http://bitbucket.org/pypy/pypy/changeset/c035c7de5e39/

Log:fix test

diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py
--- a/lib_pypy/_ctypes/array.py
+++ b/lib_pypy/_ctypes/array.py
@@ -257,7 +257,7 @@
 try:
 itemsize = struct.calcsize(fmt[1:])
 except:
-itemsize = len(buffer(obj[0]))
+itemsize = sizeof(obj[0])
 return __pypy__.newmemoryview(memoryview(self._buffer), itemsize, fmt, 
shape)
 
 ARRAY_CACHE = {}
diff --git a/pypy/module/__pypy__/test/test_newmemoryview.py 
b/pypy/module/__pypy__/test/test_newmemoryview.py
--- a/pypy/module/__pypy__/test/test_newmemoryview.py
+++ b/pypy/module/__pypy__/test/test_newmemoryview.py
@@ -19,7 +19,7 @@
 from __pypy__ import bufferable, newmemoryview
 class B(bufferable.bufferable):
 def __init__(self):
-self.data = bytearray('abc')
+self.data = bytearray(b'abc')
 
 def __buffer__(self, flags):
 return newmemoryview(memoryview(self.data), 1, 'B')
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.6: merge default into py3.6

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: py3.6
Changeset: r96276:d642a3c217cb
Date: 2019-03-11 13:58 +0200
http://bitbucket.org/pypy/pypy/changeset/d642a3c217cb/

Log:merge default into py3.6

diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py
--- a/lib_pypy/_ctypes/array.py
+++ b/lib_pypy/_ctypes/array.py
@@ -263,7 +263,7 @@
 try:
 itemsize = struct.calcsize(fmt[1:])
 except:
-itemsize = len(buffer(obj[0]))
+itemsize = sizeof(obj[0])
 return __pypy__.newmemoryview(memoryview(self._buffer), itemsize, fmt, 
shape)
 
 ARRAY_CACHE = {}
diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -71,9 +71,9 @@
 #module/cpyext/include/patchlevel.h
 #
 # The short X.Y version.
-version = '7.1'
+version = '7.2'
 # The full version, including alpha/beta/rc tags.
-release = '7.1.0'
+release = '7.2.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/pypy/doc/index-of-release-notes.rst 
b/pypy/doc/index-of-release-notes.rst
--- a/pypy/doc/index-of-release-notes.rst
+++ b/pypy/doc/index-of-release-notes.rst
@@ -1,11 +1,12 @@
 Historical release notes
 
 
-CPython 2.7 compatible versions

+Combined releases
+-
 
 .. toctree::
 
+   release-v7.1.0.rst
release-v7.0.0.rst
release-v6.0.0.rst
release-v5.10.1.rst
@@ -14,6 +15,12 @@
release-v5.8.0.rst
release-v5.7.1.rst
release-v5.7.0.rst
+
+CPython 2.7 compatible versions
+---
+
+.. toctree::
+
release-pypy2.7-v5.6.0.rst
release-pypy2.7-v5.4.1.rst
release-pypy2.7-v5.4.0.rst
@@ -61,15 +68,6 @@
release-0.7.0.rst
release-0.6
 
-CPython 3.5 compatible versions

-
-.. toctree::
-
-   release-v5.8.0.rst
-   release-v5.7.1.rst
-   release-v5.7.0.rst
-
 CPython 3.3 compatible versions
 ---
 
diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-v7.1.0.rst
@@ -0,0 +1,77 @@
+=
+PyPy v7.1.0: release of 2.7, and 3.6-beta
+=
+
+The PyPy team is proud to release the version 7.1.0 of PyPy, which includes
+two different interpreters:
+
+  - PyPy2.7, which is an interpreter supporting the syntax and the features of
+Python 2.7
+
+  - PyPy3.6-beta: this is the second official release of PyPy to support 3.6
+features, although it is still considered beta quality.
+
+The interpreters are based on much the same codebase, thus the double
+release.
+
+Until we can work with downstream providers to distribute builds with PyPy, we
+have made packages for some common packages `available as wheels`_.
+
+As always, this release is 100% compatible with the previous one and fixed
+several issues and bugs raised by the growing community of PyPy users.
+We strongly recommend updating.
+
+The PyPy3.6 release is still not production quality so your mileage may vary.
+There are open issues with incomplete compatibility and c-extension support.
+
+You can download the v7.0 releases here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project. If PyPy is not quite good enough for your needs, we are available for
+direct consulting work.
+
+We would also like to thank our contributors and encourage new people to join
+the project. PyPy has many layers and we need help with all of them: `PyPy`_
+and `RPython`_ documentation improvements, tweaking popular modules to run
+on pypy, or general `help`_ with making RPython's JIT even better.
+
+.. _`PyPy`: index.html
+.. _`RPython`: https://rpython.readthedocs.org
+.. _`help`: project-ideas.html
+.. _`cffi`: http://cffi.readthedocs.io
+.. _`cppyy`: https://cppyy.readthedocs.io
+.. _`available as wheels`: https://github.com/antocuni/pypy-wheels
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7, 3.6. It's fast (`PyPy and CPython 2.7.x`_ performance
+comparison) due to its integrated tracing JIT compiler.
+
+We also welcome developers of other `dynamic languages`_ to see what RPython
+can do for them.
+
+The PyPy release supports:
+
+  * **x86** machines on most common operating systems
+(Linux 32/64 bits, Mac OS X 64 bits, Windows 32 bits, OpenBSD, FreeBSD)
+
+  * big- and little-endian variants of **PPC64** running Linux,
+
+  * **s390x** running Linux
+
+Unfortunately at the moment of writing our ARM buildbots are out of service,
+so for now we are **not** releasing any binary for the ARM architecture.
+
+.. _`PyPy and CPython 2.7.x`: http://speed.pypy.org
+.. _`dynamic languages`: http://rpython.readthedocs.io/en/latest/examples.html
+
+
+Changelog
+=
+
+If not speci

[pypy-commit] pypy default: restart whatsnew-head

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r96274:cf8eb4195235
Date: 2019-03-11 13:24 +0200
http://bitbucket.org/pypy/pypy/changeset/cf8eb4195235/

Log:restart whatsnew-head

diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/whatsnew-head.rst
@@ -0,0 +1,7 @@
+==
+What's new in PyPy2.7 7.1+
+==
+
+.. this is a revision shortly after release-pypy-7.1.0
+.. startrev: 78914a03cf95
+
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: update version, move whatsnew-head

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r96273:78914a03cf95
Date: 2019-03-11 13:23 +0200
http://bitbucket.org/pypy/pypy/changeset/78914a03cf95/

Log:update version, move whatsnew-head

diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -71,9 +71,9 @@
 #module/cpyext/include/patchlevel.h
 #
 # The short X.Y version.
-version = '7.1'
+version = '7.2'
 # The full version, including alpha/beta/rc tags.
-release = '7.1.0'
+release = '7.2.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-pypy2-7.1.0.rst
rename from pypy/doc/whatsnew-head.rst
rename to pypy/doc/whatsnew-pypy2-7.1.0.rst
diff --git a/pypy/module/cpyext/include/patchlevel.h 
b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -32,8 +32,8 @@
  * module/sys/version.py
  * doc/conf.py
  */
-#define PYPY_VERSION "7.1.0-alpha0"
-#define PYPY_VERSION_NUM  0x0701
+#define PYPY_VERSION "7.2.0-alpha0"
+#define PYPY_VERSION_NUM  0x0702
 /* Defined to mean a PyPy where cpyext holds more regular references
to PyObjects, e.g. staying alive as long as the internal PyPy object
stays alive. */
diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -13,7 +13,7 @@
 # make sure to keep PYPY_VERSION in sync with:
 #module/cpyext/include/patchlevel.h
 #doc/conf.py
-PYPY_VERSION   = (7, 1, 0, "alpha", 0)
+PYPY_VERSION   = (7, 2, 0, "alpha", 0)
 
 
 import pypy
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-pypy3.6-v7.x: start release branch

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: release-pypy3.6-v7.x
Changeset: r96272:a6406bc3dda2
Date: 2019-03-11 13:18 +0200
http://bitbucket.org/pypy/pypy/changeset/a6406bc3dda2/

Log:start release branch

diff --git a/pypy/module/cpyext/include/patchlevel.h 
b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -32,7 +32,7 @@
  * module/sys/version.py
  * doc/conf.py
  */
-#define PYPY_VERSION "7.1.0-alpha0"
+#define PYPY_VERSION "7.1.0"
 #define PYPY_VERSION_NUM  0x0701
 /* Defined to mean a PyPy where cpyext holds more regular references
to PyObjects, e.g. staying alive as long as the internal PyPy object
diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -13,7 +13,7 @@
 # make sure to keep PYPY_VERSION in sync with:
 #module/cpyext/include/patchlevel.h
 #doc/conf.py
-PYPY_VERSION   = (7, 1, 0, "alpha", 0)
+PYPY_VERSION   = (7, 1, 0, "final", 0)
 
 
 import pypy
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-pypy2.7-v7.x: start release branch

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: release-pypy2.7-v7.x
Changeset: r96271:4d17db2673b9
Date: 2019-03-11 13:18 +0200
http://bitbucket.org/pypy/pypy/changeset/4d17db2673b9/

Log:start release branch

diff --git a/pypy/module/cpyext/include/patchlevel.h 
b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -32,7 +32,7 @@
  * module/sys/version.py
  * doc/conf.py
  */
-#define PYPY_VERSION "7.1.0-alpha0"
+#define PYPY_VERSION "7.1.0"
 #define PYPY_VERSION_NUM  0x0701
 /* Defined to mean a PyPy where cpyext holds more regular references
to PyObjects, e.g. staying alive as long as the internal PyPy object
diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -13,7 +13,7 @@
 # make sure to keep PYPY_VERSION in sync with:
 #module/cpyext/include/patchlevel.h
 #doc/conf.py
-PYPY_VERSION   = (7, 1, 0, "alpha", 0)
+PYPY_VERSION   = (7, 1, 0, "final", 0)
 
 
 import pypy
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.6: move whatsnew

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: py3.6
Changeset: r96277:92e8cf22beda
Date: 2019-03-11 14:01 +0200
http://bitbucket.org/pypy/pypy/changeset/92e8cf22beda/

Log:move whatsnew

diff --git a/pypy/doc/whatsnew-pypy3-head.rst 
b/pypy/doc/whatsnew-pypy3-7.1.0.rst
rename from pypy/doc/whatsnew-pypy3-head.rst
rename to pypy/doc/whatsnew-pypy3-7.1.0.rst
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: extend release note

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r96281:20d6b720c743
Date: 2019-03-11 14:12 +0200
http://bitbucket.org/pypy/pypy/changeset/20d6b720c743/

Log:extend release note

diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
--- a/pypy/doc/release-v7.1.0.rst
+++ b/pypy/doc/release-v7.1.0.rst
@@ -14,6 +14,13 @@
 The interpreters are based on much the same codebase, thus the double
 release.
 
+This release, coming fast on the heels of 7.0 in February, finally merges the
+internal refactoring of unicode representation as UTF-8. Removing the
+conversions from strings to unicode internally lead to a nice speed bump.
+
+We also improved the ability to use the buffer protocol with ctype structures
+and arrays.
+
 Until we can work with downstream providers to distribute builds with PyPy, we
 have made packages for some common packages `available as wheels`_.
 
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy py3.6: restart whatsnew

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: py3.6
Changeset: r96278:aafbac9cc1f8
Date: 2019-03-11 14:02 +0200
http://bitbucket.org/pypy/pypy/changeset/aafbac9cc1f8/

Log:restart whatsnew

diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/whatsnew-pypy3-head.rst
@@ -0,0 +1,6 @@
+
+What's new in PyPy3 7.1+
+
+
+.. this is the revision after release-pypy3.6-v7.1
+.. startrev: d642a3c217cb
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy default: start release note

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: 
Changeset: r96275:ea739add7f2a
Date: 2019-03-11 13:31 +0200
http://bitbucket.org/pypy/pypy/changeset/ea739add7f2a/

Log:start release note

diff --git a/pypy/doc/index-of-release-notes.rst 
b/pypy/doc/index-of-release-notes.rst
--- a/pypy/doc/index-of-release-notes.rst
+++ b/pypy/doc/index-of-release-notes.rst
@@ -1,11 +1,12 @@
 Historical release notes
 
 
-CPython 2.7 compatible versions

+Combined releases
+-
 
 .. toctree::
 
+   release-v7.1.0.rst
release-v7.0.0.rst
release-v6.0.0.rst
release-v5.10.1.rst
@@ -14,6 +15,12 @@
release-v5.8.0.rst
release-v5.7.1.rst
release-v5.7.0.rst
+
+CPython 2.7 compatible versions
+---
+
+.. toctree::
+
release-pypy2.7-v5.6.0.rst
release-pypy2.7-v5.4.1.rst
release-pypy2.7-v5.4.0.rst
@@ -61,15 +68,6 @@
release-0.7.0.rst
release-0.6
 
-CPython 3.5 compatible versions

-
-.. toctree::
-
-   release-v5.8.0.rst
-   release-v5.7.1.rst
-   release-v5.7.0.rst
-
 CPython 3.3 compatible versions
 ---
 
diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-v7.1.0.rst
@@ -0,0 +1,77 @@
+=
+PyPy v7.1.0: release of 2.7, and 3.6-beta
+=
+
+The PyPy team is proud to release the version 7.1.0 of PyPy, which includes
+two different interpreters:
+
+  - PyPy2.7, which is an interpreter supporting the syntax and the features of
+Python 2.7
+
+  - PyPy3.6-beta: this is the second official release of PyPy to support 3.6
+features, although it is still considered beta quality.
+
+The interpreters are based on much the same codebase, thus the double
+release.
+
+Until we can work with downstream providers to distribute builds with PyPy, we
+have made packages for some common packages `available as wheels`_.
+
+As always, this release is 100% compatible with the previous one and fixed
+several issues and bugs raised by the growing community of PyPy users.
+We strongly recommend updating.
+
+The PyPy3.6 release is still not production quality so your mileage may vary.
+There are open issues with incomplete compatibility and c-extension support.
+
+You can download the v7.0 releases here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project. If PyPy is not quite good enough for your needs, we are available for
+direct consulting work.
+
+We would also like to thank our contributors and encourage new people to join
+the project. PyPy has many layers and we need help with all of them: `PyPy`_
+and `RPython`_ documentation improvements, tweaking popular modules to run
+on pypy, or general `help`_ with making RPython's JIT even better.
+
+.. _`PyPy`: index.html
+.. _`RPython`: https://rpython.readthedocs.org
+.. _`help`: project-ideas.html
+.. _`cffi`: http://cffi.readthedocs.io
+.. _`cppyy`: https://cppyy.readthedocs.io
+.. _`available as wheels`: https://github.com/antocuni/pypy-wheels
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7, 3.6. It's fast (`PyPy and CPython 2.7.x`_ performance
+comparison) due to its integrated tracing JIT compiler.
+
+We also welcome developers of other `dynamic languages`_ to see what RPython
+can do for them.
+
+The PyPy release supports:
+
+  * **x86** machines on most common operating systems
+(Linux 32/64 bits, Mac OS X 64 bits, Windows 32 bits, OpenBSD, FreeBSD)
+
+  * big- and little-endian variants of **PPC64** running Linux,
+
+  * **s390x** running Linux
+
+Unfortunately at the moment of writing our ARM buildbots are out of service,
+so for now we are **not** releasing any binary for the ARM architecture.
+
+.. _`PyPy and CPython 2.7.x`: http://speed.pypy.org
+.. _`dynamic languages`: http://rpython.readthedocs.io/en/latest/examples.html
+
+
+Changelog
+=
+
+If not specified, the changes are shared across versions
+
___
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit


[pypy-commit] pypy release-pypy2.7-v7.x: merge default into release (perserve versioning)

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: release-pypy2.7-v7.x
Changeset: r96280:3a2619127f7e
Date: 2019-03-11 14:03 +0200
http://bitbucket.org/pypy/pypy/changeset/3a2619127f7e/

Log:merge default into release (perserve versioning)

diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -71,9 +71,9 @@
 #module/cpyext/include/patchlevel.h
 #
 # The short X.Y version.
-version = '7.1'
+version = '7.2'
 # The full version, including alpha/beta/rc tags.
-release = '7.1.0'
+release = '7.2.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/pypy/doc/index-of-release-notes.rst 
b/pypy/doc/index-of-release-notes.rst
--- a/pypy/doc/index-of-release-notes.rst
+++ b/pypy/doc/index-of-release-notes.rst
@@ -1,11 +1,12 @@
 Historical release notes
 
 
-CPython 2.7 compatible versions

+Combined releases
+-
 
 .. toctree::
 
+   release-v7.1.0.rst
release-v7.0.0.rst
release-v6.0.0.rst
release-v5.10.1.rst
@@ -14,6 +15,12 @@
release-v5.8.0.rst
release-v5.7.1.rst
release-v5.7.0.rst
+
+CPython 2.7 compatible versions
+---
+
+.. toctree::
+
release-pypy2.7-v5.6.0.rst
release-pypy2.7-v5.4.1.rst
release-pypy2.7-v5.4.0.rst
@@ -61,15 +68,6 @@
release-0.7.0.rst
release-0.6
 
-CPython 3.5 compatible versions

-
-.. toctree::
-
-   release-v5.8.0.rst
-   release-v5.7.1.rst
-   release-v5.7.0.rst
-
 CPython 3.3 compatible versions
 ---
 
diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-v7.1.0.rst
@@ -0,0 +1,77 @@
+=
+PyPy v7.1.0: release of 2.7, and 3.6-beta
+=
+
+The PyPy team is proud to release the version 7.1.0 of PyPy, which includes
+two different interpreters:
+
+  - PyPy2.7, which is an interpreter supporting the syntax and the features of
+Python 2.7
+
+  - PyPy3.6-beta: this is the second official release of PyPy to support 3.6
+features, although it is still considered beta quality.
+
+The interpreters are based on much the same codebase, thus the double
+release.
+
+Until we can work with downstream providers to distribute builds with PyPy, we
+have made packages for some common packages `available as wheels`_.
+
+As always, this release is 100% compatible with the previous one and fixed
+several issues and bugs raised by the growing community of PyPy users.
+We strongly recommend updating.
+
+The PyPy3.6 release is still not production quality so your mileage may vary.
+There are open issues with incomplete compatibility and c-extension support.
+
+You can download the v7.0 releases here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project. If PyPy is not quite good enough for your needs, we are available for
+direct consulting work.
+
+We would also like to thank our contributors and encourage new people to join
+the project. PyPy has many layers and we need help with all of them: `PyPy`_
+and `RPython`_ documentation improvements, tweaking popular modules to run
+on pypy, or general `help`_ with making RPython's JIT even better.
+
+.. _`PyPy`: index.html
+.. _`RPython`: https://rpython.readthedocs.org
+.. _`help`: project-ideas.html
+.. _`cffi`: http://cffi.readthedocs.io
+.. _`cppyy`: https://cppyy.readthedocs.io
+.. _`available as wheels`: https://github.com/antocuni/pypy-wheels
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7, 3.6. It's fast (`PyPy and CPython 2.7.x`_ performance
+comparison) due to its integrated tracing JIT compiler.
+
+We also welcome developers of other `dynamic languages`_ to see what RPython
+can do for them.
+
+The PyPy release supports:
+
+  * **x86** machines on most common operating systems
+(Linux 32/64 bits, Mac OS X 64 bits, Windows 32 bits, OpenBSD, FreeBSD)
+
+  * big- and little-endian variants of **PPC64** running Linux,
+
+  * **s390x** running Linux
+
+Unfortunately at the moment of writing our ARM buildbots are out of service,
+so for now we are **not** releasing any binary for the ARM architecture.
+
+.. _`PyPy and CPython 2.7.x`: http://speed.pypy.org
+.. _`dynamic languages`: http://rpython.readthedocs.io/en/latest/examples.html
+
+
+Changelog
+=
+
+If not specified, the changes are shared across versions
+
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-head.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -1,45 +1,7 @@
 ==
-What's new in PyPy2.7 7.0+
+What's new in PyPy2.7 7.1+
 ==
 
-.. this is a revision shortly after release-pypy-7.0.0
-.. startrev: 

[pypy-commit] pypy release-pypy3.6-v7.x: merge py3.6 into release (preserve versioning)

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: release-pypy3.6-v7.x
Changeset: r96279:a05759e2b374
Date: 2019-03-11 14:02 +0200
http://bitbucket.org/pypy/pypy/changeset/a05759e2b374/

Log:merge py3.6 into release (preserve versioning)

diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py
--- a/lib_pypy/_ctypes/array.py
+++ b/lib_pypy/_ctypes/array.py
@@ -263,7 +263,7 @@
 try:
 itemsize = struct.calcsize(fmt[1:])
 except:
-itemsize = len(buffer(obj[0]))
+itemsize = sizeof(obj[0])
 return __pypy__.newmemoryview(memoryview(self._buffer), itemsize, fmt, 
shape)
 
 ARRAY_CACHE = {}
diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -71,9 +71,9 @@
 #module/cpyext/include/patchlevel.h
 #
 # The short X.Y version.
-version = '7.1'
+version = '7.2'
 # The full version, including alpha/beta/rc tags.
-release = '7.1.0'
+release = '7.2.0'
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/pypy/doc/index-of-release-notes.rst 
b/pypy/doc/index-of-release-notes.rst
--- a/pypy/doc/index-of-release-notes.rst
+++ b/pypy/doc/index-of-release-notes.rst
@@ -1,11 +1,12 @@
 Historical release notes
 
 
-CPython 2.7 compatible versions

+Combined releases
+-
 
 .. toctree::
 
+   release-v7.1.0.rst
release-v7.0.0.rst
release-v6.0.0.rst
release-v5.10.1.rst
@@ -14,6 +15,12 @@
release-v5.8.0.rst
release-v5.7.1.rst
release-v5.7.0.rst
+
+CPython 2.7 compatible versions
+---
+
+.. toctree::
+
release-pypy2.7-v5.6.0.rst
release-pypy2.7-v5.4.1.rst
release-pypy2.7-v5.4.0.rst
@@ -61,15 +68,6 @@
release-0.7.0.rst
release-0.6
 
-CPython 3.5 compatible versions

-
-.. toctree::
-
-   release-v5.8.0.rst
-   release-v5.7.1.rst
-   release-v5.7.0.rst
-
 CPython 3.3 compatible versions
 ---
 
diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-v7.1.0.rst
@@ -0,0 +1,77 @@
+=
+PyPy v7.1.0: release of 2.7, and 3.6-beta
+=
+
+The PyPy team is proud to release the version 7.1.0 of PyPy, which includes
+two different interpreters:
+
+  - PyPy2.7, which is an interpreter supporting the syntax and the features of
+Python 2.7
+
+  - PyPy3.6-beta: this is the second official release of PyPy to support 3.6
+features, although it is still considered beta quality.
+
+The interpreters are based on much the same codebase, thus the double
+release.
+
+Until we can work with downstream providers to distribute builds with PyPy, we
+have made packages for some common packages `available as wheels`_.
+
+As always, this release is 100% compatible with the previous one and fixed
+several issues and bugs raised by the growing community of PyPy users.
+We strongly recommend updating.
+
+The PyPy3.6 release is still not production quality so your mileage may vary.
+There are open issues with incomplete compatibility and c-extension support.
+
+You can download the v7.0 releases here:
+
+http://pypy.org/download.html
+
+We would like to thank our donors for the continued support of the PyPy
+project. If PyPy is not quite good enough for your needs, we are available for
+direct consulting work.
+
+We would also like to thank our contributors and encourage new people to join
+the project. PyPy has many layers and we need help with all of them: `PyPy`_
+and `RPython`_ documentation improvements, tweaking popular modules to run
+on pypy, or general `help`_ with making RPython's JIT even better.
+
+.. _`PyPy`: index.html
+.. _`RPython`: https://rpython.readthedocs.org
+.. _`help`: project-ideas.html
+.. _`cffi`: http://cffi.readthedocs.io
+.. _`cppyy`: https://cppyy.readthedocs.io
+.. _`available as wheels`: https://github.com/antocuni/pypy-wheels
+
+What is PyPy?
+=
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7, 3.6. It's fast (`PyPy and CPython 2.7.x`_ performance
+comparison) due to its integrated tracing JIT compiler.
+
+We also welcome developers of other `dynamic languages`_ to see what RPython
+can do for them.
+
+The PyPy release supports:
+
+  * **x86** machines on most common operating systems
+(Linux 32/64 bits, Mac OS X 64 bits, Windows 32 bits, OpenBSD, FreeBSD)
+
+  * big- and little-endian variants of **PPC64** running Linux,
+
+  * **s390x** running Linux
+
+Unfortunately at the moment of writing our ARM buildbots are out of service,
+so for now we are **not** releasing any binary for the ARM architecture.
+
+.. _`PyPy and CPython 2.7.x`: http://speed.pypy.org
+.. _`dynamic languages`: http://rpython.readthedocs.io/en/latest/examples.html
+
+

[pypy-commit] pypy release-pypy3.6-v7.x: merge py3.6 into release

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: release-pypy3.6-v7.x
Changeset: r96285:5e9a4737b5a7
Date: 2019-03-11 19:41 +0200
http://bitbucket.org/pypy/pypy/changeset/5e9a4737b5a7/

Log:merge py3.6 into release

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -123,7 +123,9 @@
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
+  Stefan Beyer
   Jeremy Thurgood
+  Andrew Lawrence
   Greg Price
   Ivan Sichmann Freitas
   Dario Bertini
@@ -134,7 +136,6 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
-  Stefan Beyer
   William Leslie
   Paweł Piotr Przeradowski
   marky1991
@@ -152,6 +153,7 @@
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
+  Julian Berman
   Oscar Nierstrasz
   Rami Chowdhury
   Stefan H. Muller
@@ -174,6 +176,7 @@
   Anton Gulenko
   Sergey Matyunin
   Andrew Chambers
+  Łukasz Langa
   Nicolas Chauvat
   Andrew Durdin
   Ben Young
@@ -296,7 +299,6 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
-  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
@@ -328,7 +330,6 @@
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
-  Julian Berman
   Stephan Busemann
   Dan Colish
   timo
diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
--- a/pypy/doc/contributor.rst
+++ b/pypy/doc/contributor.rst
@@ -90,7 +90,9 @@
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
+  Stefan Beyer
   Jeremy Thurgood
+  Andrew Lawrence
   Greg Price
   Ivan Sichmann Freitas
   Dario Bertini
@@ -101,7 +103,6 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
-  Stefan Beyer
   William Leslie
   Paweł Piotr Przeradowski
   marky1991
@@ -119,6 +120,7 @@
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
+  Julian Berman
   Oscar Nierstrasz
   Rami Chowdhury
   Stefan H. Muller
@@ -141,6 +143,7 @@
   Anton Gulenko
   Sergey Matyunin
   Andrew Chambers
+  Łukasz Langa
   Nicolas Chauvat
   Andrew Durdin
   Ben Young
@@ -263,7 +266,6 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
-  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
@@ -295,7 +297,6 @@
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
-  Julian Berman
   Stephan Busemann
   Dan Colish
   timo
diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
--- a/pypy/doc/release-v7.1.0.rst
+++ b/pypy/doc/release-v7.1.0.rst
@@ -14,6 +14,13 @@
 The interpreters are based on much the same codebase, thus the double
 release.
 
+This release, coming fast on the heels of 7.0 in February, finally merges the
+internal refactoring of unicode representation as UTF-8. Removing the
+conversions from strings to unicode internally lead to a nice speed bump.
+
+We also improved the ability to use the buffer protocol with ctype structures
+and arrays.
+
 Until we can work with downstream providers to distribute builds with PyPy, we
 have made packages for some common packages `available as wheels`_.
 
diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
--- a/pypy/doc/tool/makecontributor.py
+++ b/pypy/doc/tool/makecontributor.py
@@ -1,4 +1,5 @@
 # NOTE: run this script with LANG=en_US.UTF-8
+# works with pip install mercurial==3.0
 
 import py
 import sys
@@ -89,6 +90,7 @@
 'Laurence Tratt': ['ltratt'],
 'Pieter Zieschang': ['pzieschang', 'p_ziesch...@yahoo.de'],
 'John Witulski': ['witulski'],
+'Andrew Lawrence': ['andrew.lawre...@siemens.com', 'andrewjlawrence'],
 }
 
 alias_map = {}
diff --git a/pypy/interpreter/unicodehelper.py 
b/pypy/interpreter/unicodehelper.py
--- a/pypy/interpreter/unicodehelper.py
+++ b/pypy/interpreter/unicodehelper.py
@@ -362,6 +362,8 @@
 valid so we're trying to either raise or pack stuff with error handler.
 The key difference is that this is call_may_force
 """
+if errors is None:
+errors = 'strict'
 slen = len(s)
 res = StringBuilder(slen)
 pos = 0
diff --git a/pypy/module/_codecs/interp_codecs.py 
b/pypy/module/_codecs/interp_codecs.py
--- a/pypy/module/_codecs/interp_codecs.py
+++ b/pypy/module/_codecs/interp_codecs.py
@@ -526,7 +526,10 @@
 
 def _call_codec(space, w_coder, w_obj, action, encoding, errors):
 try:
-w_res = space.call_function(w_coder, w_obj, space.newtext(errors))
+if errors:
+w_res = space.call_function(w_coder, w_obj, space.newtext(errors))
+else:
+w_res = space.call_function(w_coder, w_obj)
 except OperationError as operr:
 raise _wrap_codec_error(space, operr, action, encoding)
 if (not space.isinstance_w(w_res, space.w_tuple) or space.len_w(w_res) != 
2):
@@ -634,15 +637,11 @@
 return codec_info
 
 def encode_text(space, w_obj, encoding, errors):
-if errors is None:
-errors = 'strict'
 w_encoder = space.getitem(
 lookup_text_codec(space, "codecs.encode()", encoding), space.newint(0))
 return _call_codec(space, w_encoder, w_obj, "encoding", encoding, errors)

[pypy-commit] pypy release-pypy2.7-v7.x: merge default into release

2019-03-11 Thread mattip
Author: Matti Picus 
Branch: release-pypy2.7-v7.x
Changeset: r96286:88550581f18c
Date: 2019-03-11 19:41 +0200
http://bitbucket.org/pypy/pypy/changeset/88550581f18c/

Log:merge default into release

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -123,7 +123,9 @@
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
+  Stefan Beyer
   Jeremy Thurgood
+  Andrew Lawrence
   Greg Price
   Ivan Sichmann Freitas
   Dario Bertini
@@ -134,7 +136,6 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
-  Stefan Beyer
   William Leslie
   Paweł Piotr Przeradowski
   marky1991
@@ -152,6 +153,7 @@
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
+  Julian Berman
   Oscar Nierstrasz
   Rami Chowdhury
   Stefan H. Muller
@@ -174,6 +176,7 @@
   Anton Gulenko
   Sergey Matyunin
   Andrew Chambers
+  Łukasz Langa
   Nicolas Chauvat
   Andrew Durdin
   Ben Young
@@ -296,7 +299,6 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
-  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
@@ -328,7 +330,6 @@
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
-  Julian Berman
   Stephan Busemann
   Dan Colish
   timo
diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
--- a/pypy/doc/contributor.rst
+++ b/pypy/doc/contributor.rst
@@ -90,7 +90,9 @@
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
+  Stefan Beyer
   Jeremy Thurgood
+  Andrew Lawrence
   Greg Price
   Ivan Sichmann Freitas
   Dario Bertini
@@ -101,7 +103,6 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
-  Stefan Beyer
   William Leslie
   Paweł Piotr Przeradowski
   marky1991
@@ -119,6 +120,7 @@
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
+  Julian Berman
   Oscar Nierstrasz
   Rami Chowdhury
   Stefan H. Muller
@@ -141,6 +143,7 @@
   Anton Gulenko
   Sergey Matyunin
   Andrew Chambers
+  Łukasz Langa
   Nicolas Chauvat
   Andrew Durdin
   Ben Young
@@ -263,7 +266,6 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
-  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
@@ -295,7 +297,6 @@
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
-  Julian Berman
   Stephan Busemann
   Dan Colish
   timo
diff --git a/pypy/doc/release-v7.1.0.rst b/pypy/doc/release-v7.1.0.rst
--- a/pypy/doc/release-v7.1.0.rst
+++ b/pypy/doc/release-v7.1.0.rst
@@ -14,6 +14,13 @@
 The interpreters are based on much the same codebase, thus the double
 release.
 
+This release, coming fast on the heels of 7.0 in February, finally merges the
+internal refactoring of unicode representation as UTF-8. Removing the
+conversions from strings to unicode internally lead to a nice speed bump.
+
+We also improved the ability to use the buffer protocol with ctype structures
+and arrays.
+
 Until we can work with downstream providers to distribute builds with PyPy, we
 have made packages for some common packages `available as wheels`_.
 
diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
--- a/pypy/doc/tool/makecontributor.py
+++ b/pypy/doc/tool/makecontributor.py
@@ -1,4 +1,5 @@
 # NOTE: run this script with LANG=en_US.UTF-8
+# works with pip install mercurial==3.0
 
 import py
 import sys
@@ -89,6 +90,7 @@
 'Laurence Tratt': ['ltratt'],
 'Pieter Zieschang': ['pzieschang', 'p_ziesch...@yahoo.de'],
 'John Witulski': ['witulski'],
+'Andrew Lawrence': ['andrew.lawre...@siemens.com', 'andrewjlawrence'],
 }
 
 alias_map = {}
diff --git a/pypy/module/_codecs/test/test_codecs.py 
b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -457,6 +457,20 @@
 raises(TypeError, b"hello".decode, "test.mytestenc")
 raises(TypeError, u"hello".encode, "test.mytestenc")
 
+def test_one_arg_encoder(self):
+import _codecs
+def search_function(encoding):
+def encode_one(u):
+return (b'foo', len(u))
+def decode_one(u):
+return (u'foo', len(u))
+if encoding == 'onearg':
+return (encode_one, decode_one, None, None)
+return None
+_codecs.register(search_function)
+assert u"hello".encode("onearg") == 'foo'
+assert b"hello".decode("onearg") == 'foo'
+
 def test_cpytest_decode(self):
 import codecs
 assert codecs.decode(b'\xe4\xf6\xfc', 'latin-1') == u'\xe4\xf6\xfc'
@@ -519,7 +533,7 @@
 import _codecs, array
 assert _codecs.readbuffer_encode(array.array('c', 'spam')) == ('spam', 
4)
 exc = raises(TypeError, _codecs.charbuffer_encode, array.array('c', 
'spam'))
-assert str(exc.value) == "must be string or read-only character 
buffer, not array.array"
+assert "must be string or read-only character buffer, not array.array" 
in str(exc.value)
 assert _codecs.readbuffer_encode(u"test") == ('test', 4)
 ass