[pypy-commit] pypy release-pypy3.6-7.x: hg merge 3.6

antocuni pypy.commits at gmail.com
Fri Feb 1 13:00:39 EST 2019


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: release-pypy3.6-7.x
Changeset: r95774:4286ef6d6e83
Date: 2019-02-01 18:59 +0100
http://bitbucket.org/pypy/pypy/changeset/4286ef6d6e83/

Log:	hg merge 3.6

diff --git a/LICENSE b/LICENSE
--- a/LICENSE
+++ b/LICENSE
@@ -40,16 +40,16 @@
   Armin Rigo
   Maciej Fijalkowski
   Carl Friedrich Bolz-Tereick
+  Antonio Cuni
   Amaury Forgeot d'Arc
-  Antonio Cuni
   Matti Picus
   Samuele Pedroni
   Ronan Lamy
   Alex Gaynor
   Philip Jenvey
+  Richard Plangger
   Brian Kearns
-  Richard Plangger
-  Michael Hudson
+  Michael Hudson-Doyle
   Manuel Jacob
   David Schneider
   Holger Krekel
@@ -59,8 +59,8 @@
   Anders Chrigstrom
   Wim Lavrijsen
   Eric van Riet Paap
+  Remi Meier
   Richard Emslie
-  Remi Meier
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
   Lukas Diekmann
@@ -70,10 +70,10 @@
   Niklaus Haldimann
   Camillo Bruni
   Laura Creighton
-  Romain Guillebert
   Toon Verwaest
   Leonardo Santagada
   Seo Sanghyeon
+  Romain Guillebert
   Ronny Pfannschmidt
   Justin Peel
   Raffael Tfirst
@@ -114,12 +114,12 @@
   Squeaky
   Edd Barrett
   Timo Paulssen
+  Laurence Tratt
   Marius Gedminas
   Nicolas Truessel
   Alexandre Fayolle
   Simon Burton
   Martin Matusiak
-  Laurence Tratt
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
@@ -134,8 +134,9 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Stefan Beyer
+  William Leslie
   Paweł Piotr Przeradowski
-  William Leslie
   marky1991
   Ilya Osadchiy
   Tobias Oberstein
@@ -144,10 +145,10 @@
   Taavi Burns
   Adrian Kuhn
   tav
+  Stian Andreassen
   Georg Brandl
   Joannah Nanjekye
   Bert Freudenberg
-  Stian Andreassen
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
@@ -163,6 +164,7 @@
   Vasily Kuznetsov
   Preston Timmons
   David Ripton
+  Pieter Zieschang
   Dusty Phillips
   Lukas Renggli
   Guenter Jantzen
@@ -176,6 +178,7 @@
   Andrew Durdin
   Ben Young
   Michael Schneider
+  Yusuke Tsutsumi
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
@@ -187,7 +190,6 @@
   Mariano Anaya
   anatoly techtonik
   Karl Bartel
-  Stefan Beyer
   Gabriel Lavoie
   Jared Grubb
   Alecsandru Patrascu
@@ -198,7 +200,6 @@
   Victor Stinner
   Andrews Medina
   Aaron Iles
-  p_zieschang at yahoo.de
   Toby Watson
   Daniel Patrick
   Stuart Williams
@@ -210,6 +211,7 @@
   Mikael Schönenberg
   Stanislaw Halik
   Mihnea Saracin
+  Matt Jackson
   Berkin Ilbeyi
   Gasper Zejn
   Faye Zhao
@@ -217,12 +219,14 @@
   Anders Qvist
   Corbin Simpson
   Chirag Jadwani
+  Pauli Virtanen
   Jonathan David Riehl
   Beatrice During
   Alex Perry
   Robert Zaremba
   Alan McIntyre
   Alexander Sedov
+  David C Ellis
   Vaibhav Sood
   Reuben Cummings
   Attila Gobi
@@ -242,7 +246,6 @@
   Arjun Naik
   Aaron Gallagher
   Alexis Daboville
-  Pieter Zieschang
   Karl Ramm
   Lukas Vacek
   Omer Katz
@@ -270,12 +273,15 @@
   Catalin Gabriel Manciu
   Jacob Oscarson
   Ryan Gonzalez
+  Antoine Dupre
   Kristjan Valur Jonsson
   Lucio Torre
   Richard Lancaster
   Dan Buch
   Lene Wagner
   Tomo Cocoa
+  Miro Hrončok
+  Anthony Sottile
   David Lievens
   Neil Blakey-Milner
   Henrik Vendelbo
@@ -290,10 +296,12 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
+  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
   Jason Michalski
+  Radu Ciorba
   Markus Holtermann
   Andrew Thompson
   Yusei Tahara
@@ -301,28 +309,26 @@
   Fabio Niephaus
   Akira Li
   Gustavo Niemeyer
-  Rafał Gałczyński
+  Nate Bragg
   Lucas Stadler
   roberto at goyle
+  Carl Bordum Hansen
   Matt Bogosian
   Yury V. Zaytsev
   florinpapa
   Anders Sigfridsson
-  Matt Jackson
   Nikolay Zinov
   rafalgalczynski at gmail.com
   Joshua Gilbert
   Anna Katrina Dominguez
   Kim Jin Su
   Amber Brown
-  Miro Hrončok
-  Anthony Sottile
-  Nate Bragg
+  Andrew Stepanov
+  Rafał Gałczyński
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
   Julian Berman
-  Michael Hudson-Doyle
   Stephan Busemann
   Dan Colish
   timo
@@ -332,6 +338,7 @@
   halgari
   Jim Baker
   Chris Lambacher
+  John Aldis
   coolbutuseless at gmail.com
   Mike Bayer
   Rodrigo Araújo
@@ -340,6 +347,7 @@
   OlivierBlanvillain
   Jonas Pfannschmidt
   Zearin
+  Johan Forsberg
   Andrey Churin
   Dan Crosta
   reubano at gmail.com
@@ -349,8 +357,9 @@
   Steve Papanik
   Eli Stevens
   Boglarka Vezer
-  gabrielg
+  gabrielg at ec2-54-146-239-158.compute-1.amazonaws.com
   PavloKapyshin
+  Hervé Beraud
   Tomer Chachamu
   Christopher Groskopf
   Asmo Soinio
@@ -364,7 +373,6 @@
   Michael Chermside
   Anna Ravencroft
   remarkablerocket
-  Pauli Virtanen
   Petre Vijiac
   Berker Peksag
   Christian Muirhead
@@ -384,12 +392,13 @@
   Zooko Wilcox-O Hearn
   James Lan
   jiaaro
+  Evgenii Gorinov
   Markus Unterwaditzer
   Kristoffer Kleine
   Graham Markall
   Dan Loewenherz
   werat
-  Andrew Stepanov
+  Filip Salomonsson
   Niclas Olofsson
   Chris Pressey
   Tobias Diaz
diff --git a/extra_tests/cffi_tests/cffi0/test_function.py b/extra_tests/cffi_tests/cffi0/test_function.py
--- a/extra_tests/cffi_tests/cffi0/test_function.py
+++ b/extra_tests/cffi_tests/cffi0/test_function.py
@@ -46,14 +46,15 @@
         assert x != math.sin(1.23)    # rounding effects
         assert abs(x - math.sin(1.23)) < 1E-6
 
-    def test_lround_no_return_value(self):
+    def test_getenv_no_return_value(self):
         # check that 'void'-returning functions work too
         ffi = FFI(backend=self.Backend())
         ffi.cdef("""
-            void lround(double x);
+            void getenv(char *);
         """)
-        m = ffi.dlopen(lib_m)
-        x = m.lround(1.23)
+        needs_dlopen_none()
+        m = ffi.dlopen(None)
+        x = m.getenv(b"FOO")
         assert x is None
 
     def test_dlopen_filename(self):
diff --git a/extra_tests/cffi_tests/cffi1/test_pkgconfig.py b/extra_tests/cffi_tests/cffi1/test_pkgconfig.py
new file mode 100644
--- /dev/null
+++ b/extra_tests/cffi_tests/cffi1/test_pkgconfig.py
@@ -0,0 +1,95 @@
+# Generated by pypy/tool/import_cffi.py
+import sys
+import subprocess
+import py
+import cffi.pkgconfig as pkgconfig
+from cffi import PkgConfigError
+
+
+def mock_call(libname, flag):
+    assert libname=="foobarbaz"
+    flags = {
+        "--cflags": "-I/usr/include/python3.6m -DABCD -DCFFI_TEST=1 -O42\n",
+        "--libs": "-L/usr/lib64 -lpython3.6 -shared\n",
+    }
+    return flags[flag]
+
+
+def test_merge_flags():
+    d1 = {"ham": [1, 2, 3], "spam" : ["a", "b", "c"], "foo" : []}
+    d2 = {"spam" : ["spam", "spam", "spam"], "bar" : ["b", "a", "z"]}
+
+    pkgconfig.merge_flags(d1, d2)
+    assert d1 == {
+        "ham": [1, 2, 3],
+        "spam" : ["a", "b", "c", "spam", "spam", "spam"],
+        "bar" : ["b", "a", "z"],
+        "foo" : []}
+
+
+def test_pkgconfig():
+    assert pkgconfig.flags_from_pkgconfig([]) == {}
+
+    saved = pkgconfig.call
+    try:
+        pkgconfig.call = mock_call
+        flags = pkgconfig.flags_from_pkgconfig(["foobarbaz"])
+    finally:
+        pkgconfig.call = saved
+    assert flags == {
+        'include_dirs': ['/usr/include/python3.6m'],
+        'library_dirs': ['/usr/lib64'],
+        'libraries': ['python3.6'],
+        'define_macros': [('ABCD', None), ('CFFI_TEST', '1')],
+        'extra_compile_args': ['-O42'],
+        'extra_link_args': ['-shared']
+    }
+
+class mock_subprocess:
+    PIPE = Ellipsis
+    class Popen:
+        def __init__(self, cmd, stdout, stderr):
+            if mock_subprocess.RESULT is None:
+                raise OSError("oops can't run")
+            assert cmd == ['pkg-config', '--print-errors', '--cflags', 'libfoo']
+        def communicate(self):
+            bout, berr, rc = mock_subprocess.RESULT
+            self.returncode = rc
+            return bout, berr
+
+def test_call():
+    saved = pkgconfig.subprocess
+    try:
+        pkgconfig.subprocess = mock_subprocess
+
+        mock_subprocess.RESULT = None
+        e = py.test.raises(PkgConfigError, pkgconfig.call, "libfoo", "--cflags")
+        assert str(e.value) == "cannot run pkg-config: oops can't run"
+
+        mock_subprocess.RESULT = b"", "Foo error!\n", 1
+        e = py.test.raises(PkgConfigError, pkgconfig.call, "libfoo", "--cflags")
+        assert str(e.value) == "Foo error!"
+
+        mock_subprocess.RESULT = b"abc\\def\n", "", 0
+        e = py.test.raises(PkgConfigError, pkgconfig.call, "libfoo", "--cflags")
+        assert str(e.value).startswith("pkg-config --cflags libfoo returned an "
+                                       "unsupported backslash-escaped output:")
+
+        mock_subprocess.RESULT = b"abc def\n", "", 0
+        result = pkgconfig.call("libfoo", "--cflags")
+        assert result == "abc def\n"
+
+        mock_subprocess.RESULT = b"abc def\n", "", 0
+        result = pkgconfig.call("libfoo", "--cflags")
+        assert result == "abc def\n"
+
+        if sys.version_info >= (3,):
+            mock_subprocess.RESULT = b"\xff\n", "", 0
+            e = py.test.raises(PkgConfigError, pkgconfig.call,
+                               "libfoo", "--cflags", encoding="utf-8")
+            assert str(e.value) == (
+                "pkg-config --cflags libfoo returned bytes that cannot be "
+                "decoded with encoding 'utf-8':\nb'\\xff\\n'")
+
+    finally:
+        pkgconfig.subprocess = saved
diff --git a/lib_pypy/_collections.py b/lib_pypy/_collections.py
--- a/lib_pypy/_collections.py
+++ b/lib_pypy/_collections.py
@@ -390,7 +390,7 @@
 
 class defaultdict(dict):
     __slots__ = ["default_factory"]
-    
+
     def __init__(self, *args, **kwds):
         if len(args) > 0:
             default_factory = args[0]
@@ -401,10 +401,10 @@
             default_factory = None
         self.default_factory = default_factory
         super(defaultdict, self).__init__(*args, **kwds)
- 
+
     def __missing__(self, key):
         # from defaultdict docs
-        if self.default_factory is None: 
+        if self.default_factory is None:
             raise KeyError(key)
         self[key] = value = self.default_factory()
         return value
@@ -420,7 +420,7 @@
 
     def copy(self):
         return type(self)(self.default_factory, self)
-    
+
     def __copy__(self):
         return self.copy()
 
@@ -438,9 +438,3 @@
         """
         return (type(self), (self.default_factory,), None, None,
                 iter(self.items()))
-
-
-try:
-    from _pypy_collections import OrderedDict
-except ImportError:
-    pass
diff --git a/lib_pypy/cffi/__init__.py b/lib_pypy/cffi/__init__.py
--- a/lib_pypy/cffi/__init__.py
+++ b/lib_pypy/cffi/__init__.py
@@ -3,6 +3,7 @@
 
 from .api import FFI
 from .error import CDefError, FFIError, VerificationError, VerificationMissing
+from .error import PkgConfigError
 
 __version__ = "1.12.0"
 __version_info__ = (1, 12, 0)
diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py
--- a/lib_pypy/cffi/api.py
+++ b/lib_pypy/cffi/api.py
@@ -643,6 +643,16 @@
         self._assigned_source = (str(module_name), source,
                                  source_extension, kwds)
 
+    def set_source_pkgconfig(self, module_name, pkgconfig_libs, source,
+                             source_extension='.c', **kwds):
+        from . import pkgconfig
+        if not isinstance(pkgconfig_libs, list):
+            raise TypeError("the pkgconfig_libs argument must be a list "
+                            "of package names")
+        kwds2 = pkgconfig.flags_from_pkgconfig(pkgconfig_libs)
+        pkgconfig.merge_flags(kwds, kwds2)
+        self.set_source(module_name, source, source_extension, **kwds)
+
     def distutils_extension(self, tmpdir='build', verbose=True):
         from distutils.dir_util import mkpath
         from .recompiler import recompile
diff --git a/lib_pypy/cffi/error.py b/lib_pypy/cffi/error.py
--- a/lib_pypy/cffi/error.py
+++ b/lib_pypy/cffi/error.py
@@ -1,8 +1,9 @@
 
 class FFIError(Exception):
-    pass
+    __module__ = 'cffi'
 
 class CDefError(Exception):
+    __module__ = 'cffi'
     def __str__(self):
         try:
             current_decl = self.args[1]
@@ -16,8 +17,15 @@
 class VerificationError(Exception):
     """ An error raised when verification fails
     """
+    __module__ = 'cffi'
 
 class VerificationMissing(Exception):
     """ An error raised when incomplete structures are passed into
     cdef, but no verification has been done
     """
+    __module__ = 'cffi'
+
+class PkgConfigError(Exception):
+    """ An error raised for missing modules in pkg-config
+    """
+    __module__ = 'cffi'
diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst
--- a/pypy/doc/build.rst
+++ b/pypy/doc/build.rst
@@ -220,11 +220,12 @@
 Making a debug build of PyPy
 ----------------------------
 
-If the Makefile is rerun with the lldebug or lldebug0 target, appropriate
-compilation flags are added to add debug info and reduce compiler optimizations
-to ``-O0`` respectively. If you stop in a debugger, you will see the
-very wordy machine-generated C code from the rpython translation step, which
-takes a little bit of reading to relate back to the rpython code.
+Rerun the ``Makefile`` with the ``make lldebug`` or ``make lldebug0`` target,
+which will build in a way that running under a debugger makes sense.
+Appropriate compilation flags are added to add debug info, and for ``lldebug0``
+compiler optimizations are fully disabled. If you stop in a debugger, you will
+see the very wordy machine-generated C code from the rpython translation step,
+which takes a little bit of reading to relate back to the rpython code.
 
 Build cffi import libraries for the stdlib
 ------------------------------------------
diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst
--- a/pypy/doc/contributor.rst
+++ b/pypy/doc/contributor.rst
@@ -7,16 +7,16 @@
   Armin Rigo
   Maciej Fijalkowski
   Carl Friedrich Bolz-Tereick
+  Antonio Cuni
   Amaury Forgeot d'Arc
-  Antonio Cuni
   Matti Picus
   Samuele Pedroni
   Ronan Lamy
   Alex Gaynor
   Philip Jenvey
+  Richard Plangger
   Brian Kearns
-  Richard Plangger
-  Michael Hudson
+  Michael Hudson-Doyle
   Manuel Jacob
   David Schneider
   Holger Krekel
@@ -26,8 +26,8 @@
   Anders Chrigstrom
   Wim Lavrijsen
   Eric van Riet Paap
+  Remi Meier
   Richard Emslie
-  Remi Meier
   Alexander Schremmer
   Dan Villiom Podlaski Christiansen
   Lukas Diekmann
@@ -37,10 +37,10 @@
   Niklaus Haldimann
   Camillo Bruni
   Laura Creighton
-  Romain Guillebert
   Toon Verwaest
   Leonardo Santagada
   Seo Sanghyeon
+  Romain Guillebert
   Ronny Pfannschmidt
   Justin Peel
   Raffael Tfirst
@@ -81,12 +81,12 @@
   Squeaky
   Edd Barrett
   Timo Paulssen
+  Laurence Tratt
   Marius Gedminas
   Nicolas Truessel
   Alexandre Fayolle
   Simon Burton
   Martin Matusiak
-  Laurence Tratt
   Wenzhu Man
   Konstantin Lopuhin
   John Witulski
@@ -101,8 +101,9 @@
   Jean-Philippe St. Pierre
   Guido van Rossum
   Pavel Vinogradov
+  Stefan Beyer
+  William Leslie
   Paweł Piotr Przeradowski
-  William Leslie
   marky1991
   Ilya Osadchiy
   Tobias Oberstein
@@ -111,10 +112,10 @@
   Taavi Burns
   Adrian Kuhn
   tav
+  Stian Andreassen
   Georg Brandl
   Joannah Nanjekye
   Bert Freudenberg
-  Stian Andreassen
   Wanja Saatkamp
   Mike Blume
   Gerald Klix
@@ -130,6 +131,7 @@
   Vasily Kuznetsov
   Preston Timmons
   David Ripton
+  Pieter Zieschang
   Dusty Phillips
   Lukas Renggli
   Guenter Jantzen
@@ -143,6 +145,7 @@
   Andrew Durdin
   Ben Young
   Michael Schneider
+  Yusuke Tsutsumi
   Nicholas Riley
   Jason Chu
   Igor Trindade Oliveira
@@ -154,7 +157,6 @@
   Mariano Anaya
   anatoly techtonik
   Karl Bartel
-  Stefan Beyer
   Gabriel Lavoie
   Jared Grubb
   Alecsandru Patrascu
@@ -165,7 +167,6 @@
   Victor Stinner
   Andrews Medina
   Aaron Iles
-  p_zieschang at yahoo.de
   Toby Watson
   Daniel Patrick
   Stuart Williams
@@ -177,6 +178,7 @@
   Mikael Schönenberg
   Stanislaw Halik
   Mihnea Saracin
+  Matt Jackson
   Berkin Ilbeyi
   Gasper Zejn
   Faye Zhao
@@ -184,12 +186,14 @@
   Anders Qvist
   Corbin Simpson
   Chirag Jadwani
+  Pauli Virtanen
   Jonathan David Riehl
   Beatrice During
   Alex Perry
   Robert Zaremba
   Alan McIntyre
   Alexander Sedov
+  David C Ellis
   Vaibhav Sood
   Reuben Cummings
   Attila Gobi
@@ -209,7 +213,6 @@
   Arjun Naik
   Aaron Gallagher
   Alexis Daboville
-  Pieter Zieschang
   Karl Ramm
   Lukas Vacek
   Omer Katz
@@ -237,12 +240,15 @@
   Catalin Gabriel Manciu
   Jacob Oscarson
   Ryan Gonzalez
+  Antoine Dupre
   Kristjan Valur Jonsson
   Lucio Torre
   Richard Lancaster
   Dan Buch
   Lene Wagner
   Tomo Cocoa
+  Miro Hrončok
+  Anthony Sottile
   David Lievens
   Neil Blakey-Milner
   Henrik Vendelbo
@@ -257,10 +263,12 @@
   Bobby Impollonia
   Roberto De Ioris
   Jeong YunWon
+  andrewjlawrence
   Christopher Armstrong
   Aaron Tubbs
   Vasantha Ganesh K
   Jason Michalski
+  Radu Ciorba
   Markus Holtermann
   Andrew Thompson
   Yusei Tahara
@@ -268,28 +276,26 @@
   Fabio Niephaus
   Akira Li
   Gustavo Niemeyer
-  Rafał Gałczyński
+  Nate Bragg
   Lucas Stadler
   roberto at goyle
+  Carl Bordum Hansen
   Matt Bogosian
   Yury V. Zaytsev
   florinpapa
   Anders Sigfridsson
-  Matt Jackson
   Nikolay Zinov
   rafalgalczynski at gmail.com
   Joshua Gilbert
   Anna Katrina Dominguez
   Kim Jin Su
   Amber Brown
-  Miro Hrončok
-  Anthony Sottile
-  Nate Bragg
+  Andrew Stepanov
+  Rafał Gałczyński
   Ben Darnell
   Juan Francisco Cantero Hurtado
   Godefroid Chappelle
   Julian Berman
-  Michael Hudson-Doyle
   Stephan Busemann
   Dan Colish
   timo
@@ -299,6 +305,7 @@
   halgari
   Jim Baker
   Chris Lambacher
+  John Aldis
   coolbutuseless at gmail.com
   Mike Bayer
   Rodrigo Araújo
@@ -307,6 +314,7 @@
   OlivierBlanvillain
   Jonas Pfannschmidt
   Zearin
+  Johan Forsberg
   Andrey Churin
   Dan Crosta
   reubano at gmail.com
@@ -316,8 +324,9 @@
   Steve Papanik
   Eli Stevens
   Boglarka Vezer
-  gabrielg
+  gabrielg at ec2-54-146-239-158.compute-1.amazonaws.com
   PavloKapyshin
+  Hervé Beraud
   Tomer Chachamu
   Christopher Groskopf
   Asmo Soinio
@@ -331,7 +340,6 @@
   Michael Chermside
   Anna Ravencroft
   remarkablerocket
-  Pauli Virtanen
   Petre Vijiac
   Berker Peksag
   Christian Muirhead
@@ -351,12 +359,13 @@
   Zooko Wilcox-O Hearn
   James Lan
   jiaaro
+  Evgenii Gorinov
   Markus Unterwaditzer
   Kristoffer Kleine
   Graham Markall
   Dan Loewenherz
   werat
-  Andrew Stepanov
+  Filip Salomonsson
   Niclas Olofsson
   Chris Pressey
   Tobias Diaz
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
@@ -6,6 +6,7 @@
 
 .. toctree::
 
+   release-v7.0.0.rst
    release-v6.0.0.rst
    release-v5.10.1.rst
    release-v5.10.0.rst
diff --git a/pypy/doc/index-of-whatsnew.rst b/pypy/doc/index-of-whatsnew.rst
--- a/pypy/doc/index-of-whatsnew.rst
+++ b/pypy/doc/index-of-whatsnew.rst
@@ -7,6 +7,7 @@
 .. toctree::
 
    whatsnew-head.rst
+   whatsnew-pypy2-7.0.0.rst
    whatsnew-pypy2-6.0.0.rst
    whatsnew-pypy2-5.10.0.rst
    whatsnew-pypy2-5.10.0.rst
@@ -41,6 +42,7 @@
 .. toctree::
 
    whatsnew-pypy3-head.rst
+   whatsnew-pypy3-7.0.0.rst
    whatsnew-pypy3-5.9.0.rst
    whatsnew-pypy3-5.8.0.rst
    whatsnew-pypy3-5.7.0.rst
diff --git a/pypy/doc/interpreter.rst b/pypy/doc/interpreter.rst
--- a/pypy/doc/interpreter.rst
+++ b/pypy/doc/interpreter.rst
@@ -156,7 +156,7 @@
 environment found in `Frames`.  Frames and Functions have references
 to a code object. Here is a list of Code attributes:
 
-* ``co_flags`` flags if this code object has nested scopes/generators
+* ``co_flags`` flags if this code object has nested scopes/generators/etc.
 * ``co_stacksize`` the maximum depth the stack can reach while executing the code
 * ``co_code`` the actual bytecode string
 
diff --git a/pypy/doc/release-v7.0.0.rst b/pypy/doc/release-v7.0.0.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-v7.0.0.rst
@@ -0,0 +1,151 @@
+======================================================
+PyPy v7.0.0: triple release of 2.7, 3.5 and 3.6-alpha
+======================================================
+
+The PyPy team is proud to release the version 7.0.0 of PyPy, which includes
+three different interpreters:
+
+  - PyPy2.7, which is an interpreter supporting the syntax and the features of
+    Python 2.7
+
+  - PyPy3.5, which supports Python 3.5
+
+  - PyPy3.6-alpha: this is the first official release of PyPy to support 3.6
+    features, although it is still considered alpha quality.
+    
+All the interpreters are based on much the same codebase, thus the triple
+release.
+
+Until we can work with downstream providers to distribute builds with PyPy, we
+have made packages for some common packages `available as wheels`_.
+
+The GC `hooks`_ , which can be used to gain more insights into its
+performance, has been improved and it is now possible to manually manage the
+GC by using a combination of ``gc.disable`` and ``gc.collect_step``. See the
+`GC blog post`_.
+
+
+We updated the `cffi`_ module included in PyPy to version 1.12, and the
+`cppyy`_ backend to 1.4. Please use these to wrap your C and C++ code,
+respectively, for a JIT friendly experience.
+
+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 and the Windows PyPy3.5 release are still not production
+quality so your mileage may vary. There are open issues with incomplete
+compatibility and c-extension support.
+
+The utf8 branch that changes internal representation of unicode to utf8 did not
+make it into the release, so there is still more goodness coming.
+You can download the v6.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
+.. _`GC blog post`: https://morepypy.blogspot.com/2019/01/pypy-for-low-latency-systems.html
+
+
+What is PyPy?
+=============
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7, 3.5 and 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
+
+* Support ``__set_name__``, ``__init_subclass__`` (Py3.6)
+* Support ``cppyy`` in Py3.5 and Py3.6
+* Use implementation-specific site directories in ``sysconfig`` (Py3.5, Py3.6)
+* Adding detection of gcc to ``sysconfig`` (Py3.5, Py3.6)
+* Fix multiprocessing regression on newer glibcs
+* Make sure 'blocking-ness' of socket is set along with default timeout
+* Include ``crypt.h`` for ``crypt()`` on Linux
+* Improve and re-organize the contributing_ documentation
+* Make the ``__module__`` attribute writable, fixing an incompatibility with
+  NumPy 1.16
+* Implement ``Py_ReprEnter``, ``Py_ReprLeave(), ``PyMarshal_ReadObjectFromString``,
+  ``PyMarshal_WriteObjectToString``, ``PyObject_DelItemString``,
+  ``PyMapping_DelItem``, ``PyMapping_DelItemString``, ``PyEval_GetFrame``,
+  ``PyOS_InputHook``, ``PyErr_FormatFromCause`` (Py3.6),
+* Implement new wordcode instruction encoding (Py3.6)
+* Log additional gc-minor and gc-collect-step info in the PYPYLOG
+* The ``reverse-debugger`` (revdb) branch has been merged to the default
+  branch, so it should always be up-to-date.  You still need a special pypy
+  build, but you can compile it from the same source as the one we distribute
+  for the v7.0.0 release.  For more information, see
+  https://bitbucket.org/pypy/revdb
+* Support underscores in numerical literals like ``'4_2'`` (Py3.6)
+* Pre-emptively raise MemoryError if the size of dequeue in ``_collections.deque``
+  is too large (Py3.5)
+* Fix multithreading issues in calls to ``os.setenv``
+* Add missing defines and typedefs for numpy and pandas on MSVC
+* Add CPython macros like ``Py_NAN`` to header files
+* Rename the ``MethodType`` to ``instancemethod``, like CPython
+* Better support for `async with` in generators (Py3.5, Py3.6)
+* Improve the performance of ``pow(a, b, c)`` if ``c`` is a large integer
+* Now ``vmprof`` works on FreeBSD
+* Support GNU Hurd, fixes for FreeBSD
+* Add deprecation warning if type of result of ``__float__`` is float inherited
+  class (Py3.6)
+* Fix async generator bug when yielding a ``StopIteration`` (Py3.6)
+* Speed up ``max(list-of-int)`` from non-jitted code
+* Fix Windows ``os.listdir()`` for some cases (see CPython #32539)
+* Add ``select.PIPE_BUF``
+* Use ``subprocess`` to avoid shell injection in ``shutil`` module - backport
+  of https://bugs.python.org/issue34540
+* Rename ``_Py_ZeroStruct`` to ``_Py_FalseStruct`` (Py3.5, Py3.6)
+* Remove some cpyext names for Py3.5, Py3.6
+* Enable use of unicode file names in ``dlopen``
+* Backport CPython fix for ``thread.RLock``
+* Make GC hooks measure time in seconds (as opposed to an opaque unit)
+* Refactor and reorganize tests in ``test_lib_pypy``
+* Check error values in ``socket.setblocking`` (Py3.6)
+* Add support for FsPath to os.unlink() (Py3.6)
+* Fix freezing builtin modules at translation
+* Tweak ``W_UnicodeDictionaryStrategy`` which speeds up dictionaries with only
+  unicode keys
+
+We also refactored many parts of the JIT bridge optimizations, as well as cpyext
+internals, and together with new contributors fixed issues, added new
+documentation, and cleaned up the codebase.
+
+.. _contributing: http://doc.pypy.org/en/latest/contributing.html
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,73 +1,6 @@
 ==========================
-What's new in PyPy2.7 6.0+
+What's new in PyPy2.7 7.0+
 ==========================
 
-.. this is a revision shortly after release-pypy-6.0.0
-.. startrev: e50e11af23f1
-
-.. branch: cppyy-packaging
-
-Main items: vastly better template resolution and improved performance. In
-detail: upgrade to backend 1.4, improved handling of templated methods and
-functions (in particular automatic deduction of types), improved pythonization
-interface, range of compatibility fixes for Python3, free functions now take
-fast libffi path when possible, moves for strings (incl. from Python str),
-easier/faster handling of std::vector by numpy, improved and faster object
-identity preservation
-
-.. branch: socket_default_timeout_blockingness
-
-Make sure 'blocking-ness' of socket is set along with default timeout
-
-.. branch: crypt_h
-
-Include crypt.h for crypt() on Linux
-
-.. branch: gc-more-logging
-
-Log additional gc-minor and gc-collect-step info in the PYPYLOG
-
-.. branch: reverse-debugger
-
-The reverse-debugger branch has been merged.  For more information, see
-https://bitbucket.org/pypy/revdb
-
-
-.. branch: pyparser-improvements-3
-
-Small refactorings in the Python parser.
-
-.. branch: fix-readme-typo
-
-.. branch: py3.6-wordcode
-
-implement new wordcode instruction encoding on the 3.6 branch
-
-.. branch: socket_default_timeout_blockingness
-
-Backport CPython fix for possible shell injection issue in `distutils.spawn`,
-https://bugs.python.org/issue34540
-
-.. branch: cffi_dlopen_unicode
-
-Enable use of unicode file names in `dlopen`
-
-.. branch: rlock-in-rpython
-
-Backport CPython fix for `thread.RLock` 
-
-
-.. branch: expose-gc-time
-
-Make GC hooks measure time in seconds (as opposed to an opaque unit).
-
-.. branch: cleanup-test_lib_pypy
-
-Update most test_lib_pypy/ tests and move them to extra_tests/.
-
-.. branch: gc-disable
-
-Make it possible to manually manage the GC by using a combination of
-gc.disable() and gc.collect_step(). Make sure to write a proper release
-announcement in which we explain that existing programs could leak memory if
-they run for too much time between a gc.disable()/gc.enable()
+.. this is a revision shortly after release-pypy-7.0.0
+.. startrev: 481c69f7d81f
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-pypy2-7.0.0.rst
copy from pypy/doc/whatsnew-head.rst
copy to pypy/doc/whatsnew-pypy2-7.0.0.rst
diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-7.0.0.rst
copy from pypy/doc/whatsnew-pypy3-head.rst
copy to pypy/doc/whatsnew-pypy3-7.0.0.rst
diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst
--- a/pypy/doc/whatsnew-pypy3-head.rst
+++ b/pypy/doc/whatsnew-pypy3-head.rst
@@ -1,25 +1,6 @@
-========================
-What's new in PyPy3 6.0+
-========================
-
-.. this is the revision after release-pypy3.5-v6.0
-.. startrev: 580e3e26cd32
-
-.. branch: hroncok/fix-multiprocessing-regression-on-newer--1524656522151
-
-Fix multiprocessing regression on newer glibcs
-
-.. branch: py3.5-user-site-impl
-
-Use implementation-specific site directories in sysconfig like in Python2
-
-
-.. branch: alex_gaynor/remove-an-unneeded-call-into-openssl-th-1526429141011
-
-Remove an unneeded call into OpenSSL, from cpython https://github.com/python/cpython/pull/6887
-
-
-.. branch: py3.5-reverse-debugger
-
-The reverse-debugger branch has been merged.  For more information, see
-https://bitbucket.org/pypy/revdb
+========================
+What's new in PyPy3 7.0+
+========================
+
+.. this is the revision after release-pypy3.5-v7.0
+.. startrev: 9d2fa7c63b7c
diff --git a/pypy/module/_collections/__init__.py b/pypy/module/_collections/__init__.py
--- a/pypy/module/_collections/__init__.py
+++ b/pypy/module/_collections/__init__.py
@@ -8,6 +8,7 @@
 
     appleveldefs = {
         'defaultdict': 'app_defaultdict.defaultdict',
+        'OrderedDict': 'app_odict.OrderedDict',
         }
 
     interpleveldefs = {
@@ -25,15 +26,3 @@
         space = self.space
         space.getattr(self, space.newtext('defaultdict'))  # force importing
         space.delattr(self, space.newtext('__missing__'))
-
-    def startup(self, space):
-        # OrderedDict is normally present, but in some cases the line
-        # "from __pypy__ import reversed_dict, move_to_end" from
-        # _pypy_collections.py raises
-        space.appexec([self], """(mod):
-            try:
-                from _pypy_collections import OrderedDict
-                mod.OrderedDict = OrderedDict
-            except ImportError:
-                pass
-        """)
diff --git a/lib_pypy/_pypy_collections.py b/pypy/module/_collections/app_odict.py
rename from lib_pypy/_pypy_collections.py
rename to pypy/module/_collections/app_odict.py
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -512,6 +512,7 @@
         header = DEFAULT_HEADER
         if func.__name__ in FUNCTIONS_BY_HEADER[header]:
             raise ValueError("%s already registered" % func.__name__)
+        func._revdb_c_only_ = True   # hack for revdb
         api_function = COnlyApiFunction(argtypes, restype, func)
         FUNCTIONS_BY_HEADER[header][func.__name__] = api_function
         return api_function
diff --git a/pypy/module/sys/vm.py b/pypy/module/sys/vm.py
--- a/pypy/module/sys/vm.py
+++ b/pypy/module/sys/vm.py
@@ -234,7 +234,7 @@
     service_pack_minor = structseqfield(11, "Service Pack minor version number")
     suite_mask = structseqfield(12, "Bit mask identifying available product suites")
     product_type = structseqfield(13, "System product type")
-    _platform_version = structseqfield(14, "Diagnostic version number")
+    platform_version = structseqfield(14, "Diagnostic version number")
 ''')
 
 
diff --git a/rpython/rlib/rgc.py b/rpython/rlib/rgc.py
--- a/rpython/rlib/rgc.py
+++ b/rpython/rlib/rgc.py
@@ -67,7 +67,7 @@
     """Returns True if we have a "split GC address space", i.e. if
     we are translating with an option that doesn't support taking raw
     addresses inside GC objects and "hacking" at them.  This is
-    notably the case with --reversedb."""
+    notably the case with --revdb."""
     return False
 
 # for test purposes we allow objects to be pinned and use
diff --git a/rpython/rlib/src/boehm-rawrefcount.c b/rpython/rlib/src/boehm-rawrefcount.c
--- a/rpython/rlib/src/boehm-rawrefcount.c
+++ b/rpython/rlib/src/boehm-rawrefcount.c
@@ -191,6 +191,7 @@
 #endif
                 assert(result->ob_refcnt == REFCNT_FROM_PYPY);
                 result->ob_refcnt = 1;
+                result->ob_pypy_link = 0;
                 p->pyobj = NULL;
                 *pp = p->next_in_bucket;
                 p->next_in_bucket = hash_free_list;
diff --git a/rpython/tool/setuptools_msvc.py b/rpython/tool/setuptools_msvc.py
--- a/rpython/tool/setuptools_msvc.py
+++ b/rpython/tool/setuptools_msvc.py
@@ -27,7 +27,6 @@
 import platform
 import itertools
 import distutils.errors
-from pkg_resources.extern.packaging.version import LegacyVersion
 
 from setuptools.extern.six.moves import filterfalse
 
@@ -201,6 +200,7 @@
     """
     if "numpy.distutils" in sys.modules:
         import numpy as np
+        from pkg_resources.extern.packaging.version import LegacyVersion
         if LegacyVersion(np.__version__) < LegacyVersion('1.11.2'):
             return np.distutils.ccompiler.gen_lib_options(*args, **kwargs)
     return get_unpatched(msvc14_gen_lib_options)(*args, **kwargs)
diff --git a/rpython/translator/platform/windows.py b/rpython/translator/platform/windows.py
--- a/rpython/translator/platform/windows.py
+++ b/rpython/translator/platform/windows.py
@@ -56,7 +56,12 @@
         # use setuptools from python3 to find tools
         try:
             vcdict = _find_vcvarsall(vsver, x64flag)
+        except ImportError as e:
+            if 'setuptools' in str(e):
+                log.error('is setuptools installed (perhaps try %s -mensurepip)?' % sys.executable)
+            log.error('looking for compiler %s raised exception "%s' % (vsver, str(e)))
         except Exception as e:
+            log.error('looking for compiler %s raised exception "%s' % (vsver, str(e)))
             return None
     else:
         if x64flag:
diff --git a/rpython/translator/revdb/gencsupp.py b/rpython/translator/revdb/gencsupp.py
--- a/rpython/translator/revdb/gencsupp.py
+++ b/rpython/translator/revdb/gencsupp.py
@@ -51,6 +51,10 @@
 ##         return False
 
 def prepare_function(funcgen):
+    if getattr(getattr(funcgen.graph, 'func', None), '_revdb_c_only_', False):
+        extra_enter_text = 'RPY_REVDB_C_ONLY_ENTER'
+        extra_return_text = 'RPY_REVDB_C_ONLY_LEAVE'
+        return extra_enter_text, extra_return_text
     stack_bottom = False
     for block in funcgen.graph.iterblocks():
         for op in block.operations:
diff --git a/rpython/translator/revdb/src-revdb/revdb.c b/rpython/translator/revdb/src-revdb/revdb.c
--- a/rpython/translator/revdb/src-revdb/revdb.c
+++ b/rpython/translator/revdb/src-revdb/revdb.c
@@ -253,7 +253,10 @@
                         "(use REVDB=logfile)\n", (int)getpid());
     }
 
-    rpy_revdb.buf_p = rpy_rev_buffer + sizeof(int16_t);
+    if (rpy_rev_fileno >= 0)
+        rpy_revdb.buf_p = rpy_rev_buffer + sizeof(int16_t);
+    else
+        rpy_revdb.buf_p = NULL;
     rpy_revdb.buf_limit = rpy_rev_buffer + sizeof(rpy_rev_buffer) - 32;
     rpy_revdb.unique_id_seen = 1;
 
@@ -269,17 +272,23 @@
     ssize_t full_size;
     assert(rpy_revdb.lock);
 
+    if (rpy_revdb.buf_p == NULL)
+        return;
+    assert(rpy_rev_fileno >= 0);
+
     /* write the current buffer content to the OS */
     full_size = rpy_revdb.buf_p - rpy_rev_buffer;
     rpy_revdb.buf_p = rpy_rev_buffer + sizeof(int16_t);
-    if (rpy_rev_fileno >= 0)
-        write_all(rpy_rev_buffer, full_size);
+    write_all(rpy_rev_buffer, full_size);
 }
 
 static ssize_t current_packet_size(void)
 {
     /* must be called with the lock held */
-    return rpy_revdb.buf_p - (rpy_rev_buffer + sizeof(int16_t));
+    if (rpy_revdb.buf_p != NULL)
+        return rpy_revdb.buf_p - (rpy_rev_buffer + sizeof(int16_t));
+    else
+        return 0;
 }
 
 RPY_EXTERN
@@ -327,6 +336,11 @@
     rpy_reverse_db_flush();
     assert(current_packet_size() == 0);
 
+    if (rpy_rev_fileno < 0)
+        return;
+    /* should not be here from the middle of a @c_only function */
+    assert(rpy_revdb.buf_p != NULL);
+
     *(int16_t *)p = async_code;
     memcpy(rpy_revdb.buf_p, &content, sizeof(uint64_t));
     rpy_revdb.buf_p += sizeof(uint64_t);
@@ -472,6 +486,9 @@
 
     if (rpy_rev_fileno < 0)
         return 1;
+    /* should not be here from the middle of a @c_only function */
+    assert(rpy_revdb.buf_p != NULL);
+
     base_offset = lseek(rpy_rev_fileno, 0, SEEK_CUR);
     if (base_offset < 0) {
         perror("lseek");
@@ -488,6 +505,9 @@
 
     if (rpy_rev_fileno < 0)
         return;
+    /* should not be here from the middle of a @c_only function */
+    assert(rpy_revdb.buf_p != NULL);
+
     base_offset = lseek(rpy_rev_fileno, 0, SEEK_CUR);
     if (base_offset < 0) {
         perror("lseek");
@@ -1033,9 +1053,9 @@
                 "    echo 0 | sudo tee /proc/sys/kernel/randomize_va_space\n"
                 "\n"
                 "It has been reported that on Linux kernel 4.12.4-1-ARCH,\n"
-                "ASLR cannot be disabled at all for libpypy-c.so.  For now\n"
-                "there is no good solution.  Either you downgrade the\n"
-                "kernel, or you translate with --no-shared (and you loose\n"
+                "ASLR cannot be disabled at all for libpypy-c.so.  It works\n"
+                "again in kernel 4.19 (and maybe sooner).  Either change\n"
+                "kernels, or translate with --no-shared (but then you loose\n"
                 "PyPy's cpyext ability).\n"
                 "\n", argv[0]);
         exit(1);
diff --git a/rpython/translator/revdb/src-revdb/revdb_include.h b/rpython/translator/revdb/src-revdb/revdb_include.h
--- a/rpython/translator/revdb/src-revdb/revdb_include.h
+++ b/rpython/translator/revdb/src-revdb/revdb_include.h
@@ -16,7 +16,8 @@
 #endif
     bool_t watch_enabled;
     int lock;
-    char *buf_p, *buf_limit, *buf_readend;
+    char *buf_p;  /* NULL during recording if recording is actually disabled */
+    char *buf_limit, *buf_readend;
     uint64_t stop_point_seen, stop_point_break;
     uint64_t unique_id_seen, unique_id_break;
 } rpy_revdb_t;
@@ -85,9 +86,13 @@
         {                                                               \
             decl_e = variable;                                          \
             _RPY_REVDB_PRINT("[ wr ]", _e);                             \
-            memcpy(rpy_revdb.buf_p, &_e, sizeof(_e));                   \
-            if ((rpy_revdb.buf_p += sizeof(_e)) > rpy_revdb.buf_limit)  \
-                rpy_reverse_db_flush();                                 \
+            char *_dst = rpy_revdb.buf_p;                               \
+            if (_dst) {                                                 \
+                memcpy(_dst, &_e, sizeof(_e));                          \
+                if ((rpy_revdb.buf_p = _dst + sizeof(_e))               \
+                        > rpy_revdb.buf_limit)                          \
+                    rpy_reverse_db_flush();                             \
+            }                                                           \
         }
 
 #define _RPY_REVDB_EMIT_REPLAY(decl_e, variable)                        \
@@ -179,6 +184,13 @@
             rpy_reverse_db_bad_acquire_gil("release");                  \
     }
 
+#define RPY_REVDB_C_ONLY_ENTER                                          \
+    char *saved_bufp = rpy_revdb.buf_p;                                 \
+    rpy_revdb.buf_p = NULL;
+
+#define RPY_REVDB_C_ONLY_LEAVE                                          \
+    rpy_revdb.buf_p = saved_bufp;
+
 #define RPY_REVDB_CALLBACKLOC(locnum)                                   \
     rpy_reverse_db_callback_loc(locnum)
 


More information about the pypy-commit mailing list