Author: Carl Friedrich Bolz-Tereick <cfb...@gmx.de> Branch: py3.6 Changeset: r97551:02f4b7934b7f Date: 2019-09-19 20:54 +0200 http://bitbucket.org/pypy/pypy/changeset/02f4b7934b7f/
Log: merge default diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -40,11 +40,11 @@ Armin Rigo Maciej Fijalkowski Carl Friedrich Bolz-Tereick + Matti Picus Antonio Cuni Amaury Forgeot d'Arc - Matti Picus + Ronan Lamy Samuele Pedroni - Ronan Lamy Alex Gaynor Philip Jenvey Richard Plangger @@ -94,6 +94,7 @@ Jason Creighton Mark Young Alex Martelli + Andrew Lawrence Spenser Bauman Michal Bendowski Jan de Mooij @@ -106,11 +107,11 @@ Stefan Schwarzer Tomek Meka Valentino Volonghi + Stefan Beyer Patrick Maupin Devin Jeanpierre Bob Ippolito Bruno Gola - Andrew Lawrence David Malcolm Squeaky Edd Barrett @@ -124,7 +125,6 @@ Wenzhu Man Konstantin Lopuhin John Witulski - Stefan Beyer Jeremy Thurgood Greg Price Ivan Sichmann Freitas @@ -138,6 +138,7 @@ Pavel Vinogradov William Leslie Paweł Piotr Przeradowski + Stian Andreassen marky1991 Ilya Osadchiy Tobias Oberstein @@ -146,14 +147,13 @@ Taavi Burns Adrian Kuhn tav - Stian Andreassen Georg Brandl Joannah Nanjekye + Julian Berman Bert Freudenberg Wanja Saatkamp Mike Blume Gerald Klix - Julian Berman Oscar Nierstrasz Rami Chowdhury Stefan H. Muller @@ -204,6 +204,7 @@ Andrews Medina Aaron Iles Toby Watson + Lin Cheng Daniel Patrick Stuart Williams Antoine Pitrou @@ -245,6 +246,7 @@ Valentina Mukhamedzhanova Stefano Parmesan touilleMan + Anthony Sottile Marc Abramowitz Arjun Naik Aaron Gallagher @@ -254,7 +256,6 @@ Omer Katz Jacek Generowicz Tomasz Dziopa - Lin Cheng Sylvain Thenault Jakub Stasiak Andrew Dalke @@ -285,7 +286,6 @@ Lene Wagner Tomo Cocoa Miro Hrončok - Anthony Sottile David Lievens Neil Blakey-Milner Henrik Vendelbo @@ -294,11 +294,14 @@ Christoph Gerum Miguel de Val Borro Artur Lisiecki + joserubiovida...@gmail.com afteryu Toni Mattis + Vincent Michel Laurens Van Houtven Bobby Impollonia Roberto De Ioris + Yannick Jadoul Jeong YunWon Christopher Armstrong Aaron Tubbs @@ -312,6 +315,7 @@ Fabio Niephaus Akira Li Gustavo Niemeyer + joachim-ballm...@bitbucket.org Nate Bragg Lucas Stadler roberto@goyle @@ -331,8 +335,12 @@ Ben Darnell Juan Francisco Cantero Hurtado Godefroid Chappelle + Paul Ganssle + Michal Kuffa Stephan Busemann + Bystroushaak Dan Colish + Ram Rachum timo Volodymyr Vladymyrov Daniel Neuhäuser @@ -342,18 +350,22 @@ Chris Lambacher John Aldis coolbutusel...@gmail.com + Yasen Kiprov Mike Bayer Rodrigo Araújo Daniil Yarancev Min RK OlivierBlanvillain + dakar...@gmail.com Jonas Pfannschmidt Zearin Johan Forsberg Andrey Churin Dan Crosta reub...@gmail.com + Ryan Hileman Stanisław Halik + DeVerne Jones Julien Phalip Roman Podoliaka Steve Papanik @@ -369,17 +381,20 @@ Jim Hunziker shoma hosaka Buck Golemon + whitequark Iraklis D. JohnDoe yrttyr Michael Chermside Anna Ravencroft remarkablerocket + Ivan Petre Vijiac Berker Peksag Christian Muirhead soareschen Matthew Miller + Jesdi Konrad Delong Dinu Gherman pizi @@ -398,13 +413,16 @@ Markus Unterwaditzer Kristoffer Kleine Graham Markall + paugier Dan Loewenherz werat Filip Salomonsson Niclas Olofsson + Zsolt Cserna Chris Pressey Tobias Diaz Paul Graydon + mkuffa Nikolaos-Digenis Karagiannis Kurt Griffiths Ben Mather 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.2' +version = '7.3' # The full version, including alpha/beta/rc tags. -release = '7.2.0' +release = '7.3.0' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -7,11 +7,11 @@ Armin Rigo Maciej Fijalkowski Carl Friedrich Bolz-Tereick + Matti Picus Antonio Cuni Amaury Forgeot d'Arc - Matti Picus + Ronan Lamy Samuele Pedroni - Ronan Lamy Alex Gaynor Philip Jenvey Richard Plangger @@ -61,6 +61,7 @@ Jason Creighton Mark Young Alex Martelli + Andrew Lawrence Spenser Bauman Michal Bendowski Jan de Mooij @@ -73,11 +74,11 @@ Stefan Schwarzer Tomek Meka Valentino Volonghi + Stefan Beyer Patrick Maupin Devin Jeanpierre Bob Ippolito Bruno Gola - Andrew Lawrence David Malcolm Squeaky Edd Barrett @@ -91,7 +92,6 @@ Wenzhu Man Konstantin Lopuhin John Witulski - Stefan Beyer Jeremy Thurgood Greg Price Ivan Sichmann Freitas @@ -105,6 +105,7 @@ Pavel Vinogradov William Leslie Paweł Piotr Przeradowski + Stian Andreassen marky1991 Ilya Osadchiy Tobias Oberstein @@ -113,14 +114,13 @@ Taavi Burns Adrian Kuhn tav - Stian Andreassen Georg Brandl Joannah Nanjekye + Julian Berman Bert Freudenberg Wanja Saatkamp Mike Blume Gerald Klix - Julian Berman Oscar Nierstrasz Rami Chowdhury Stefan H. Muller @@ -171,6 +171,7 @@ Andrews Medina Aaron Iles Toby Watson + Lin Cheng Daniel Patrick Stuart Williams Antoine Pitrou @@ -212,6 +213,7 @@ Valentina Mukhamedzhanova Stefano Parmesan touilleMan + Anthony Sottile Marc Abramowitz Arjun Naik Aaron Gallagher @@ -221,7 +223,6 @@ Omer Katz Jacek Generowicz Tomasz Dziopa - Lin Cheng Sylvain Thenault Jakub Stasiak Andrew Dalke @@ -261,11 +262,14 @@ Christoph Gerum Miguel de Val Borro Artur Lisiecki + joserubiovida...@gmail.com afteryu Toni Mattis + Vincent Michel Laurens Van Houtven Bobby Impollonia Roberto De Ioris + Yannick Jadoul Jeong YunWon Christopher Armstrong Aaron Tubbs @@ -279,6 +283,7 @@ Fabio Niephaus Akira Li Gustavo Niemeyer + joachim-ballm...@bitbucket.org Nate Bragg Lucas Stadler roberto@goyle @@ -298,8 +303,12 @@ Ben Darnell Juan Francisco Cantero Hurtado Godefroid Chappelle + Paul Ganssle + Michal Kuffa Stephan Busemann + Bystroushaak Dan Colish + Ram Rachum timo Volodymyr Vladymyrov Daniel Neuhäuser @@ -309,18 +318,22 @@ Chris Lambacher John Aldis coolbutusel...@gmail.com + Yasen Kiprov Mike Bayer Rodrigo Araújo Daniil Yarancev Min RK OlivierBlanvillain + dakar...@gmail.com Jonas Pfannschmidt Zearin Johan Forsberg Andrey Churin Dan Crosta reub...@gmail.com + Ryan Hileman Stanisław Halik + DeVerne Jones Julien Phalip Roman Podoliaka Steve Papanik @@ -336,17 +349,20 @@ Jim Hunziker shoma hosaka Buck Golemon + whitequark Iraklis D. JohnDoe yrttyr Michael Chermside Anna Ravencroft remarkablerocket + Ivan Petre Vijiac Berker Peksag Christian Muirhead soareschen Matthew Miller + Jesdi Konrad Delong Dinu Gherman pizi @@ -365,13 +381,16 @@ Markus Unterwaditzer Kristoffer Kleine Graham Markall + paugier Dan Loewenherz werat Filip Salomonsson Niclas Olofsson + Zsolt Cserna Chris Pressey Tobias Diaz Paul Graydon + mkuffa Nikolaos-Digenis Karagiannis Kurt Griffiths Ben Mather 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.2.0.rst release-v7.1.1.rst release-v7.1.0.rst release-v7.0.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.2.0.rst whatsnew-pypy2-7.1.0.rst whatsnew-pypy2-7.0.0.rst whatsnew-pypy2-6.0.0.rst @@ -37,12 +38,17 @@ whatsnew-1.9.rst +CPython 3.6 compatible versions +------------------------------- + +.. toctree:: + whatsnew-pypy3-head.rst + CPython 3.5 compatible versions ------------------------------- .. toctree:: - whatsnew-pypy3-head.rst whatsnew-pypy3-7.0.0.rst whatsnew-pypy3-5.9.0.rst whatsnew-pypy3-5.8.0.rst diff --git a/pypy/doc/release-v7.2.0.rst b/pypy/doc/release-v7.2.0.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/release-v7.2.0.rst @@ -0,0 +1,270 @@ +==================================== +PyPy v7.2.0: release of 2.7, and 3.6 +==================================== + +The PyPy team is proud to release the version 7.2.0 of PyPy, which includes +two different interpreters: + + - PyPy2.7, which is an interpreter supporting the syntax and the features of + Python 2.7 including the stdlib for CPython 2.7.13 + + - PyPy3.6: which is an interpreter supporting the syntax and the features of + Python 3.6, including the stdlib for CPython 3.6.9. + +The interpreters are based on much the same codebase, thus the double +release. + +This release removes the "beta" tag from PyPy3.6. While there may still be some +small corner-case incompatibilities (around the exact error messages in +exceptions and the handling of faulty codec errorhandlers) we are happy with +the quality of the 3.6 series and are looking forward to working on a Python +3.7 interpreter. + +With the support of the ARM foundation, this release supports the 64-bit +``aarch64`` ARM architecture. + +We updated our benchmark runner at https://speed.pypy.org to a more modern +machine and updated the baseline python to CPython 2.7.11. Thanks to `Baroque +Software` for maintaining the benchmark runner. + +The CFFI-based ``_ssl`` module was backported to PyPy2.7 and updated to use +`cryptography`_ version 2.7. Additionally the `_hashlib`, and ``crypt`` (or +``_crypt`` on Python3) modules were converted to CFFI. This has two +consequences. End users and packagers can more easily update these libraries +for their platform by executing ``(cd lib_pypy; ../bin/pypy _*_build.py)``. +More significantly, since PyPy itself links to fewer system shared objects +(DLLs), on platforms with a single runtime namespace like linux different CFFI +and c-extension modules can load different versions of the same shared object +into PyPy without collision (`issue 2617`_). + +Until downstream providers begin to distribute c-extension builds with PyPy, we +have made packages for some common packages `available as wheels`_. + +The `CFFI`_ backend has been updated to version 1.13.0. We recommend using CFFI +rather than c-extensions to interact with C, and `cppyy`_ for interacting with +C++ code. + +Thanks to Anvil_, we revived the `PyPy Sandbox`_, which allows total control +over a python interpreter's interactions with the external world. + +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. Many of the fixes are the direct result of +end-user bug reports, so please continue reporting issues as they crop up. + +You can download the v7.2 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. Since the +previous release, we have accepted contributions from 27 new contributors, +thanks for pitching in. + +.. _`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 +.. _`Baroque Software`: https://baroquesoftware.com +.. _Anvil: https://anvil.works +.. _`PyPy Sandbox`: https://morepypy.blogspot.com/2019/08 + +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. + +This 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 + + * 64-bit **ARM** machines 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 (32 +bit), although PyPy does support ARM 32 bit processors. + +.. _`PyPy and CPython 2.7.x`: http://speed.pypy.org +.. _`dynamic languages`: http://rpython.readthedocs.io/en/latest/examples.html + + +Changelog +========= + +Changes released in v7.1.1 +-------------------------- + +* Improve performance of ``u''.append`` +* Prevent a crash in ``zlib`` when flushing a closed stream +* Fix a few corner cases when encountering unicode values above 0x110000 +* Teach the JIT how to handle very large constant lists, sets, or dicts +* Fix building on ARM32 (`issue 2984`_) +* Fix a bug in register assignment in ARM32 +* Package windows DLLs needed by cffi modules next to the cffi c-extensions + (`issue 2988`_) +* Cleanup and refactor JIT code to remove ``rpython.jit.metainterp.typesystem`` +* Fix memoryviews of ctype structures with padding, (cpython issue 32780_) + +Changes to Python 3.6 released in v7.1.1 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* On win32, override some ``errno.E*`` values that were added to MSVC in v2010 + so that ``errno.E* == errno.WSAE*`` as in CPython +* Do the same optimization that CPython does for ``(1, 2, 3, *a)`` (but at the + AST level) +* Raise a ``TypeError`` when using buffers and unicode such as ``''.strip(buffer)`` + and ``'a' < buffer`` +* Support ``_overlapped`` and asyncio on win32 +* Fix an issue where ``''.join(list_of_strings)`` would rarely confuse utf8 and + bytes (`issue 2997`_) +* Fix ``io.IncrementalNewlineDecoder`` interaction with ``\r`` (`issue 3012`_) + +Changes shared across versions +------------------------------ + +* Update ``cffi`` to 1.13.0 +* Add support for ARM aarch64 +* Many internal changes to the utf-8 processing code, since now unicode strings + are stored internally as utf-8. A few corner cases were fixed, and performance + bottlenecks were improved. Specifically, issues were fixed with ``maketrans``, + ``strip``, comparison with ``bytearray``, use in ``array.array``, ``join``, + ``translate``, forrmatting, ``__int__``, ``str(<int>)``, ``startswith``, + ``endswith``, +* Reduce the probability of a deadlock when acquiring a semaphore by + moving global state changes closer to the actual aquire (`issue 2953`_) +* Cleanup and refactor parts of the JIT code +* Cleanup ``optimizeopt`` +* Support the ``z15`` variant of the ``s390x`` CPU. +* Fixes to ``_ctypes`` handling of memoryviews +* Fix a shadowstack overflow when using ``sys.setrecurtionlimit`` (`issue 2722`) +* Fix a bug that prevent memory-tracking in vmprof working on PyPy +* Improve the speed and memory use of the ``_pypyjson`` JSON decoder. The + resulting dictionaries that come out of the JSON decoder have faster lookups too +* ``struct.unpack`` of a sliced ``bytearray`` exposed a subtle bug where the + JIT's ``gc_load`` family of calls must force some lazy code (`issue 3014`_) +* Remove ``copystrcontent`` and ``copyunicodecontent`` in the backends. + Instead, replace it in ``rewrite.py`` with a direct call to ``memcpy()`` and + a new basic operation, ``load_effective_address``, which the backend can + even decide not to implement. +* Allow 2d indexing in ``memoryview.__setitem__`` (`issue 3028`_) +* Speed up 'bytearray += bytes' and other similar combinations +* Compute the greatest common divisor of two RPython ``rbigint`` instances + using `Lehmer's algorithm`_ and use it in the ``math`` module +* Add ``RFile.closed`` to mirror standard `file` behaviour +* Add a ``-D`` pytest option to run tests directly on the host python without + any knowlege of PyPy internals. This allows using ``pypy3 pytest.py ...`` + for a subset of tests (called **app-level testing**) +* Accept arguments to ``subprocess.Popen`` that are not directly subscriptable + (like iterators) (`issue 3050`_) +* Catch more low-level ``SocketError`` exceptions and turn them into app-level + exceptions (`issue 3049`_) +* Fix formatting of a ``memoryview``: ``b"<%s>" % memoryview(b"X")`` +* Correctly wrap the I/O errors we can get when importing modules +* Fix bad output from JSON with ``'skipkeys=True'`` (`issue 3052`_) +* Fix compatibility with latest virtualenv HEAD + +C-API (cpyext) and c-extensions +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +* Add ``DateTime_FromTimestamp`` and ``Date_FromTimestamp`` to the + ``PyDateTime_CAPI`` struct + +* Add constants and macros needed to build opencv2_ with PyPy2.7 +* Add more constants to `sysconfig``. Set ``MACOSX_DEPLOYMENT_TARGET`` for + darwin (`issue 2994`_) +* fix ``CBuffer.buffer_attach`` + +Python 3.6 only +--------------- + +* Accept ``a, b = (*x, 2)`` (`issue 2995`_) +* Class methods with the signature ``def meth(*args, **kwargs)`` were not adding + an implied ``self`` argument (`issue 2996`_) +* Fix handling of ``__fpath__`` (`issue 2985`_) +* Disable ``assert`` when run with ``-O`` (`issue 3000`_) +* ``codecs.encode``, ``codecs.decode`` can behave differently than + ``ustr.encode``, ``bytes.decode`` (`issue 3001`_) +* Putting ``pdb.set_trace`` call in a threaded program did not work (`issue + 3003`_) +* Fix parsing for converting strings with underscore into ints +* Add ``memoryview.obj`` which stores a reference, (`issue 3016`_) +* Fix datetime.fromtimestamp for win32 (cpython issue 29097_) +* Improve multiprocessing support on win32 +* Support negative offsets in ``lnotab`` (`issue 2943`_) +* Fix leak of file descriptor with `_io.FileIO('dir/')` +* Fix ``float.__round__(None)`` (`issue 3033`_) +* Fix for when we should use the Universal Newline mode on Windows for + stdin/stdout/stderr (`issue 3007`_) +* Fix ImportError invalid arguments error wording +* Ignore GeneratorExit when throwing into the aclose coroutine of an + asynchronous generator (CPython issue 35409_) +* Improve the pure-python ``faulthander`` module +* Properly raise an exception when a ``BlockingIOError`` exception escapes + from ``W_BufferedReader.readline_w()`` (`issue 3042`_) +* Fix a code path only used in ``zipimport`` (`issue 3034`_) +* Update the stdlib to 3.6.9, fix many failing tests +* Fix handling of ``__debug__``, ``-O``, and ``sys.flags.optimizeOptimize`` + (CPython issue 27169_) +* Fix raising ``SystemExit`` in ``atexit`` +* Fix case where ``int(<subint>)`` would go into infinite recursion +* Don't ignore fold parameter in ``(date,)time.replace()`` +* Fix logic bug for ``memoryview.cast`` (when ``view.format`` is not ``'B'``) + +Python 3.6 c-API +~~~~~~~~~~~~~~~~ + +* Add ``PyStructSequence_InitType2``, ``Py_RETURN_NOTIMPLEMENTED``, + ``PyGILState_Check``, ``PyUnicode_AsUCS4``, ``PyUnicode_AsUCS4Copy`` +* Sync the various ``Py**Flag`` constants with CPython + +.. _`Lehmer's algorithm`: https://en.wikipedia.org/wiki/Lehmer's_GCD_algorithm +.. _29097: https://bugs.python.org/issue29097 +.. _32780: https://bugs.python.org/issue32780 +.. _35409 : https://bugs.python.org/issue35409 +.. _27169 : https://bugs.python.org/issue27169 +.. _opencv2: https://github.com/skvark/opencv-python/ +.. _`issue 2617`: https://bitbucket.com/pypy/pypy/issues/2617 +.. _`issue 2722`: https://bitbucket.com/pypy/pypy/issues/2722 +.. _`issue 2953`: https://bitbucket.com/pypy/pypy/issues/2953 +.. _`issue 2943`: https://bitbucket.com/pypy/pypy/issues/2943 +.. _`issue 2980`: https://bitbucket.com/pypy/pypy/issues/2980 +.. _`issue 2984`: https://bitbucket.com/pypy/pypy/issues/2984 +.. _`issue 2994`: https://bitbucket.com/pypy/pypy/issues/2994 +.. _`issue 2995`: https://bitbucket.com/pypy/pypy/issues/2995 +.. _`issue 2996`: https://bitbucket.com/pypy/pypy/issues/2995 +.. _`issue 2997`: https://bitbucket.com/pypy/pypy/issues/2995 +.. _`issue 2988`: https://bitbucket.com/pypy/pypy/issues/2988 +.. _`issue 2985`: https://bitbucket.com/pypy/pypy/issues/2985 +.. _`issue 2986`: https://bitbucket.com/pypy/pypy/issues/2986 +.. _`issue 3000`: https://bitbucket.com/pypy/pypy/issues/3000 +.. _`issue 3001`: https://bitbucket.com/pypy/pypy/issues/3001 +.. _`issue 3003`: https://bitbucket.com/pypy/pypy/issues/3003 +.. _`issue 3007`: https://bitbucket.com/pypy/pypy/issues/3007 +.. _`issue 3012`: https://bitbucket.com/pypy/pypy/issues/3012 +.. _`issue 3014`: https://bitbucket.com/pypy/pypy/issues/3014 +.. _`issue 3016`: https://bitbucket.com/pypy/pypy/issues/3016 +.. _`issue 3028`: https://bitbucket.com/pypy/pypy/issues/3028 +.. _`issue 3033`: https://bitbucket.com/pypy/pypy/issues/3033 +.. _`issue 3034`: https://bitbucket.com/pypy/pypy/issues/3034 +.. _`issue 3042`: https://bitbucket.com/pypy/pypy/issues/3042 +.. _`issue 3049`: https://bitbucket.com/pypy/pypy/issues/3049 +.. _`issue 3050`: https://bitbucket.com/pypy/pypy/issues/3050 +.. _`issue 3052`: https://bitbucket.com/pypy/pypy/issues/3052 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,84 +1,7 @@ ========================== -What's new in PyPy2.7 7.1+ +What's new in PyPy2.7 7.3+ ========================== -.. this is a revision shortly after release-pypy-7.1.0 -.. startrev: d3aefbf6dae7 +.. this is a revision shortly after release-pypy-7.2.0 +.. startrev: 78cd4acbcbec -.. branch: Twirrim/minor-typo-fix-1553456951526 - -Fix typo - -.. branch: jit-cleanup - -Remove rpython.jit.metainterp.typesystem and clean up related code in rpython/jit/ - -.. branch: datetime_api_27 - -Add ``DateTime_FromTimestamp`` and ``Date_FromTimestamp`` - -.. branch: issue2968 - -Fix segfault in cpyext_tp_new_tupl - -.. branch: semlock-deadlock - -Test and reduce the probability of a deadlock when acquiring a semaphore by -moving global state changes closer to the actual aquire. - -.. branch: shadowstack-issue2722 - -Make the shadowstack size more dynamic - -.. branch: cffi-libs - -Move _ssl and _hashlib from rpython to a cffi-based module, like on python3. -Reduces the number of problematic linked-in libraries (libssl, libcrypto) - -.. branch: fix-vmprof-memory-tracking - -Fix a bug that prevent memory-tracking in vmprof working on PyPy. - -.. branch: optimizeopt-cleanup - -Cleanup optimizeopt - -.. branch: copystrcontents-in-rewrite - -Remove ``copystrcontent`` and ``copyunicodecontent`` in the backends. -Instead, replace it in ``rewrite.py`` with a direct call to ``memcpy()`` and -new basic operation, ``load_effective_address``, which the backend can -even decide not to implement. - -.. branch: arm64 - -Add a JIT backend for ARM64 (aarch64) - -.. branch: fix-test-vmprof-closed-file - - -.. branch: fix_darwin_list_dir_test - -.. branch: apptest-file - -New mechanism for app-level testing using -D to test all apptest_*.py files - -.. branch: feature_closed_prop_to_rfile - -Add RFile.closed - -.. branch: cryptograhpt-2.7 - -Update vendored cryptography used for _ssl to 2.7 - -.. branch: compile_ncurses_tcl_tk_suse_latest - -Check for headers and runtime libraries in more locations to support other linuxes - -.. branch: openssl-for-macos - -Update _ssl on macos to statically link to openssl-1.1.1c - -.. branch: more-cpyext - -Add more datetime C functions and definitions diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-pypy2-7.2.0.rst copy from pypy/doc/whatsnew-head.rst copy to pypy/doc/whatsnew-pypy2-7.2.0.rst --- a/pypy/doc/whatsnew-head.rst +++ b/pypy/doc/whatsnew-pypy2-7.2.0.rst @@ -1,6 +1,6 @@ -========================== -What's new in PyPy2.7 7.1+ -========================== +=========================== +What's new in PyPy2.7 7.2.0 +=========================== .. this is a revision shortly after release-pypy-7.1.0 .. startrev: d3aefbf6dae7 diff --git a/pypy/interpreter/astcompiler/astbuilder.py b/pypy/interpreter/astcompiler/astbuilder.py --- a/pypy/interpreter/astcompiler/astbuilder.py +++ b/pypy/interpreter/astcompiler/astbuilder.py @@ -118,7 +118,8 @@ def error(self, msg, n): """Raise a SyntaxError with the lineno and column set to n's.""" raise SyntaxError(msg, n.get_lineno(), n.get_column(), - filename=self.compile_info.filename) + filename=self.compile_info.filename, + text=n.get_line()) def error_ast(self, msg, ast_node): raise SyntaxError(msg, ast_node.lineno, ast_node.col_offset, diff --git a/pypy/interpreter/astcompiler/test/test_astbuilder.py b/pypy/interpreter/astcompiler/test/test_astbuilder.py --- a/pypy/interpreter/astcompiler/test/test_astbuilder.py +++ b/pypy/interpreter/astcompiler/test/test_astbuilder.py @@ -2,7 +2,7 @@ import random import string import sys -import py +import pytest from pypy.interpreter.baseobjspace import W_Root from pypy.interpreter.pyparser import pyparse from pypy.interpreter.pyparser.error import SyntaxError @@ -135,7 +135,9 @@ assert a1.asname is None assert a2.name == "y" assert a2.asname == "w" - exc = py.test.raises(SyntaxError, self.get_ast, "import x a b").value + with pytest.raises(SyntaxError) as excinfo: + self.get_ast("import x a b") + assert excinfo.value.text == "import x a b\n" def test_from_import(self): im = self.get_first_stmt("from x import y") @@ -180,12 +182,18 @@ assert a1.asname == "b" assert a2.name == "w" assert a2.asname is None + input = "from x import y a b" - exc = py.test.raises(SyntaxError, self.get_ast, input).value + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) + assert excinfo.value.text == input + "\n" + input = "from x import a, b," - exc = py.test.raises(SyntaxError, self.get_ast, input).value - assert exc.msg == "trailing comma is only allowed with surronding " \ + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) + assert excinfo.value.msg == "trailing comma is only allowed with surronding " \ "parenthesis" + assert excinfo.value.text == input + "\n" def test_global(self): glob = self.get_first_stmt("global x") @@ -418,7 +426,8 @@ assert wi.items[0].optional_vars.ctx == ast.Store assert wi.items[0].optional_vars.elts[0].ctx == ast.Store input = "with x hi y: pass" - exc = py.test.raises(SyntaxError, self.get_ast, input).value + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) wi = self.get_first_stmt("with x as y, b: pass") assert isinstance(wi, ast.With) assert len(wi.items) == 2 @@ -508,8 +517,13 @@ assert args.vararg.arg == "e" assert args.kwarg.arg == "f" input = "def f(a=b, c): pass" - exc = py.test.raises(SyntaxError, self.get_ast, input).value - assert exc.msg == "non-default argument follows default argument" + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) + assert excinfo.value.msg == "non-default argument follows default argument" + input = "def f((x)=23): pass" + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) + assert excinfo.value.msg == "invalid syntax" def test_kwonly_arguments(self): fn = self.get_first_stmt("def f(a, b, c, *, kwarg): pass") @@ -532,7 +546,7 @@ assert len(fn.args.kw_defaults) == 1 assert isinstance(fn.args.kw_defaults[0], ast.Num) input = "def f(p1, *, **k1): pass" - exc = py.test.raises(SyntaxError, self.get_ast, input).value + exc = pytest.raises(SyntaxError, self.get_ast, input).value assert exc.msg == "named arguments must follows bare *" def test_function_annotation(self): @@ -556,13 +570,13 @@ for i in range(255): fundef += "i%d, "%i fundef += "*, key=100):\n pass\n" - py.test.raises(SyntaxError, self.get_first_stmt, fundef) + pytest.raises(SyntaxError, self.get_first_stmt, fundef) fundef2 = "def foo(i,*," for i in range(255): fundef2 += "i%d, "%i fundef2 += "lastarg):\n pass\n" - py.test.raises(SyntaxError, self.get_first_stmt, fundef) + pytest.raises(SyntaxError, self.get_first_stmt, fundef) fundef3 = "def f(i,*," for i in range(253): @@ -642,13 +656,13 @@ assert isinstance(subscript, ast.AnnAssign) assert isinstance(subscript.target, ast.Subscript) - exc_tuple = py.test.raises(SyntaxError, self.get_ast, 'a, b: int').value + exc_tuple = pytest.raises(SyntaxError, self.get_ast, 'a, b: int').value assert exc_tuple.msg == "only single target (not tuple) can be annotated" - exc_list = py.test.raises(SyntaxError, self.get_ast, '[]: int').value + exc_list = pytest.raises(SyntaxError, self.get_ast, '[]: int').value assert exc_list.msg == "only single target (not list) can be annotated" - exc_bad_target = py.test.raises(SyntaxError, self.get_ast, '{}: int').value + exc_bad_target = pytest.raises(SyntaxError, self.get_ast, '{}: int').value assert exc_bad_target.msg == "illegal target for annoation" @@ -824,8 +838,9 @@ for ctx_type, template in test_contexts: for expr, type_str in invalid_stores: input = template % (expr,) - exc = py.test.raises(SyntaxError, self.get_ast, input).value - assert exc.msg == "can't %s %s" % (ctx_type, type_str) + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) + assert excinfo.value.msg == "can't %s %s" % (ctx_type, type_str) def test_assignment_to_forbidden_names(self): invalid = ( @@ -848,8 +863,9 @@ for name in "__debug__",: for template in invalid: input = template % (name,) - exc = py.test.raises(SyntaxError, self.get_ast, input).value - assert exc.msg == "cannot assign to %s" % (name,) + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) + assert excinfo.value.msg == "cannot assign to %s" % (name,) def test_lambda(self): lam = self.get_first_expr("lambda x: expr") @@ -870,8 +886,9 @@ assert len(lam.args.defaults) == 1 assert isinstance(lam.args.defaults[0], ast.Name) input = "f(lambda x: x[0] = y)" - exc = py.test.raises(SyntaxError, self.get_ast, input).value - assert exc.msg == "lambda cannot contain assignment" + with pytest.raises(SyntaxError) as excinfo: + self.get_ast(input) + assert excinfo.value.msg == "lambda cannot contain assignment" def test_ifexp(self): ifexp = self.get_first_expr("x if y else g") @@ -939,7 +956,7 @@ def test_flufl(self): source = "x <> y" - py.test.raises(SyntaxError, self.get_ast, source) + pytest.raises(SyntaxError, self.get_ast, source) comp = self.get_first_expr(source, flags=consts.CO_FUTURE_BARRY_AS_BDFL) assert isinstance(comp, ast.Compare) @@ -1053,16 +1070,16 @@ assert len(call.args) == 1 assert isinstance(call.args[0], ast.GeneratorExp) input = "f(x for x in y, 1)" - exc = py.test.raises(SyntaxError, self.get_ast, input).value + exc = pytest.raises(SyntaxError, self.get_ast, input).value assert exc.msg == "Generator expression must be parenthesized if not " \ "sole argument" many_args = ", ".join("x%i" % i for i in range(256)) input = "f(%s)" % (many_args,) - exc = py.test.raises(SyntaxError, self.get_ast, input).value + exc = pytest.raises(SyntaxError, self.get_ast, input).value assert exc.msg == "more than 255 arguments" - exc = py.test.raises(SyntaxError, self.get_ast, "f((a+b)=c)").value + exc = pytest.raises(SyntaxError, self.get_ast, "f((a+b)=c)").value assert exc.msg == "keyword can't be an expression" - exc = py.test.raises(SyntaxError, self.get_ast, "f(a=c, a=d)").value + exc = pytest.raises(SyntaxError, self.get_ast, "f(a=c, a=d)").value assert exc.msg == "keyword argument repeated" def test_attribute(self): @@ -1167,7 +1184,7 @@ s = self.get_first_expr("b'hi' b' implicitly' b' extra'") assert isinstance(s, ast.Bytes) assert space.eq_w(s.s, space.newbytes("hi implicitly extra")) - py.test.raises(SyntaxError, self.get_first_expr, "b'hello' 'world'") + pytest.raises(SyntaxError, self.get_first_expr, "b'hello' 'world'") sentence = u"Die Männer ärgern sich!" source = u"# coding: utf-7\nstuff = '%s'" % (sentence,) info = pyparse.CompileInfo("<test>", "exec") @@ -1258,15 +1275,15 @@ for num in ("0b00101", "0B00101", "0b101", "0B101"): assert space.eq_w(get_num(num), space.wrap(5)) - py.test.raises(SyntaxError, self.get_ast, "0x") - py.test.raises(SyntaxError, self.get_ast, "0b") - py.test.raises(SyntaxError, self.get_ast, "0o") - py.test.raises(SyntaxError, self.get_ast, "32L") - py.test.raises(SyntaxError, self.get_ast, "32l") - py.test.raises(SyntaxError, self.get_ast, "0L") - py.test.raises(SyntaxError, self.get_ast, "-0xAAAAAAL") - py.test.raises(SyntaxError, self.get_ast, "053") - py.test.raises(SyntaxError, self.get_ast, "00053") + pytest.raises(SyntaxError, self.get_ast, "0x") + pytest.raises(SyntaxError, self.get_ast, "0b") + pytest.raises(SyntaxError, self.get_ast, "0o") + pytest.raises(SyntaxError, self.get_ast, "32L") + pytest.raises(SyntaxError, self.get_ast, "32l") + pytest.raises(SyntaxError, self.get_ast, "0L") + pytest.raises(SyntaxError, self.get_ast, "-0xAAAAAAL") + pytest.raises(SyntaxError, self.get_ast, "053") + pytest.raises(SyntaxError, self.get_ast, "00053") def check_comprehension(self, brackets, ast_type): def brack(s): @@ -1362,8 +1379,8 @@ assert isinstance(if2, ast.Name) def test_cpython_issue12983(self): - py.test.raises(SyntaxError, self.get_ast, r"""b'\x'""") - py.test.raises(SyntaxError, self.get_ast, r"""b'\x0'""") + pytest.raises(SyntaxError, self.get_ast, r"""b'\x'""") + pytest.raises(SyntaxError, self.get_ast, r"""b'\x0'""") def test_matmul(self): mod = self.get_ast("a @ b") @@ -1461,17 +1478,17 @@ def test_decode_error_in_string_literal(self): input = "u'\\x'" - exc = py.test.raises(SyntaxError, self.get_ast, input).value + exc = pytest.raises(SyntaxError, self.get_ast, input).value assert exc.msg == ("(unicode error) 'unicodeescape' codec can't decode" " bytes in position 0-1: truncated \\xXX escape") input = "u'\\x1'" - exc = py.test.raises(SyntaxError, self.get_ast, input).value + exc = pytest.raises(SyntaxError, self.get_ast, input).value assert exc.msg == ("(unicode error) 'unicodeescape' codec can't decode" " bytes in position 0-2: truncated \\xXX escape") def test_decode_error_in_string_literal_correct_line(self): input = "u'a' u'b'\\\n u'c' u'\\x'" - exc = py.test.raises(SyntaxError, self.get_ast, input).value + exc = pytest.raises(SyntaxError, self.get_ast, input).value assert exc.msg == ("(unicode error) 'unicodeescape' codec can't decode" " bytes in position 0-1: truncated \\xXX escape") assert exc.lineno == 2 diff --git a/pypy/interpreter/pyparser/parser.py b/pypy/interpreter/pyparser/parser.py --- a/pypy/interpreter/pyparser/parser.py +++ b/pypy/interpreter/pyparser/parser.py @@ -136,19 +136,24 @@ def get_column(self): raise NotImplementedError("abstract base class") + def get_line(self): + raise NotImplementedError("abstract base class") + class Terminal(Node): - __slots__ = ("value", "lineno", "column") - def __init__(self, type, value, lineno, column): + __slots__ = ("value", "lineno", "column", "line") + def __init__(self, type, value, lineno, column, line=None): Node.__init__(self, type) self.value = value self.lineno = lineno self.column = column + self.line = line @staticmethod def fromtoken(token): return Terminal( - token.token_type, token.value, token.lineno, token.column) + token.token_type, token.value, token.lineno, token.column, + token.line) def __repr__(self): return "Terminal(type=%s, value=%r)" % (self.type, self.value) @@ -168,6 +173,8 @@ def get_column(self): return self.column + def get_line(self): + return self.line class AbstractNonterminal(Node): __slots__ = () @@ -178,6 +185,9 @@ def get_column(self): return self.get_child(0).get_column() + def get_line(self): + return self.get_child(0).get_line() + def __eq__(self, other): # For tests. # grumble, annoying diff --git a/pypy/interpreter/pyparser/test/test_parser.py b/pypy/interpreter/pyparser/test/test_parser.py --- a/pypy/interpreter/pyparser/test/test_parser.py +++ b/pypy/interpreter/pyparser/test/test_parser.py @@ -330,3 +330,13 @@ info = py.test.raises(parser.ParseError, p.parse, "if 42 42") info.value.expected_str == '+' + + def test_line_attached_to_terminal(self): + p, gram = self.parser_for( + "foo: 'if' NUMBER '+' NUMBER" + ) + input = "if 53 + 65" + tree = p.parse(input) + assert tree.get_child(0).line == input + "\n" + assert tree.get_line() == input + "\n" + 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.2.0-alpha0" -#define PYPY_VERSION_NUM 0x07020000 +#define PYPY_VERSION "7.3.0-alpha0" +#define PYPY_VERSION_NUM 0x07030000 /* 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, 2, 0, "alpha", 0) +PYPY_VERSION = (7, 3, 0, "alpha", 0) import pypy diff --git a/rpython/rlib/rutf8.py b/rpython/rlib/rutf8.py --- a/rpython/rlib/rutf8.py +++ b/rpython/rlib/rutf8.py @@ -438,18 +438,7 @@ return result def has_surrogates(utf8): - # a surrogate starts with 0xed in utf-8 encoding - pos = 0 - while True: - pos = utf8.find("\xed", pos) - if pos < 0: - return False - assert pos <= len(utf8) - 1 # otherwise invalid utf-8 - ordch2 = ord(utf8[pos + 1]) - if _invalid_byte_2_of_3(0xed, ordch2, allow_surrogates=False): - return True - pos += 1 - return False + return surrogate_in_utf8(utf8) >= 0 def reencode_utf8_with_surrogates(utf8): """ Receiving valid UTF8 which contains surrogates, combine surrogate @@ -498,13 +487,22 @@ @jit.elidable -def surrogate_in_utf8(value): +def surrogate_in_utf8(utf8): """Check if the UTF-8 byte string 'value' contains a surrogate. The 'value' argument must be otherwise correctly formed for UTF-8. + Returns the position of the first surrogate, otherwise -1. """ - for i in range(len(value) - 2): - if value[i] == '\xed' and value[i + 1] >= '\xa0': - return i + # a surrogate starts with 0xed in utf-8 encoding + pos = 0 + while True: + pos = utf8.find("\xed", pos) + if pos < 0: + return -1 + assert pos <= len(utf8) - 1 # otherwise invalid utf-8 + ordch2 = ord(utf8[pos + 1]) + if _invalid_byte_2_of_3(0xed, ordch2, allow_surrogates=False): + return pos + pos += 1 return -1 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit