Author: Ronan Lamy <ronan.l...@gmail.com> Branch: py3k Changeset: r85040:ba87481c5e04 Date: 2016-06-08 19:26 +0100 http://bitbucket.org/pypy/pypy/changeset/ba87481c5e04/
Log: hg merge default diff too long, truncating to 2000 out of 3831 lines diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -25,3 +25,4 @@ 80ef432a32d9baa4b3c5a54c215e8ebe499f6374 release-5.1.2 40497617ae91caa1a394d8be6f9cd2de31cb0628 release-pypy3.3-v5.2 40497617ae91caa1a394d8be6f9cd2de31cb0628 release-pypy3.3-v5.2 +c09c19272c990a0611b17569a0085ad1ab00c8ff release-pypy2.7-v5.3 diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -43,17 +43,17 @@ Samuele Pedroni Matti Picus Alex Gaynor + Philip Jenvey Brian Kearns - Philip Jenvey + Ronan Lamy Michael Hudson - Ronan Lamy + Manuel Jacob David Schneider - Manuel Jacob Holger Krekel Christian Tismer Hakan Ardo + Richard Plangger Benjamin Peterson - Richard Plangger Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen @@ -93,9 +93,9 @@ stian Jan de Mooij Tyler Wade + Vincent Legoll Michael Foord Stephan Diehl - Vincent Legoll Stefan Schwarzer Valentino Volonghi Tomek Meka @@ -104,17 +104,20 @@ Bruno Gola David Malcolm Jean-Paul Calderone + Mark Young Timo Paulssen Squeaky + Devin Jeanpierre Marius Gedminas Alexandre Fayolle Simon Burton + Stefano Rivera Martin Matusiak Konstantin Lopuhin - Stefano Rivera Wenzhu Man John Witulski Laurence Tratt + Raffael Tfirst Ivan Sichmann Freitas Greg Price Dario Bertini @@ -122,13 +125,13 @@ Simon Cross Edd Barrett Andreas Stührk + Tobias Pape Jean-Philippe St. Pierre Guido van Rossum Pavel Vinogradov Spenser Bauman Jeremy Thurgood Paweł Piotr Przeradowski - Tobias Pape Paul deGrandis Ilya Osadchiy marky1991 @@ -140,7 +143,6 @@ Georg Brandl Bert Freudenberg Stian Andreassen - Mark Young Wanja Saatkamp Gerald Klix Mike Blume @@ -156,11 +158,13 @@ Dusty Phillips Lukas Renggli Guenter Jantzen + William Leslie Ned Batchelder Tim Felgentreff Anton Gulenko Amit Regmi Ben Young + Sergey Matyunin Nicolas Chauvat Andrew Durdin Andrew Chambers @@ -171,9 +175,9 @@ Yichao Yu Rocco Moretti Gintautas Miliauskas - Devin Jeanpierre Michael Twomey Lucian Branescu Mihaila + anatoly techtonik Gabriel Lavoie Olivier Dormond Jared Grubb @@ -183,8 +187,6 @@ Brian Dorsey Victor Stinner Andrews Medina - anatoly techtonik - Sergey Matyunin Stuart Williams Jasper Schulz Christian Hudon @@ -208,11 +210,11 @@ Alex Perry Vaibhav Sood Alan McIntyre - William Leslie Alexander Sedov Attila Gobi Jasper.Schulz Christopher Pope + Florin Papa Christian Tismer Marc Abramowitz Dan Stromberg @@ -228,7 +230,6 @@ Lukas Vacek Kunal Grover Andrew Dalke - Florin Papa Sylvain Thenault Jakub Stasiak Nathan Taylor @@ -270,8 +271,9 @@ Yury V. Zaytsev Anna Katrina Dominguez Bobby Impollonia - t...@eistee.fritz.box + Vasantha Ganesh K Andrew Thompson + florinpapa Yusei Tahara Aaron Tubbs Ben Darnell @@ -295,9 +297,9 @@ Akira Li Gustavo Niemeyer Stephan Busemann - florinpapa Rafał Gałczyński Matt Bogosian + timo Christian Muirhead Berker Peksag James Lan diff --git a/lib_pypy/cffi.egg-info/PKG-INFO b/lib_pypy/cffi.egg-info/PKG-INFO --- a/lib_pypy/cffi.egg-info/PKG-INFO +++ b/lib_pypy/cffi.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: cffi -Version: 1.6.0 +Version: 1.7.0 Summary: Foreign Function Interface for Python calling C code. Home-page: http://cffi.readthedocs.org Author: Armin Rigo, Maciej Fijalkowski 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 @@ -4,8 +4,8 @@ from .api import FFI, CDefError, FFIError from .ffiplatform import VerificationError, VerificationMissing -__version__ = "1.6.0" -__version_info__ = (1, 6, 0) +__version__ = "1.7.0" +__version_info__ = (1, 7, 0) # The verifier module file names are based on the CRC32 of a string that # contains the following version number. It may be older than __version__ diff --git a/lib_pypy/cffi/_cffi_include.h b/lib_pypy/cffi/_cffi_include.h --- a/lib_pypy/cffi/_cffi_include.h +++ b/lib_pypy/cffi/_cffi_include.h @@ -57,6 +57,12 @@ # define _CFFI_UNUSED_FN /* nothing */ #endif +#ifdef __cplusplus +# ifndef _Bool +# define _Bool bool /* semi-hackish: C++ has no _Bool; bool is builtin */ +# endif +#endif + /********** CPython-specific section **********/ #ifndef PYPY_VERSION diff --git a/lib_pypy/cffi/_embedding.h b/lib_pypy/cffi/_embedding.h --- a/lib_pypy/cffi/_embedding.h +++ b/lib_pypy/cffi/_embedding.h @@ -233,7 +233,7 @@ f = PySys_GetObject((char *)"stderr"); if (f != NULL && f != Py_None) { PyFile_WriteString("\nFrom: " _CFFI_MODULE_NAME - "\ncompiled with cffi version: 1.6.0" + "\ncompiled with cffi version: 1.7.0" "\n_cffi_backend module: ", f); modules = PyImport_GetModuleDict(); mod = PyDict_GetItemString(modules, "_cffi_backend"); diff --git a/lib_pypy/cffi/backend_ctypes.py b/lib_pypy/cffi/backend_ctypes.py --- a/lib_pypy/cffi/backend_ctypes.py +++ b/lib_pypy/cffi/backend_ctypes.py @@ -205,9 +205,7 @@ def __nonzero__(self): return bool(self._address) - - def __bool__(self): - return bool(self._address) + __bool__ = __nonzero__ @classmethod def _to_ctypes(cls, value): @@ -465,6 +463,7 @@ else: def __nonzero__(self): return self._value != 0 + __bool__ = __nonzero__ if kind == 'float': @staticmethod diff --git a/pypy/__init__.py b/pypy/__init__.py --- a/pypy/__init__.py +++ b/pypy/__init__.py @@ -1,4 +1,5 @@ -# Empty +import os +pypydir = os.path.realpath(os.path.dirname(__file__)) # XXX Should be empty again, soon. # XXX hack for win64: diff --git a/pypy/conftest.py b/pypy/conftest.py --- a/pypy/conftest.py +++ b/pypy/conftest.py @@ -18,8 +18,6 @@ # option = None -pypydir = os.path.realpath(os.path.dirname(__file__)) - def braindead_deindent(self): """monkeypatch that wont end up doing stupid in the python tokenizer""" text = '\n'.join(self.lines) @@ -184,9 +182,6 @@ __multicall__.execute() -def pytest_runtest_teardown(__multicall__, item): - __multicall__.execute() - class PyPyClassCollector(py.test.collect.Class): # All pypy Test classes have a "space" member. diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -13,17 +13,17 @@ Samuele Pedroni Matti Picus Alex Gaynor + Philip Jenvey Brian Kearns - Philip Jenvey + Ronan Lamy Michael Hudson - Ronan Lamy + Manuel Jacob David Schneider - Manuel Jacob Holger Krekel Christian Tismer Hakan Ardo + Richard Plangger Benjamin Peterson - Richard Plangger Anders Chrigstrom Eric van Riet Paap Wim Lavrijsen @@ -63,9 +63,9 @@ stian Jan de Mooij Tyler Wade + Vincent Legoll Michael Foord Stephan Diehl - Vincent Legoll Stefan Schwarzer Valentino Volonghi Tomek Meka @@ -74,31 +74,34 @@ Bruno Gola David Malcolm Jean-Paul Calderone + Mark Young Timo Paulssen Squeaky + Devin Jeanpierre Marius Gedminas Alexandre Fayolle Simon Burton + Stefano Rivera Martin Matusiak Konstantin Lopuhin - Stefano Rivera Wenzhu Man John Witulski Laurence Tratt + Raffael Tfirst Ivan Sichmann Freitas Greg Price Dario Bertini Mark Pearse Simon Cross + Edd Barrett Andreas Stührk - Edd Barrett + Tobias Pape Jean-Philippe St. Pierre Guido van Rossum Pavel Vinogradov Spenser Bauman Jeremy Thurgood Paweł Piotr Przeradowski - Tobias Pape Paul deGrandis Ilya Osadchiy marky1991 @@ -110,7 +113,6 @@ Georg Brandl Bert Freudenberg Stian Andreassen - Mark Young Wanja Saatkamp Gerald Klix Mike Blume @@ -126,11 +128,13 @@ Dusty Phillips Lukas Renggli Guenter Jantzen + William Leslie Ned Batchelder Tim Felgentreff Anton Gulenko Amit Regmi Ben Young + Sergey Matyunin Nicolas Chauvat Andrew Durdin Andrew Chambers @@ -141,9 +145,9 @@ Yichao Yu Rocco Moretti Gintautas Miliauskas - Devin Jeanpierre Michael Twomey Lucian Branescu Mihaila + anatoly techtonik Gabriel Lavoie Olivier Dormond Jared Grubb @@ -153,8 +157,6 @@ Brian Dorsey Victor Stinner Andrews Medina - anatoly techtonik - Sergey Matyunin Stuart Williams Jasper Schulz Christian Hudon @@ -178,11 +180,11 @@ Alex Perry Vaibhav Sood Alan McIntyre - William Leslie Alexander Sedov Attila Gobi Jasper.Schulz Christopher Pope + Florin Papa Christian Tismer Marc Abramowitz Dan Stromberg @@ -198,7 +200,6 @@ Lukas Vacek Kunal Grover Andrew Dalke - Florin Papa Sylvain Thenault Jakub Stasiak Nathan Taylor @@ -240,8 +241,9 @@ Yury V. Zaytsev Anna Katrina Dominguez Bobby Impollonia - t...@eistee.fritz.box + Vasantha Ganesh K Andrew Thompson + florinpapa Yusei Tahara Aaron Tubbs Ben Darnell @@ -265,9 +267,9 @@ Akira Li Gustavo Niemeyer Stephan Busemann - florinpapa Rafał Gałczyński Matt Bogosian + timo Christian Muirhead Berker Peksag James Lan 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-pypy2.7-v5.3.0.rst release-5.1.1.rst release-5.1.0.rst release-5.0.1.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-5.3.0.rst whatsnew-5.1.0.rst whatsnew-5.0.0.rst whatsnew-4.0.1.rst diff --git a/pypy/doc/project-ideas.rst b/pypy/doc/project-ideas.rst --- a/pypy/doc/project-ideas.rst +++ b/pypy/doc/project-ideas.rst @@ -53,15 +53,17 @@ immediately, but only when (and if) ``myslice`` or ``mylist`` are mutated. -Numpy improvements ------------------- +NumPy rebooted +-------------- -The numpy is rapidly progressing in pypy, so feel free to come to IRC and -ask for proposed topic. A not necesarilly up-to-date `list of topics`_ -is also available. +Our cpyext C-API compatiblity layer can now run upstream NumPy unmodified. +Release PyPy2.7-v5.3 still fails about 200 of the ~6000 test in the NumPy +test suite. We could use help analyzing the failures and fixing them either +as patches to upstream NumPy, or as fixes to PyPy. -.. _list of topics: https://bitbucket.org/pypy/extradoc/src/extradoc/planning/micronumpy.txt - +We also are looking for help in how to hijack NumPy dtype conversion and +ufunc calls to allow the JIT to make them fast, using our internal _numpypy +module. Improving the jitviewer ------------------------ diff --git a/pypy/doc/release-pypy2.7-v5.3.0.rst b/pypy/doc/release-pypy2.7-v5.3.0.rst --- a/pypy/doc/release-pypy2.7-v5.3.0.rst +++ b/pypy/doc/release-pypy2.7-v5.3.0.rst @@ -2,15 +2,18 @@ PyPy2.7 v5.3 ============ -We have released PyPy2.7 v5.3, about six weeks after PyPy 5.1. -This release includes further improvements for the CAPI compatibility layer -which we call cpyext. In addtion to complete support for lxml, we now pass -most (more than 90%) of the upstream numpy test suite, and much of SciPy is -supported as well. +We have released PyPy2.7 v5.3, about six weeks after PyPy 5.1 and a week after +`PyPy3.3 v5.2 alpha 1`_, the first PyPy release targetting 3.3 +compatibility. This new PyPy2.7 release includes further improvements for the +CAPI compatibility layer which we call cpyext. In addtion to complete support +for lxml, we now pass most (more than 90%) of the upstream numpy test suite, +and much of SciPy is supported as well. -We also improved the speed of ... and ... +We updated cffi_ to version 1.7 (small changes, documented here_). -We updated cffi_ to ... +.. _`PyPy3.3 v5.2 alpha 1`: http://morepypy.blogspot.com/2016/05/pypy33-v52-alpha-1-released.html +.. _cffi: https://cffi.readthedocs.org +.. _here: http://cffi.readthedocs.io/en/latest/whatsnew.html You can download the PyPy2.7 v5.3 release here: @@ -29,10 +32,6 @@ .. _`RPython`: https://rpython.readthedocs.org .. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly .. _`help`: http://doc.pypy.org/en/latest/project-ideas.html -.. _`numpy`: https://bitbucket.org/pypy/numpy -.. _cffi: https://cffi.readthedocs.org -.. _`fully support for the IBM s390x`: http://morepypy.blogspot.com/2016/04/pypy-enterprise-edition.html -.. _`blog post`: http://morepypy.blogspot.com/2016/04/warmup-improvements-more-efficient.html What is PyPy? ============= @@ -41,13 +40,13 @@ CPython 2.7. 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. +We also welcome developers of other `dynamic languages`_ to see what RPython +can do for them. This release supports: * **x86** machines on most common operating systems - (Linux 32/64, Mac OS X 64, Windows 32, OpenBSD, FreeBSD), + (Linux 32/64 bits, Mac OS X 64 bits, Windows 32 bits, OpenBSD, FreeBSD) * newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux, @@ -65,6 +64,7 @@ * Merge a major expansion of the C-API support in cpyext, here are some of the highlights: + - allow c-snippet tests to be run with -A so we can verify we are compatible - fix many edge cases exposed by fixing tests to run with -A - issequence() logic matches cpython @@ -72,7 +72,7 @@ - add prelminary support for PyDateTime_* - support PyComplexObject, PyFloatObject, PyDict_Merge, PyDictProxy, PyMemoryView_*, _Py_HashDouble, PyFile_AsFile, PyFile_FromFile, - - PyAnySet_CheckExact, PyUnicode_Concat + PyAnySet_CheckExact, PyUnicode_Concat, PyDateTime_TZInfo - improve support for PyGILState_Ensure, PyGILState_Release, and thread primitives, also find a case where CPython will allow thread creation before PyEval_InitThreads is run, dissallow on PyPy @@ -80,6 +80,10 @@ - rewrite slot assignment for typeobjects - improve tracking of PyObject to rpython object mapping - support tp_as_{number, sequence, mapping, buffer} slots + - support ByteArrayObject via the new resizable_list_supporting_raw_ptr + - implement PyList_SET_ITEM with CPython's behavior, instead of SetItem's + - fix the signature of PyUFunc_FromFuncAndDataAndSignature + - implement many PyWhatever_FOO() as a macro taking a `void *` * CPyExt tweak: instead of "GIL not held when a CPython C extension module calls PyXxx", we now silently acquire/release the GIL. Helps with @@ -93,8 +97,42 @@ * Generalize cpyext old-style buffers to more than just str/buffer, add support for mmap + * Support command line -v to trace import statements + + * Add rposix functions for PyPy3.3 support + + * Give super an __init__ and a simple __new__ for CPython compatibility + + * Revive traceviewer, a tool to use pygame to view traces + * Bug Fixes + * Fix issue #2277: only special-case two exact lists in zip(), not list + subclasses, because an overridden __iter__() should be called (probably) + + * Fix issue #2226: Another tweak in the incremental GC- this should ensure + that progress in the major GC occurs quickly enough in all cases. + + * Clarify and refactor documentation on http://doc.pypy.org + + * Use "must be unicode, not %T" in unicodedata TypeErrors. + + * Manually reset sys.settrace() and sys.setprofile() when we're done running. + This is not exactly what CPython does, but if we get an exception, unlike + CPython, we call functions from the 'traceback' module, and these would + call more the trace/profile function. That's unexpected and can lead + to more crashes at this point. + + * Use the appropriate tp_dealloc on a subclass of a builtin type, and call + tp_new for a python-sublcass of a C-API type + + * Fix for issue #2285 - rare vmprof segfaults on OS/X + + * Fixed issue #2172 - where a test specified an invalid parameter to mmap on powerpc + + * Fix issue #2311 - grab the `__future__` flags imported in the main script, in + `-c`, or in `PYTHON_STARTUP`, and expose them to the `-i` console + * Issues reported with our previous release were resolved_ after reports from users on our issue tracker at https://bitbucket.org/pypy/pypy/issues or on IRC at #pypy @@ -103,6 +141,9 @@ * Implement ufunc.outer on numpypy + * Move PyPy-specific numpy headers to a subdirectory (also changed `the repo`_ + accordingly) + * Performance improvements: * Use bitstrings to compress lists of descriptors that are attached to an @@ -114,11 +155,20 @@ can now be turned into ``x >> 1`` or ``x & 1``, even if x is possibly negative. + * Copy CPython's 'optimization': ignore __iter__ etc. for `f(**dict_subclass())` + + * Use the __builtin_add_overflow built-ins if they are available + + * Rework the way registers are moved/spilled in before_call() * Internal refactorings: + * Refactor code to better support Python3-compatible syntax + + * Document and refactor OperationError -> oefmt + * Reduce the size of generated C sources during translation by - refactoring function declarations + eliminating many many unused struct declarations (Issue #2281) * Remove a number of translation-time options that were not tested and never used. Also fix a performance bug in the method cache @@ -126,10 +176,14 @@ * Reduce the size of generated code by using the same function objects in all generated subclasses + * Share cpyext Py* function wrappers according to the signature, shrinking the + translated libpypy.so by about 10% (measured without the JIT) + * Compile c snippets with -Werror, and fix warnings it exposed .. _resolved: http://doc.pypy.org/en/latest/whatsnew-5.3.0.html .. _Numpy: https://bitbucket.org/pypy/numpy +.. _`the repo`: https://bitbucket.org/pypy/numpy Please update, and continue to help us make PyPy better. 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 @@ -73,6 +73,8 @@ 'Richard Lancaster':['richardlancaster'], 'William Leslie':['William ML Leslie'], 'Spenser Bauman':['Spenser Andrew Bauman'], + 'Raffael Tfirst':['raffael.tfi...@gmail.com'], + 'timo':['t...@eistee.fritz.box'], } alias_map = {} 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,145 +1,21 @@ ========================= -What's new in PyPy 5.1+ +What's new in PyPy2.7 5.3+ ========================= -.. this is a revision shortly after release-5.1 -.. startrev: aa60332382a1 +.. this is a revision shortly after release-pypy2.7-v5.3 +.. startrev: 873218a739f1 -.. branch: techtonik/introductionrst-simplify-explanation-abo-1460879168046 +.. branch: fix-gen-dfa -.. branch: gcheader-decl +Resolves an issue with the generator script to build the dfa for Python syntax. -Reduce the size of generated C sources. +.. branch: z196-support +Fixes a critical issue in the register allocator and extends support on s390x. +PyPy runs and translates on the s390x revisions z10 (released February 2008, experimental) +and z196 (released August 2010) in addition to zEC12 and z13. +To target e.g. z196 on a zEC12 machine supply CFLAGS="-march=z196" to your shell environment. -.. branch: remove-objspace-options +.. branch: s390x-5.3-catchup -Remove a number of options from the build process that were never tested and -never set. Fix a performance bug in the method cache. - -.. branch: bitstring - -JIT: use bitstrings to compress the lists of read or written descrs -that we attach to EffectInfo. Fixes a problem we had in -remove-objspace-options. - -.. branch: cpyext-for-merge - -Update cpyext C-API support After this branch, we are almost able to support -upstream numpy via cpyext, so we created (yet another) fork of numpy at -github.com/pypy/numpy with the needed changes. Among the significant changes -to cpyext: - - allow c-snippet tests to be run with -A so we can verify we are compatible - - fix many edge cases exposed by fixing tests to run with -A - - issequence() logic matches cpython - - make PyStringObject and PyUnicodeObject field names compatible with cpython - - add prelminary support for PyDateTime_* - - support PyComplexObject, PyFloatObject, PyDict_Merge, PyDictProxy, - PyMemoryView_*, _Py_HashDouble, PyFile_AsFile, PyFile_FromFile, - - PyAnySet_CheckExact, PyUnicode_Concat - - improve support for PyGILState_Ensure, PyGILState_Release, and thread - primitives, also find a case where CPython will allow thread creation - before PyEval_InitThreads is run, dissallow on PyPy - - create a PyObject-specific list strategy - - rewrite slot assignment for typeobjects - - improve tracking of PyObject to rpython object mapping - - support tp_as_{number, sequence, mapping, buffer} slots - -(makes the pypy-c bigger; this was fixed subsequently by the -share-cpyext-cpython-api branch) - -.. branch: share-mapdict-methods-2 - -Reduce generated code for subclasses by using the same function objects in all -generated subclasses. - -.. branch: share-cpyext-cpython-api - -.. branch: cpyext-auto-gil - -CPyExt tweak: instead of "GIL not held when a CPython C extension module -calls PyXxx", we now silently acquire/release the GIL. Helps with -CPython C extension modules that call some PyXxx() functions without -holding the GIL (arguably, they are theorically buggy). - -.. branch: cpyext-test-A - -Get the cpyext tests to pass with "-A" (i.e. when tested directly with -CPython). - -.. branch: oefmt - -.. branch: cpyext-werror - -Compile c snippets with -Werror in cpyext - -.. branch: gc-del-3 - -Add rgc.FinalizerQueue, documented in pypy/doc/discussion/finalizer-order.rst. -It is a more flexible way to make RPython finalizers. - -.. branch: unpacking-cpython-shortcut - -.. branch: cleanups - -.. branch: cpyext-more-slots - -.. branch: use-gc-del-3 - -Use the new rgc.FinalizerQueue mechanism to clean up the handling of -``__del__`` methods. Fixes notably issue #2287. (All RPython -subclasses of W_Root need to use FinalizerQueue now.) - -.. branch: ufunc-outer - -Implement ufunc.outer on numpypy - -.. branch: verbose-imports - -Support ``pypy -v``: verbose imports. It does not log as much as -cpython, but it should be enough to help when debugging package layout -problems. - -.. branch: cpyext-macros-cast - -Fix some warnings when compiling CPython C extension modules - -.. branch: syntax_fix - -.. branch: remove-raisingops - -Remove most of the _ovf, _zer and _val operations from RPython. Kills -quite some code internally, and allows the JIT to do better -optimizations: for example, app-level code like ``x / 2`` or ``x % 2`` -can now be turned into ``x >> 1`` or ``x & 1``, even if x is possibly -negative. - -.. branch: cpyext-old-buffers - -Generalize cpyext old-style buffers to more than just str/buffer, add support for mmap - -.. branch: numpy-includes - -Move _numpypy headers into a directory so they are not picked up by upstream numpy, scipy -This allows building upstream numpy and scipy in pypy via cpyext - -.. branch: traceviewer-common-merge-point-formats - -Teach RPython JIT's off-line traceviewer the most common ``debug_merge_point`` formats. - -.. branch: cpyext-pickle - -Enable pickling of W_PyCFunctionObject by monkeypatching pickle.Pickler.dispatch -at cpyext import time - -.. branch: nonmovable-list - -Add a way to ask "give me a raw pointer to this list's -items". Only for resizable lists of primitives. Turns the GcArray -nonmovable, possibly making a copy of it first. - -.. branch: cpyext-ext - -Finish the work already partially merged in cpyext-for-merge. Adds support -for ByteArrayObject using the nonmovable-list, which also enables -buffer(bytearray(<some-list>)) +Implement the backend related changes for s390x. diff --git a/pypy/doc/whatsnew-pypy2-5.3.0.rst b/pypy/doc/whatsnew-pypy2-5.3.0.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-pypy2-5.3.0.rst @@ -0,0 +1,145 @@ +========================= +What's new in PyPy2.7 5.3 +========================= + +.. this is a revision shortly after release-5.1 +.. startrev: aa60332382a1 + +.. branch: techtonik/introductionrst-simplify-explanation-abo-1460879168046 + +.. branch: gcheader-decl + +Reduce the size of generated C sources. + + +.. branch: remove-objspace-options + +Remove a number of options from the build process that were never tested and +never set. Fix a performance bug in the method cache. + +.. branch: bitstring + +JIT: use bitstrings to compress the lists of read or written descrs +that we attach to EffectInfo. Fixes a problem we had in +remove-objspace-options. + +.. branch: cpyext-for-merge + +Update cpyext C-API support After this branch, we are almost able to support +upstream numpy via cpyext, so we created (yet another) fork of numpy at +github.com/pypy/numpy with the needed changes. Among the significant changes +to cpyext: + - allow c-snippet tests to be run with -A so we can verify we are compatible + - fix many edge cases exposed by fixing tests to run with -A + - issequence() logic matches cpython + - make PyStringObject and PyUnicodeObject field names compatible with cpython + - add prelminary support for PyDateTime_* + - support PyComplexObject, PyFloatObject, PyDict_Merge, PyDictProxy, + PyMemoryView_*, _Py_HashDouble, PyFile_AsFile, PyFile_FromFile, + - PyAnySet_CheckExact, PyUnicode_Concat + - improve support for PyGILState_Ensure, PyGILState_Release, and thread + primitives, also find a case where CPython will allow thread creation + before PyEval_InitThreads is run, dissallow on PyPy + - create a PyObject-specific list strategy + - rewrite slot assignment for typeobjects + - improve tracking of PyObject to rpython object mapping + - support tp_as_{number, sequence, mapping, buffer} slots + +(makes the pypy-c bigger; this was fixed subsequently by the +share-cpyext-cpython-api branch) + +.. branch: share-mapdict-methods-2 + +Reduce generated code for subclasses by using the same function objects in all +generated subclasses. + +.. branch: share-cpyext-cpython-api + +.. branch: cpyext-auto-gil + +CPyExt tweak: instead of "GIL not held when a CPython C extension module +calls PyXxx", we now silently acquire/release the GIL. Helps with +CPython C extension modules that call some PyXxx() functions without +holding the GIL (arguably, they are theorically buggy). + +.. branch: cpyext-test-A + +Get the cpyext tests to pass with "-A" (i.e. when tested directly with +CPython). + +.. branch: oefmt + +.. branch: cpyext-werror + +Compile c snippets with -Werror in cpyext + +.. branch: gc-del-3 + +Add rgc.FinalizerQueue, documented in pypy/doc/discussion/finalizer-order.rst. +It is a more flexible way to make RPython finalizers. + +.. branch: unpacking-cpython-shortcut + +.. branch: cleanups + +.. branch: cpyext-more-slots + +.. branch: use-gc-del-3 + +Use the new rgc.FinalizerQueue mechanism to clean up the handling of +``__del__`` methods. Fixes notably issue #2287. (All RPython +subclasses of W_Root need to use FinalizerQueue now.) + +.. branch: ufunc-outer + +Implement ufunc.outer on numpypy + +.. branch: verbose-imports + +Support ``pypy -v``: verbose imports. It does not log as much as +cpython, but it should be enough to help when debugging package layout +problems. + +.. branch: cpyext-macros-cast + +Fix some warnings when compiling CPython C extension modules + +.. branch: syntax_fix + +.. branch: remove-raisingops + +Remove most of the _ovf, _zer and _val operations from RPython. Kills +quite some code internally, and allows the JIT to do better +optimizations: for example, app-level code like ``x / 2`` or ``x % 2`` +can now be turned into ``x >> 1`` or ``x & 1``, even if x is possibly +negative. + +.. branch: cpyext-old-buffers + +Generalize cpyext old-style buffers to more than just str/buffer, add support for mmap + +.. branch: numpy-includes + +Move _numpypy headers into a directory so they are not picked up by upstream numpy, scipy +This allows building upstream numpy and scipy in pypy via cpyext + +.. branch: traceviewer-common-merge-point-formats + +Teach RPython JIT's off-line traceviewer the most common ``debug_merge_point`` formats. + +.. branch: cpyext-pickle + +Enable pickling of W_PyCFunctionObject by monkeypatching pickle.Pickler.dispatch +at cpyext import time + +.. branch: nonmovable-list + +Add a way to ask "give me a raw pointer to this list's +items". Only for resizable lists of primitives. Turns the GcArray +nonmovable, possibly making a copy of it first. + +.. branch: cpyext-ext + +Finish the work already partially merged in cpyext-for-merge. Adds support +for ByteArrayObject using the nonmovable-list, which also enables +buffer(bytearray(<some-list>)) diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -10,7 +10,7 @@ from rpython.config.config import ConflictConfigError from rpython.rlib import rlocale from pypy.tool.option import make_objspace -from pypy.conftest import pypydir +from pypy import pypydir from rpython.rlib import rthread from pypy.module.thread import os_thread @@ -297,7 +297,7 @@ self.hack_for_cffi_modules(driver) return self.get_entry_point(config) - + def hack_for_cffi_modules(self, driver): # HACKHACKHACK # ugly hack to modify target goal from compile_* to build_cffi_imports @@ -324,7 +324,7 @@ while not basedir.join('include').exists(): _basedir = basedir.dirpath() if _basedir == basedir: - raise ValueError('interpreter %s not inside pypy repo', + raise ValueError('interpreter %s not inside pypy repo', str(exename)) basedir = _basedir modules = self.config.objspace.usemodules.getpaths() diff --git a/pypy/interpreter/test/test_app_main.py b/pypy/interpreter/test/test_app_main.py --- a/pypy/interpreter/test/test_app_main.py +++ b/pypy/interpreter/test/test_app_main.py @@ -6,7 +6,8 @@ import sys, os, re, runpy, subprocess from rpython.tool.udir import udir from contextlib import contextmanager -from pypy.conftest import PYTHON3, pypydir +from pypy import pypydir +from pypy.conftest import PYTHON3 from pypy.interpreter.test.conftest import banner from lib_pypy._pypy_interact import irc_header @@ -281,7 +282,7 @@ child.expect('>>>') # banner if irc_topic: assert irc_header in child.before - else: + else: assert irc_header not in child.before def test_help(self): @@ -1151,4 +1152,4 @@ # assert it did not crash finally: sys.path[:] = old_sys_path - + diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py --- a/pypy/interpreter/test/test_pyframe.py +++ b/pypy/interpreter/test/test_pyframe.py @@ -48,10 +48,10 @@ return f.f_code assert g() is g.__code__ - def test_f_trace_del(self): + def test_f_trace_del(self): import sys - f = sys._getframe() - del f.f_trace + f = sys._getframe() + del f.f_trace assert f.f_trace is None def test_f_lineno(self): @@ -120,7 +120,7 @@ def f(): assert sys._getframe().f_code.co_name == g() def g(): - return sys._getframe().f_back.f_code.co_name + return sys._getframe().f_back.f_code.co_name f() def test_f_back_virtualref(self): @@ -237,7 +237,7 @@ def test_trace_exc(self): import sys l = [] - def ltrace(a,b,c): + def ltrace(a,b,c): if b == 'exception': l.append(c) return ltrace @@ -300,7 +300,7 @@ def test_trace_return_exc(self): import sys l = [] - def trace(a,b,c): + def trace(a,b,c): if b in ('exception', 'return'): l.append((b, c)) return trace @@ -420,7 +420,7 @@ def test_dont_trace_on_reraise(self): import sys l = [] - def ltrace(a,b,c): + def ltrace(a,b,c): if b == 'exception': l.append(c) return ltrace diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py --- a/pypy/interpreter/test/test_zzpickle_and_slow.py +++ b/pypy/interpreter/test/test_zzpickle_and_slow.py @@ -3,7 +3,7 @@ from pypy.interpreter import gateway from rpython.rlib.jit import non_virtual_ref, vref_None -class AppTestSlow: +class AppTestSlow: def setup_class(cls): if py.test.config.option.runappdirect: filename = __file__ @@ -62,7 +62,7 @@ space.setitem(space.builtin.w_dict, space.wrap('read_exc_type'), space.wrap(read_exc_type_gw)) - + def _detach_helpers(space): space.delitem(space.builtin.w_dict, space.wrap('hide_top_frame')) @@ -90,7 +90,7 @@ pckl = pickle.dumps(code) result = pickle.loads(pckl) assert code == result - + def test_pickle_global_func(self): import types mod = types.ModuleType('mod') @@ -107,7 +107,7 @@ assert func is result finally: del sys.modules['mod'] - + def test_pickle_not_imported_module(self): import types mod = types.ModuleType('mod') @@ -117,13 +117,13 @@ result = pickle.loads(pckl) assert mod.__name__ == result.__name__ assert mod.__dict__ == result.__dict__ - + def test_pickle_builtin_func(self): import pickle pckl = pickle.dumps(map) result = pickle.loads(pckl) assert map is result - + def test_pickle_non_top_reachable_func(self): def func(): return 42 @@ -140,7 +140,7 @@ assert func.__dict__ == result.__dict__ assert func.__doc__ == result.__doc__ assert func.__globals__ == result.__globals__ - + def test_pickle_cell(self): def g(): x = [42] @@ -169,7 +169,7 @@ f1 = f() saved = hide_top_frame(f1) pckl = pickle.dumps(f1) - restore_top_frame(f1, saved) + restore_top_frame(f1, saved) f2 = pickle.loads(pckl) assert type(f1) is type(f2) @@ -244,7 +244,7 @@ f1 = f() saved = hide_top_frame(f1) pckl = pickle.dumps(f1) - restore_top_frame(f1, saved) + restore_top_frame(f1, saved) f2 = pickle.loads(pckl) def test_frame_setstate_crash(self): @@ -278,21 +278,21 @@ pckl = pickle.dumps(mod) result = pickle.loads(pckl) assert mod is result - + def test_pickle_moduledict(self): import pickle moddict = pickle.__dict__ pckl = pickle.dumps(moddict) result = pickle.loads(pckl) assert moddict is result - + def test_pickle_bltins_module(self): import pickle mod = __builtins__ pckl = pickle.dumps(mod) result = pickle.loads(pckl) assert mod is result - + def test_pickle_buffer(self): skip("Can't pickle buffer objects on top of CPython either. " "Do we really need it?") @@ -301,14 +301,14 @@ pckl = pickle.dumps(a) result = pickle.loads(pckl) assert a == result - + def test_pickle_complex(self): import pickle a = complex(1.23,4.567) pckl = pickle.dumps(a) result = pickle.loads(pckl) assert a == result - + def test_pickle_method(self): class myclass(object): def f(self): @@ -329,7 +329,7 @@ assert method() == result() finally: del sys.modules['mod'] - + def test_pickle_staticmethod(self): class myclass(object): def f(): @@ -340,7 +340,7 @@ pckl = pickle.dumps(method) result = pickle.loads(pckl) assert method() == result() - + def test_pickle_classmethod(self): class myclass(object): def f(cls): @@ -358,7 +358,7 @@ assert method() == result() finally: del sys.modules['mod'] - + def test_pickle_sequenceiter(self): ''' In PyPy there is no distinction here between listiterator and diff --git a/pypy/module/_cffi_backend/__init__.py b/pypy/module/_cffi_backend/__init__.py --- a/pypy/module/_cffi_backend/__init__.py +++ b/pypy/module/_cffi_backend/__init__.py @@ -3,7 +3,7 @@ from rpython.rlib import rdynload, clibffi, entrypoint from rpython.rtyper.lltypesystem import rffi -VERSION = "1.6.0" +VERSION = "1.7.0" FFI_DEFAULT_ABI = clibffi.FFI_DEFAULT_ABI try: diff --git a/pypy/module/_cffi_backend/cdataobj.py b/pypy/module/_cffi_backend/cdataobj.py --- a/pypy/module/_cffi_backend/cdataobj.py +++ b/pypy/module/_cffi_backend/cdataobj.py @@ -420,6 +420,14 @@ w_result = ctype.ctitem.unpack_ptr(ctype, ptr, length) return w_result + def dir(self, space): + from pypy.module._cffi_backend.ctypeptr import W_CTypePointer + ct = self.ctype + if isinstance(ct, W_CTypePointer): + ct = ct.ctitem + lst = ct.cdata_dir() + return space.newlist([space.wrap(s) for s in lst]) + class W_CDataMem(W_CData): """This is used only by the results of cffi.cast('int', x) @@ -602,5 +610,6 @@ __call__ = interp2app(W_CData.call), __iter__ = interp2app(W_CData.iter), __weakref__ = make_weakref_descr(W_CData), + __dir__ = interp2app(W_CData.dir), ) W_CData.typedef.acceptable_as_base_class = False diff --git a/pypy/module/_cffi_backend/ctypeobj.py b/pypy/module/_cffi_backend/ctypeobj.py --- a/pypy/module/_cffi_backend/ctypeobj.py +++ b/pypy/module/_cffi_backend/ctypeobj.py @@ -256,6 +256,9 @@ def fget_elements(self, space): return self._fget('e') def fget_relements(self, space):return self._fget('R') + def cdata_dir(self): + return [] + W_CType.typedef = TypeDef( '_cffi_backend.CTypeDescr', 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 @@ -171,6 +171,12 @@ pass return W_CType.getcfield(self, attr) + def cdata_dir(self): + if self.size < 0: + return [] + self.force_lazy_struct() + return self._fields_dict.keys() + class W_CTypeStruct(W_CTypeStructOrUnion): kind = "struct" diff --git a/pypy/module/_cffi_backend/func.py b/pypy/module/_cffi_backend/func.py --- a/pypy/module/_cffi_backend/func.py +++ b/pypy/module/_cffi_backend/func.py @@ -201,6 +201,9 @@ else: copy_string_to_raw(llstr(src_string), dest_data, 0, n) else: + # nowadays this case should be rare or impossible: as far as + # I know, all common types implementing the *writable* buffer + # interface now support get_raw_address() if src_is_ptr: for i in range(n): dest_buf.setitem(i, src_data[i]) 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 @@ -1,7 +1,7 @@ # ____________________________________________________________ import sys -assert __version__ == "1.6.0", ("This test_c.py file is for testing a version" +assert __version__ == "1.7.0", ("This test_c.py file is for testing a version" " of cffi that differs from the one that we" " get from 'import _cffi_backend'") if sys.version_info < (3,): @@ -77,8 +77,8 @@ assert repr(p) == "<ctype 'signed char'>" def check_dir(p, expected): - got = set(name for name in dir(p) if not name.startswith('_')) - assert got == set(expected) + got = [name for name in dir(p) if not name.startswith('_')] + assert got == sorted(expected) def test_inspect_primitive_type(): p = new_primitive_type("signed char") @@ -3608,3 +3608,23 @@ # py.test.raises(ValueError, unpack, p0, -1) py.test.raises(ValueError, unpack, p, -1) + +def test_cdata_dir(): + BInt = new_primitive_type("int") + p = cast(BInt, 42) + check_dir(p, []) + p = newp(new_array_type(new_pointer_type(BInt), None), 5) + check_dir(p, []) + BStruct = new_struct_type("foo") + p = cast(new_pointer_type(BStruct), 0) + check_dir(p, []) # opaque + complete_struct_or_union(BStruct, [('a2', BInt, -1), + ('a1', BInt, -1)]) + check_dir(p, ['a1', 'a2']) # always sorted + p = newp(new_pointer_type(BStruct), None) + check_dir(p, ['a1', 'a2']) + check_dir(p[0], ['a1', 'a2']) + pp = newp(new_pointer_type(new_pointer_type(BStruct)), p) + check_dir(pp, []) + check_dir(pp[0], ['a1', 'a2']) + check_dir(pp[0][0], ['a1', 'a2']) diff --git a/pypy/module/_minimal_curses/test/test_curses.py b/pypy/module/_minimal_curses/test/test_curses.py --- a/pypy/module/_minimal_curses/test/test_curses.py +++ b/pypy/module/_minimal_curses/test/test_curses.py @@ -1,4 +1,4 @@ -from pypy.conftest import pypydir +from pypy import pypydir from rpython.tool.udir import udir import py import sys @@ -70,7 +70,7 @@ f.write(source) child = self.spawn(['--withmod-_minimal_curses', str(f)]) child.expect('ok!') - + class TestCCurses(object): """ Test compiled version """ 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 @@ -4,7 +4,7 @@ import py -from pypy.conftest import pypydir +from pypy import pypydir from rpython.rtyper.lltypesystem import rffi, lltype from rpython.rtyper.tool import rffi_platform from rpython.rtyper.lltypesystem import ll2ctypes diff --git a/pypy/module/cpyext/bytearrayobject.py b/pypy/module/cpyext/bytearrayobject.py --- a/pypy/module/cpyext/bytearrayobject.py +++ b/pypy/module/cpyext/bytearrayobject.py @@ -85,7 +85,7 @@ w_buffer = space.call_function(space.w_bytearray, w_obj) return make_ref(space, w_buffer) -@cpython_api([rffi.CCHARP, Py_ssize_t], PyObject, result_is_ll=True) +@cpython_api([CONST_STRING, Py_ssize_t], PyObject, result_is_ll=True) def PyByteArray_FromStringAndSize(space, char_p, length): """Create a new bytearray object from string and its length, len. On failure, NULL is returned.""" 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 @@ -29,8 +29,8 @@ #define PY_VERSION "3.3.5" /* PyPy version as a string */ -#define PYPY_VERSION "5.3.0-alpha0" -#define PYPY_VERSION_NUM 0x05030000 +#define PYPY_VERSION "5.3.1-alpha0" +#define PYPY_VERSION_NUM 0x05030100 /* 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/cpyext/object.py b/pypy/module/cpyext/object.py --- a/pypy/module/cpyext/object.py +++ b/pypy/module/cpyext/object.py @@ -1,7 +1,7 @@ from rpython.rtyper.lltypesystem import rffi, lltype from pypy.module.cpyext.api import ( cpython_api, generic_cpy_call, CANNOT_FAIL, Py_ssize_t, Py_ssize_tP, - PyVarObject, Py_buffer, + PyVarObject, Py_buffer, size_t, Py_TPFLAGS_HEAPTYPE, Py_LT, Py_LE, Py_EQ, Py_NE, Py_GT, Py_GE, CONST_STRING, FILEP, fwrite) from pypy.module.cpyext.pyobject import ( @@ -18,14 +18,14 @@ PyBUF_SIMPLE = 0x0000 PyBUF_WRITABLE = 0x0001 -@cpython_api([Py_ssize_t], rffi.VOIDP) +@cpython_api([size_t], rffi.VOIDP) def PyObject_Malloc(space, size): # returns non-zero-initialized memory, like CPython return lltype.malloc(rffi.VOIDP.TO, size, flavor='raw', add_memory_pressure=True) -@cpython_api([rffi.VOIDP, Py_ssize_t], rffi.VOIDP) +@cpython_api([rffi.VOIDP, size_t], rffi.VOIDP) def PyObject_Realloc(space, ptr, size): if not lltype.cast_ptr_to_int(ptr): return lltype.malloc(rffi.VOIDP.TO, size, diff --git a/pypy/module/cpyext/test/test_bytearrayobject.py b/pypy/module/cpyext/test/test_bytearrayobject.py --- a/pypy/module/cpyext/test/test_bytearrayobject.py +++ b/pypy/module/cpyext/test/test_bytearrayobject.py @@ -30,7 +30,8 @@ #endif if(s->ob_type->tp_basicsize != expected_size) { - printf("tp_basicsize==%ld\\n", s->ob_type->tp_basicsize); + printf("tp_basicsize==%ld\\n", + (long)s->ob_type->tp_basicsize); result = 0; } Py_DECREF(s); @@ -104,7 +105,7 @@ PyObject* s1 = PyByteArray_FromStringAndSize("test", 4); if (s1 == NULL) return NULL; - char* c = PyByteArray_AsString(s1); + const char* c = PyByteArray_AsString(s1); PyObject* s2 = PyByteArray_FromStringAndSize(c, 4); Py_DECREF(s1); return s2; diff --git a/pypy/module/cpyext/test/test_cpyext.py b/pypy/module/cpyext/test/test_cpyext.py --- a/pypy/module/cpyext/test/test_cpyext.py +++ b/pypy/module/cpyext/test/test_cpyext.py @@ -4,7 +4,7 @@ import py, pytest -from pypy.conftest import pypydir +from pypy import pypydir from pypy.interpreter import gateway from rpython.rtyper.lltypesystem import lltype, ll2ctypes from rpython.translator.tool.cbuild import ExternalCompilationInfo diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py --- a/pypy/module/micronumpy/test/test_complex.py +++ b/pypy/module/micronumpy/test/test_complex.py @@ -495,8 +495,8 @@ c = array([1.e+110, 1.e-110], dtype=complex128) d = floor_divide(c**2, c) assert (d == [1.e+110, 0]).all() - - + + def test_basic(self): import sys diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py --- a/pypy/module/micronumpy/test/test_dtypes.py +++ b/pypy/module/micronumpy/test/test_dtypes.py @@ -374,8 +374,8 @@ a = np.array(data, dtype=b) x = pickle.loads(pickle.dumps(a)) assert (x == a).all() - assert x.dtype == a.dtype - + assert x.dtype == a.dtype + def test_index(self): import numpy as np for dtype in [np.int8, np.int16, np.int32, np.int64]: @@ -1461,7 +1461,7 @@ "'offsets':[0,76800], " "'itemsize':80000, " "'aligned':True}") - + assert dt == np.dtype(eval(str(dt))) dt = np.dtype({'names': ['r', 'g', 'b'], 'formats': ['u1', 'u1', 'u1'], diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py --- a/pypy/module/micronumpy/test/test_ndarray.py +++ b/pypy/module/micronumpy/test/test_ndarray.py @@ -1878,7 +1878,7 @@ assert map(isnan, e) == [False, False, False, True, False] assert map(isinf, e) == [False, False, True, False, False] assert e.argmax() == 3 - # numpy preserves value for uint16 -> cast_as_float16 -> + # numpy preserves value for uint16 -> cast_as_float16 -> # convert_to_float64 -> convert_to_float16 -> uint16 # even for float16 various float16 nans all_f16 = arange(0xfe00, 0xffff, dtype='uint16') @@ -2599,7 +2599,7 @@ a = np.arange(6).reshape(2,3) i = np.dtype('int32').type(0) assert (a[0] == a[i]).all() - + def test_ellipsis_indexing(self): import numpy as np diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py --- a/pypy/module/micronumpy/test/test_object_arrays.py +++ b/pypy/module/micronumpy/test/test_object_arrays.py @@ -200,7 +200,7 @@ from numpy import arange, dtype from cPickle import loads, dumps import sys - + a = arange(15).astype(object) if '__pypy__' in sys.builtin_module_names: raises(NotImplementedError, dumps, a) @@ -211,4 +211,4 @@ a = arange(15).astype(object).reshape((3, 5)) b = loads(dumps(a)) assert (a == b).all() - + diff --git a/pypy/module/select/test/test_epoll.py b/pypy/module/select/test/test_epoll.py --- a/pypy/module/select/test/test_epoll.py +++ b/pypy/module/select/test/test_epoll.py @@ -20,6 +20,10 @@ self.w_sockets = self.space.wrap([]) if platform.machine().startswith('arm'): self.w_timeout = self.space.wrap(0.06) + if platform.machine().startswith('s390x'): + # s390x is not slow, but it seems there is one case when epoll + # modify method is called that takes longer on s390x + self.w_timeout = self.space.wrap(0.06) else: self.w_timeout = self.space.wrap(0.02) diff --git a/pypy/module/sys/state.py b/pypy/module/sys/state.py --- a/pypy/module/sys/state.py +++ b/pypy/module/sys/state.py @@ -2,7 +2,7 @@ Implementation of interpreter-level 'sys' routines. """ import os -import pypy +from pypy import pypydir # ____________________________________________________________ # @@ -20,7 +20,6 @@ def setinitialpath(self, space): from pypy.module.sys.initpath import compute_stdlib_path # Initialize the default path - pypydir = os.path.dirname(os.path.abspath(pypy.__file__)) srcdir = os.path.dirname(pypydir) path = compute_stdlib_path(self, srcdir) self.w_path = space.newlist([space.wrap_fsdecoded(p) for p in path]) 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 @@ -10,11 +10,11 @@ #XXX # sync CPYTHON_VERSION with patchlevel.h, package.py CPYTHON_API_VERSION = 1013 #XXX # sync with include/modsupport.h -PYPY_VERSION = (5, 3, 0, "alpha", 0) #XXX # sync patchlevel.h +PYPY_VERSION = (5, 3, 1, "alpha", 0) #XXX # sync patchlevel.h import pypy -pypydir = os.path.dirname(os.path.abspath(pypy.__file__)) +pypydir = pypy.pypydir pypyroot = os.path.dirname(pypydir) del pypy from rpython.tool.version import get_repo_version_info diff --git a/pypy/module/termios/test/test_termios.py b/pypy/module/termios/test/test_termios.py --- a/pypy/module/termios/test/test_termios.py +++ b/pypy/module/termios/test/test_termios.py @@ -1,7 +1,7 @@ import os import sys import py -from pypy.conftest import pypydir +from pypy import pypydir from rpython.tool.udir import udir if os.name != 'posix': diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi0/backend_tests.py @@ -1359,8 +1359,8 @@ ffi = FFI(backend=self.Backend()) ffi.cdef("enum foo;") from cffi import __version_info__ - if __version_info__ < (1, 7): - py.test.skip("re-enable me in version 1.7") + if __version_info__ < (1, 8): + py.test.skip("re-enable me in version 1.8") e = py.test.raises(CDefError, ffi.cast, "enum foo", -1) assert str(e.value) == ( "'enum foo' has no values explicitly defined: refusing to guess " diff --git a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py --- a/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py +++ b/pypy/module/test_lib_pypy/cffi_tests/cffi1/test_recompiler.py @@ -1909,3 +1909,10 @@ assert ffi.list_types() == (['CFFIb', 'CFFIbb', 'CFFIbbb'], ['CFFIa', 'CFFIcc', 'CFFIccc'], ['CFFIaa', 'CFFIaaa', 'CFFIg']) + +def test_bool_in_cpp(): + # this works when compiled as C, but in cffi < 1.7 it fails as C++ + ffi = FFI() + ffi.cdef("bool f(void);") + lib = verify(ffi, "test_bool_in_cpp", "char f(void) { return 2; }") + assert lib.f() == 1 diff --git a/pypy/objspace/test/test_binop_overriding.py b/pypy/objspace/test/test_binop_overriding.py --- a/pypy/objspace/test/test_binop_overriding.py +++ b/pypy/objspace/test/test_binop_overriding.py @@ -73,7 +73,7 @@ if C is not object: setattr(C, name, f) override_in_hier(n-1) - if C is not object: + if C is not object: delattr(C, name) override_in_hier() @@ -105,7 +105,7 @@ if not self.appdirect: skip("slow test, should be run as appdirect test") Base, do_test = self.helpers - + class X(Base): pass class Y(X): @@ -116,7 +116,7 @@ assert not fail def test_binop_combinations_sub(self): - Base, do_test = self.helpers + Base, do_test = self.helpers class X(Base): pass class Y(X): @@ -124,13 +124,13 @@ fail = do_test(X, Y, 'sub', lambda x,y: x-y) #print len(fail) - assert not fail + assert not fail def test_binop_combinations_pow(self): if not self.appdirect: skip("slow test, should be run as appdirect test") Base, do_test = self.helpers - + class X(Base): pass class Y(X): @@ -138,13 +138,13 @@ fail = do_test(X, Y, 'pow', lambda x,y: x**y) #print len(fail) - assert not fail + assert not fail def test_binop_combinations_more_exhaustive(self): if not self.appdirect: skip("very slow test, should be run as appdirect test") Base, do_test = self.helpers - + class X(Base): pass diff --git a/pypy/tool/genstatistic.py b/pypy/tool/genstatistic.py --- a/pypy/tool/genstatistic.py +++ b/pypy/tool/genstatistic.py @@ -1,22 +1,22 @@ import py -from py._cmdline import pycountloc as countloc +from py._cmdline import pycountloc as countloc from py.xml import raw -from pypy import conftest +from pypy import pypydir -pypydir = py.path.local(conftest.pypydir) +pypydir = py.path.local(pypydir) def isdocfile(p): return (p.ext in ('.txt', '.rst') or p.basename in ('README', 'NOTES', 'LICENSE')) def istestfile(p): - if not p.check(file=1, ext='.py'): - return False - pb = p.purebasename - if pb.startswith('test_') or pb.endswith('_test'): - return True - if 'test' in [x.basename for x in p.parts()[-4:]]: + if not p.check(file=1, ext='.py'): + return False + pb = p.purebasename + if pb.startswith('test_') or pb.endswith('_test'): + return True + if 'test' in [x.basename for x in p.parts()[-4:]]: return True notistestfile = lambda x: not istestfile(x) @@ -24,42 +24,43 @@ class relchecker: def __init__(self, rel): self.rel = rel - def __call__(self, p): - return p.relto(conftest.pypydir).startswith(self.rel) + + def __call__(self, p): + return p.relto(pypydir).startswith(self.rel) def isfile(p): return p.check(file=1) and p.ext in ('.py', '.txt', '') def recpypy(p): - if p.basename[0] == '.': - return False - if p.basename in ('Pyrex', - '_cache', - 'unicodedata', + if p.basename[0] == '.': + return False + if p.basename in ('Pyrex', + '_cache', + 'unicodedata', 'pypy-translation-snapshot'): - return False - return True + return False + return True def getpypycounter(): - filecounter = countloc.FileCounter() - root = py.path.local(conftest.pypydir) + filecounter = countloc.FileCounter() + root = py.path.local(pypydir) filecounter.addrecursive(root, isfile, rec=recpypy) - return filecounter + return filecounter -class CounterModel: - def __init__(self, pypycounter): - self.counter = pypycounter - self.totallines = pypycounter.numlines +class CounterModel: + def __init__(self, pypycounter): + self.counter = pypycounter + self.totallines = pypycounter.numlines self.totalfiles = pypycounter.numfiles - self.testlines = pypycounter.getnumlines(istestfile) - self.testfiles = pypycounter.getnumfiles(istestfile) - self.notestlines = pypycounter.getnumlines(notistestfile) - self.notestfiles = pypycounter.getnumfiles(notistestfile) + self.testlines = pypycounter.getnumlines(istestfile) + self.testfiles = pypycounter.getnumfiles(istestfile) + self.notestlines = pypycounter.getnumlines(notistestfile) + self.notestfiles = pypycounter.getnumfiles(notistestfile) self.doclines = pypycounter.getnumlines(isdocfile) - self.docfiles = pypycounter.getnumfiles(isdocfile) + self.docfiles = pypycounter.getnumfiles(isdocfile) # -# rendering +# rendering # def row(*args): return html.tr([html.td(arg) for arg in args]) @@ -69,22 +70,22 @@ def viewlocsummary(model): t = html.table( - row("total number of lines", model.totallines, raw(" ")), - row("number of testlines", model.testlines, - percent(model.testlines, model.totallines)), - row("number of non-testlines", model.notestlines, - percent(model.notestlines, model.totallines)), + row("total number of lines", model.totallines, raw(" ")), + row("number of testlines", model.testlines, + percent(model.testlines, model.totallines)), + row("number of non-testlines", model.notestlines, + percent(model.notestlines, model.totallines)), - row("total number of files", model.totalfiles, raw(" ")), - row("number of testfiles", model.testfiles, - percent(model.testfiles, model.totalfiles)), - row("number of non-testfiles", model.notestfiles, - percent(model.notestfiles, model.totalfiles)), + row("total number of files", model.totalfiles, raw(" ")), + row("number of testfiles", model.testfiles, + percent(model.testfiles, model.totalfiles)), + row("number of non-testfiles", model.notestfiles, + percent(model.notestfiles, model.totalfiles)), ) - if model.docfiles: - t.append(row("number of docfiles", model.docfiles, + if model.docfiles: + t.append(row("number of docfiles", model.docfiles, percent(model.docfiles, model.totalfiles))) - t.append(row("number of doclines", model.doclines, + t.append(row("number of doclines", model.doclines, percent(model.doclines, model.totallines))) return t @@ -92,46 +93,46 @@ t = html.table() d = model.counter.file2numlines paths = d.items() - paths.sort(lambda x,y : -cmp(x[1], y[1])) # sort by numlines - for p, numlines in paths: - if numlines < 3: + paths.sort(lambda x, y: -cmp(x[1], y[1])) # sort by numlines + for p, numlines in paths: + if numlines < 3: continue t.append(row(p.relto(pypydir.dirpath()), numlines)) return t -def viewsubdirs(model): +def viewsubdirs(model): t = html.table() - for p in pypydir.listdir(): - if p.basename in '_cache .svn'.split(): + for p in pypydir.listdir(): + if p.basename in '_cache .svn'.split(): continue - if p.check(dir=1): + if p.check(dir=1): counter = countloc.FileCounter() counter.addrecursive(p, isfile, recpypy) - model = CounterModel(counter) + model = CounterModel(counter) t.append(row(html.h2(p.relto(pypydir.dirpath())))) t.append(viewlocsummary(model)) t.append(viewloclist(model)) return t -if __name__ == '__main__': +if __name__ == '__main__': if len(py.std.sys.argv) >= 2: target = py.path.local(py.std.sys.argv[1]) else: target = py.path.local('index.html') print "writing source statistics to", target - pypycounter = getpypycounter() - model = CounterModel(pypycounter) - rev = py.path.svnwc(conftest.pypydir).info().rev + pypycounter = getpypycounter() + model = CounterModel(pypycounter) + rev = py.path.svnwc(pypydir).info().rev html = py.xml.html doc = html.html( html.head( html.title("PyPy Statistics %d" % rev), - ), + ), html.body( html.h2("rev %d PyPy Summary of Files and Lines" % rev), - viewlocsummary(model), - html.h2("Details on first-level subdirectories"), - viewsubdirs(model), + viewlocsummary(model), + html.h2("Details on first-level subdirectories"), + viewsubdirs(model), html.h3("PyPy Full List Files and Lines"), viewloclist(model), html.p("files with less than 3 lines ignored") @@ -139,4 +140,3 @@ ) content = doc.unicode(indent=2).encode('utf8') target.write(content) - diff --git a/pypy/tool/getdocstrings.py b/pypy/tool/getdocstrings.py --- a/pypy/tool/getdocstrings.py +++ b/pypy/tool/getdocstrings.py @@ -1,7 +1,7 @@ import re from os import listdir from sys import stdin, stdout, stderr -from pypy.conftest import pypydir +from pypy import pypydir where = pypydir + '/objspace/std/' quote = '(' + "'" + '|' + '"' + ')' @@ -29,7 +29,7 @@ def compile_typedef(typ): return re.compile(r"(?P<whitespace>\s+)" - + r"(?P<typeassign>" + typ + + r"(?P<typeassign>" + typ + "_typedef = StdTypeDef+\s*\(\s*" + quote + typ + quote + ",).*" + r"(?P<indent>^\s+)" @@ -38,7 +38,7 @@ def get_pypydoc(sourcefile): doc = compile_doc() - + try: # if this works we already have a docstring pypydoc = doc.search(sourcefile).group('docstring') @@ -86,14 +86,10 @@ if __name__ == '__main__': filenames = mk_std_filelist() - + for f in filenames: inf = file(where + f).read() outs = add_docstring(f[:-7], inf) if outs is not None: outf = file(where + f, 'w') outf.write(outs) - - - - diff --git a/pypy/tool/pytest/appsupport.py b/pypy/tool/pytest/appsupport.py --- a/pypy/tool/pytest/appsupport.py +++ b/pypy/tool/pytest/appsupport.py @@ -5,9 +5,9 @@ from pypy.interpreter.error import OperationError, oefmt try: + from _pytest.assertion.reinterpret import reinterpret as interpret +except ImportError: from _pytest.assertion.newinterpret import interpret -except ImportError: - from _pytest.assertion.oldinterpret import interpret # ____________________________________________________________ diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh --- a/pypy/tool/release/repackage.sh +++ b/pypy/tool/release/repackage.sh @@ -1,15 +1,16 @@ # Edit these appropriately before running this script maj=5 -min=1 -rev=2 +min=3 +rev=0 branchname=release-$maj.x # ==OR== release-$maj.$min.x -tagname=release-$maj.$min.$rev # ==OR== release-$maj.$min +tagname=release-pypy2.7-v$maj.$min # ==OR== release-$maj.$min echo checking hg log -r $branchname hg log -r $branchname || exit 1 echo checking hg log -r $tagname hg log -r $tagname || exit 1 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit