Author: Richard Plangger <planri...@gmail.com> Branch: py3.5-ssl Changeset: r88374:2666380e3fad Date: 2016-11-14 14:28 +0100 http://bitbucket.org/pypy/pypy/changeset/2666380e3fad/
Log: merge updates to py3.5 diff too long, truncating to 2000 out of 17845 lines diff --git a/.hgtags b/.hgtags --- a/.hgtags +++ b/.hgtags @@ -33,3 +33,4 @@ 050d84dd78997f021acf0e133934275d63547cc0 release-pypy2.7-v5.4.1 050d84dd78997f021acf0e133934275d63547cc0 release-pypy2.7-v5.4.1 0e2d9a73f5a1818d0245d75daccdbe21b2d5c3ef release-pypy2.7-v5.4.1 +aff251e543859ce4508159dd9f1a82a2f553de00 release-pypy2.7-v5.6.0 diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -44,15 +44,15 @@ Matti Picus Alex Gaynor Philip Jenvey + Ronan Lamy Brian Kearns - Ronan Lamy + Richard Plangger Michael Hudson Manuel Jacob David Schneider Holger Krekel Christian Tismer Hakan Ardo - Richard Plangger Benjamin Peterson Anders Chrigstrom Eric van Riet Paap @@ -68,8 +68,8 @@ Niklaus Haldimann Camillo Bruni Laura Creighton + Romain Guillebert Toon Verwaest - Romain Guillebert Leonardo Santagada Seo Sanghyeon Ronny Pfannschmidt @@ -89,7 +89,9 @@ Ludovic Aubry Jacob Hallen Jason Creighton + Mark Young Alex Martelli + Spenser Bauman Michal Bendowski stian Jan de Mooij @@ -100,20 +102,21 @@ Stefan Schwarzer Valentino Volonghi Tomek Meka + Stefano Rivera Patrick Maupin + Devin Jeanpierre Bob Ippolito Bruno Gola David Malcolm Jean-Paul Calderone - Mark Young Timo Paulssen + Edd Barrett Squeaky - Devin Jeanpierre Marius Gedminas Alexandre Fayolle Simon Burton - Stefano Rivera Martin Matusiak + Nicolas Truessel Konstantin Lopuhin Wenzhu Man John Witulski @@ -123,14 +126,12 @@ Dario Bertini Mark Pearse Simon Cross - Edd Barrett + Jeremy Thurgood Andreas Stührk Tobias Pape Jean-Philippe St. Pierre Guido van Rossum Pavel Vinogradov - Spenser Bauman - Jeremy Thurgood Paweł Piotr Przeradowski Paul deGrandis Ilya Osadchiy @@ -141,7 +142,6 @@ tav Taavi Burns Georg Brandl - Nicolas Truessel Bert Freudenberg Stian Andreassen Wanja Saatkamp @@ -156,19 +156,20 @@ Preston Timmons David Ripton Jeff Terrace + Tim Felgentreff Dusty Phillips Lukas Renggli Guenter Jantzen William Leslie Ned Batchelder - Tim Felgentreff Anton Gulenko Amit Regmi Ben Young - Sergey Matyunin + Jasper Schulz Nicolas Chauvat Andrew Durdin Andrew Chambers + Sergey Matyunin Michael Schneider Nicholas Riley Jason Chu @@ -184,16 +185,16 @@ Jared Grubb Karl Bartel Wouter van Heyst - Sebastian Pawluś Brian Dorsey Victor Stinner Andrews Medina + Sebastian Pawluś Stuart Williams - Jasper Schulz - Christian Hudon + Daniel Patrick + Aaron Iles Toby Watson Antoine Pitrou - Aaron Iles + Christian Hudon Michael Cheng Justas Sadzevicius Gasper Zejn @@ -201,8 +202,8 @@ Stanislaw Halik Mikael Schönenberg Berkin Ilbeyi + Faye Zhao Elmo Mäntynen - Faye Zhao Jonathan David Riehl Anders Qvist Corbin Simpson @@ -211,11 +212,12 @@ Alex Perry Vaibhav Sood Alan McIntyre + Reuben Cummings Alexander Sedov p_ziesch...@yahoo.de Attila Gobi - Jasper.Schulz Christopher Pope + Aaron Gallagher Florin Papa Christian Tismer Marc Abramowitz @@ -232,7 +234,6 @@ Gabriel Lukas Vacek Kunal Grover - Aaron Gallagher Andrew Dalke Sylvain Thenault Jakub Stasiak @@ -255,6 +256,7 @@ Philipp Rustemeuer Henrik Vendelbo Richard Lancaster + Yasir Suhail Dan Buch Miguel de Val Borro Artur Lisiecki @@ -267,6 +269,7 @@ Catalin Gabriel Manciu Tomo Cocoa Kim Jin Su + rafalgalczyn...@gmail.com Toni Mattis Amber Brown Lucas Stadler @@ -294,9 +297,7 @@ Michael Hudson-Doyle Anders Sigfridsson Nikolay Zinov - Yasir Suhail Jason Michalski - rafalgalczyn...@gmail.com Floris Bruynooghe Laurens Van Houtven Akira Li @@ -310,9 +311,10 @@ James Lan Volodymyr Vladymyrov shoma hosaka - Daniel Neuhäuser Ben Mather Niclas Olofsson + Matthew Miller + Rodrigo Araújo halgari Boglarka Vezer Chris Pressey @@ -322,8 +324,9 @@ Dinu Gherman Chris Lambacher coolbutusel...@gmail.com + Daniil Yarancev Jim Baker - Rodrigo Araújo + Dan Crosta Nikolaos-Digenis Karagiannis James Robert Armin Ronacher @@ -337,32 +340,31 @@ Tomer Chachamu Christopher Groskopf Asmo Soinio - Stefan Marr jiaaro Mads Kiilerich - opassembler.py Antony Lee Jason Madden + Daniel Neuh�user + reub...@gmail.com Yaroslav Fedevych Jim Hunziker Markus Unterwaditzer Even Wiik Thomassen jbs squeaky - Zearin soareschen Jonas Pfannschmidt Kurt Griffiths Mike Bayer - Matthew Miller + Stefan Marr Flavio Percoco Kristoffer Kleine - yasirs Michael Chermside Anna Ravencroft pizi + remarkablerocket Andrey Churin - Dan Crosta + Zearin Eli Stevens Tobias Diaz Julien Phalip diff --git a/lib-python/2.7/ctypes/test/test_bitfields.py b/lib-python/2.7/ctypes/test/test_bitfields.py --- a/lib-python/2.7/ctypes/test/test_bitfields.py +++ b/lib-python/2.7/ctypes/test/test_bitfields.py @@ -2,6 +2,7 @@ from ctypes.test import need_symbol, xfail import unittest import os +import sys import ctypes import _ctypes_test @@ -279,7 +280,6 @@ x.c = 2 self.assertEqual(b.tostring(), b'\xef\xcd\xab\x21') - @xfail @need_symbol('c_uint32') def test_uint32_swap_big_endian(self): # Issue #23319 @@ -295,5 +295,11 @@ x.c = 2 self.assertEqual(b.tostring(), b'\xab\xcd\xef\x12') + # see issue #1213, on big endian it fails for the little endian case + if sys.byteorder == 'little': + test_uint32_swap_big_endian = xfail(test_uint32_swap_big_endian) + elif sys.byteorder == 'big': + test_uint32_swap_little_endian = xfail(test_uint32_swap_little_endian) + if __name__ == "__main__": unittest.main() diff --git a/lib-python/2.7/test/test_ssl.py b/lib-python/2.7/test/test_ssl.py --- a/lib-python/2.7/test/test_ssl.py +++ b/lib-python/2.7/test/test_ssl.py @@ -26,6 +26,8 @@ PROTOCOLS = sorted(ssl._PROTOCOL_NAMES) HOST = support.HOST +IS_LIBRESSL = ssl.OPENSSL_VERSION.startswith('LibreSSL') +IS_OPENSSL_1_1 = not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0) def data_file(*name): return os.path.join(os.path.dirname(__file__), *name) @@ -742,15 +744,15 @@ def test_options(self): ctx = ssl.SSLContext(ssl.PROTOCOL_TLSv1) # OP_ALL | OP_NO_SSLv2 | OP_NO_SSLv3 is the default value - self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3, - ctx.options) + default = (ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3) + if not IS_LIBRESSL and ssl.OPENSSL_VERSION_INFO >= (1, 1, 0): + default |= ssl.OP_NO_COMPRESSION + self.assertEqual(default, ctx.options) ctx.options |= ssl.OP_NO_TLSv1 - self.assertEqual(ssl.OP_ALL | ssl.OP_NO_SSLv2 | ssl.OP_NO_SSLv3 | ssl.OP_NO_TLSv1, - ctx.options) + self.assertEqual(default | ssl.OP_NO_TLSv1, ctx.options) if can_clear_options(): - ctx.options = (ctx.options & ~ssl.OP_NO_SSLv2) | ssl.OP_NO_TLSv1 - self.assertEqual(ssl.OP_ALL | ssl.OP_NO_TLSv1 | ssl.OP_NO_SSLv3, - ctx.options) + ctx.options = (ctx.options & ~ssl.OP_NO_TLSv1) + self.assertEqual(default, ctx.options) ctx.options = 0 self.assertEqual(0, ctx.options) else: @@ -2918,18 +2920,27 @@ client_context = ssl.SSLContext(ssl.PROTOCOL_TLSv1) client_context.load_cert_chain(CERTFILE) client_context.set_alpn_protocols(client_protocols) - stats = server_params_test(client_context, server_context, - chatty=True, connectionchatty=True) - - msg = "failed trying %s (s) and %s (c).\n" \ - "was expecting %s, but got %%s from the %%s" \ - % (str(server_protocols), str(client_protocols), - str(expected)) - client_result = stats['client_alpn_protocol'] - self.assertEqual(client_result, expected, msg % (client_result, "client")) - server_result = stats['server_alpn_protocols'][-1] \ - if len(stats['server_alpn_protocols']) else 'nothing' - self.assertEqual(server_result, expected, msg % (server_result, "server")) + try: + stats = server_params_test(client_context, server_context, + chatty=True, connectionchatty=True) + except ssl.SSLError as e: + stats = e + + if expected is None and IS_OPENSSL_1_1: + # OpenSSL 1.1.0 raises handshake error + self.assertIsInstance(stats, ssl.SSLError) + else: + msg = "failed trying %s (s) and %s (c).\n" \ + "was expecting %s, but got %%s from the %%s" \ + % (str(server_protocols), str(client_protocols), + str(expected)) + client_result = stats['client_alpn_protocol'] + self.assertEqual(client_result, expected, + msg % (client_result, "client")) + server_result = stats['server_alpn_protocols'][-1] \ + if len(stats['server_alpn_protocols']) else 'nothing' + self.assertEqual(server_result, expected, + msg % (server_result, "server")) def test_selected_npn_protocol(self): # selected_npn_protocol() is None unless NPN is used diff --git a/lib-python/3/ssl.py b/lib-python/3/ssl.py --- a/lib-python/3/ssl.py +++ b/lib-python/3/ssl.py @@ -745,8 +745,7 @@ # non-blocking raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets") self.do_handshake() - - except (OSError, ValueError): + except: self.close() raise diff --git a/lib-python/3/test/test_bytes.py b/lib-python/3/test/test_bytes.py --- a/lib-python/3/test/test_bytes.py +++ b/lib-python/3/test/test_bytes.py @@ -1006,9 +1006,13 @@ def test_del_expand(self): # Reducing the size should not expand the buffer (issue #23985) b = bytearray(10) - size = sys.getsizeof(b) - del b[:1] - self.assertLessEqual(sys.getsizeof(b), size) + try: + size = sys.getsizeof(b) + except TypeError: + pass # e.g. on pypy + else: + del b[:1] + self.assertLessEqual(sys.getsizeof(b), size) def test_extended_set_del_slice(self): indices = (0, None, 1, 3, 19, 300, 1<<333, -1, -2, -31, -300) diff --git a/lib-python/3/test/test_collections.py b/lib-python/3/test/test_collections.py --- a/lib-python/3/test/test_collections.py +++ b/lib-python/3/test/test_collections.py @@ -13,6 +13,7 @@ import re import sys import types +import gc from collections import UserDict, UserString, UserList from collections import ChainMap from collections import deque @@ -1630,7 +1631,7 @@ ################################################################################ py_coll = import_fresh_module('collections', blocked=['_collections']) -c_coll = import_fresh_module('collections', fresh=['_collections']) +c_coll = import_fresh_module('_collections', fresh=['_collections']) @contextlib.contextmanager @@ -2052,7 +2053,9 @@ obj = MyOD([(None, obj)]) obj.i = i del obj - support.gc_collect() + # PyPy change: we only collect 1 MyOD instance per GC + for _ in range(100): + gc.collect() self.assertEqual(deleted, list(reversed(range(100)))) def test_delitem_hash_collision(self): @@ -2212,11 +2215,11 @@ OrderedDict = py_coll.OrderedDict -@unittest.skipUnless(c_coll, 'requires the C version of the collections module') +@unittest.skipUnless(hasattr(c_coll, 'OrderedDict'), 'requires the C version of the collections module') class CPythonOrderedDictTests(OrderedDictTests, unittest.TestCase): module = c_coll - OrderedDict = c_coll.OrderedDict + OrderedDict = getattr(c_coll, 'OrderedDict', None) def test_key_change_during_iteration(self): OrderedDict = self.OrderedDict @@ -2246,8 +2249,10 @@ class CPythonOrderedDictSubclassTests(CPythonOrderedDictTests): module = c_coll - class OrderedDict(c_coll.OrderedDict): - pass + + if hasattr(c_coll, 'OrderedDict'): + class OrderedDict(c_coll.OrderedDict): + pass class PurePythonGeneralMappingTests(mapping_tests.BasicTestMappingProtocol): @@ -2261,7 +2266,7 @@ self.assertRaises(KeyError, d.popitem) -@unittest.skipUnless(c_coll, 'requires the C version of the collections module') +@unittest.skipUnless(hasattr(c_coll, 'OrderedDict'), 'requires the C version of the collections module') class CPythonGeneralMappingTests(mapping_tests.BasicTestMappingProtocol): @classmethod @@ -2286,7 +2291,7 @@ self.assertRaises(KeyError, d.popitem) -@unittest.skipUnless(c_coll, 'requires the C version of the collections module') +@unittest.skipUnless(hasattr(c_coll, 'OrderedDict'), 'requires the C version of the collections module') class CPythonSubclassMappingTests(mapping_tests.BasicTestMappingProtocol): @classmethod diff --git a/lib-python/3/test/test_functools.py b/lib-python/3/test/test_functools.py --- a/lib-python/3/test/test_functools.py +++ b/lib-python/3/test/test_functools.py @@ -129,6 +129,7 @@ p = proxy(f) self.assertEqual(f.func, p.func) f = None + support.gc_collect() self.assertRaises(ReferenceError, getattr, p, 'func') def test_with_bound_and_unbound_methods(self): @@ -229,13 +230,7 @@ raise IndexError f = self.partial(object) - if support.check_impl_detail(pypy=True): - # CPython fails, pypy does not :-) - f.__setstate__(BadSequence()) - else: - self.assertRaisesRegex(SystemError, - "new style getargs format but argument is not a tuple", - f.__setstate__, BadSequence()) + self.assertRaises(TypeError, f.__setstate__, BadSequence()) class TestPartialPy(TestPartial, unittest.TestCase): diff --git a/lib-python/3/test/test_generators.py b/lib-python/3/test/test_generators.py --- a/lib-python/3/test/test_generators.py +++ b/lib-python/3/test/test_generators.py @@ -96,8 +96,8 @@ # generator names must be a string and cannot be deleted self.assertRaises(TypeError, setattr, gen, '__name__', 123) self.assertRaises(TypeError, setattr, gen, '__qualname__', 123) - self.assertRaises(TypeError, delattr, gen, '__name__') - self.assertRaises(TypeError, delattr, gen, '__qualname__') + self.assertRaises((TypeError, AttributeError), delattr, gen, '__name__') + self.assertRaises((TypeError, AttributeError), delattr, gen, '__qualname__') # modify names of the function creating the generator func.__qualname__ = "func_qualname" diff --git a/lib-python/3/test/test_httpservers.py b/lib-python/3/test/test_httpservers.py --- a/lib-python/3/test/test_httpservers.py +++ b/lib-python/3/test/test_httpservers.py @@ -254,7 +254,8 @@ with support.captured_stderr() as err: self.con.request('GET', '/') - self.con.getresponse() + with self.con.getresponse(): + pass self.assertTrue( err.getvalue().endswith('"GET / HTTP/1.1" 200 -\n')) @@ -265,7 +266,8 @@ with support.captured_stderr() as err: self.con.request('ERROR', '/') - self.con.getresponse() + with self.con.getresponse(): + pass lines = err.getvalue().split('\n') self.assertTrue(lines[0].endswith('code 404, message File not found')) diff --git a/lib-python/3/test/test_logging.py b/lib-python/3/test/test_logging.py --- a/lib-python/3/test/test_logging.py +++ b/lib-python/3/test/test_logging.py @@ -1665,7 +1665,7 @@ logger = logging.getLogger("http") root_logger = self.root_logger root_logger.removeHandler(self.root_logger.handlers[0]) - for secure in (False, True): + for secure in (False,): # XXX: disable SSL tests until it works addr = ('localhost', 0) if secure: try: diff --git a/lib-python/3/test/test_sax.py b/lib-python/3/test/test_sax.py --- a/lib-python/3/test/test_sax.py +++ b/lib-python/3/test/test_sax.py @@ -16,7 +16,6 @@ from xml.sax.xmlreader import InputSource, AttributesImpl, AttributesNSImpl from io import BytesIO, StringIO import codecs -import gc import os.path import shutil from test import support @@ -180,7 +179,7 @@ with self.assertRaises(SAXException): self.check_parse(TESTFN) # Collect leaked file. - gc.collect() + support.gc_collect() with open(TESTFN, 'rb') as f: with self.assertRaises(SAXException): self.check_parse(f) diff --git a/lib-python/3/test/test_ssl.py b/lib-python/3/test/test_ssl.py --- a/lib-python/3/test/test_ssl.py +++ b/lib-python/3/test/test_ssl.py @@ -1898,7 +1898,14 @@ else: self.sock.close() + # PyPy change def run(self): + try: + self._run() + finally: + self.close() + + def _run(self): self.running = True if not self.server.starttls_server: if not self.wrap_conn(): diff --git a/lib-python/3/test/test_urllib2_localnet.py b/lib-python/3/test/test_urllib2_localnet.py --- a/lib-python/3/test/test_urllib2_localnet.py +++ b/lib-python/3/test/test_urllib2_localnet.py @@ -544,6 +544,7 @@ self.assertEqual(handler.requests, ["/bizarre", b"get=with_feeling"]) def test_https(self): + self.skipTest('Segfaults on PyPy') handler = self.start_https_server() context = ssl.create_default_context(cafile=CERT_localhost) data = self.urlopen("https://localhost:%s/bizarre" % handler.port, context=context) @@ -573,6 +574,7 @@ cadefault=True) def test_https_sni(self): + self.skipTest('Segfaults on PyPy') if ssl is None: self.skipTest("ssl module required") if not ssl.HAS_SNI: diff --git a/lib-python/3/tkinter/test/test_tkinter/test_images.py b/lib-python/3/tkinter/test/test_tkinter/test_images.py --- a/lib-python/3/tkinter/test/test_tkinter/test_images.py +++ b/lib-python/3/tkinter/test/test_tkinter/test_images.py @@ -36,6 +36,7 @@ self.assertEqual(image.height(), 16) self.assertIn('::img::test', self.root.image_names()) del image + support.gc_collect() self.assertNotIn('::img::test', self.root.image_names()) def test_create_from_data(self): @@ -50,6 +51,7 @@ self.assertEqual(image.height(), 16) self.assertIn('::img::test', self.root.image_names()) del image + support.gc_collect() self.assertNotIn('::img::test', self.root.image_names()) def assertEqualStrList(self, actual, expected): @@ -130,6 +132,7 @@ self.assertEqual(image['file'], testfile) self.assertIn('::img::test', self.root.image_names()) del image + support.gc_collect() self.assertNotIn('::img::test', self.root.image_names()) def check_create_from_data(self, ext): @@ -147,6 +150,7 @@ self.assertEqual(image['file'], '') self.assertIn('::img::test', self.root.image_names()) del image + support.gc_collect() self.assertNotIn('::img::test', self.root.image_names()) def test_create_from_ppm_file(self): diff --git a/lib-python/3/tkinter/test/test_ttk/test_extensions.py b/lib-python/3/tkinter/test/test_ttk/test_extensions.py --- a/lib-python/3/tkinter/test/test_ttk/test_extensions.py +++ b/lib-python/3/tkinter/test/test_ttk/test_extensions.py @@ -2,7 +2,7 @@ import unittest import tkinter from tkinter import ttk -from test.support import requires, run_unittest, swap_attr +from test.support import requires, run_unittest, swap_attr, gc_collect from tkinter.test.support import AbstractTkTest, destroy_default_root requires('gui') diff --git a/lib-python/3/tkinter/test/test_ttk/test_widgets.py b/lib-python/3/tkinter/test/test_ttk/test_widgets.py --- a/lib-python/3/tkinter/test/test_ttk/test_widgets.py +++ b/lib-python/3/tkinter/test/test_ttk/test_widgets.py @@ -1,7 +1,7 @@ import unittest import tkinter from tkinter import ttk, TclError -from test.support import requires +from test.support import requires, gc_collect import sys from tkinter.test.test_ttk.test_functions import MockTclObj @@ -837,6 +837,7 @@ self.assertEqual(conv(self.scale.get()), var.get()) self.assertEqual(conv(self.scale.get()), max + 5) del var + gc_collect() # the same happens with the value option self.scale['value'] = max + 10 diff --git a/lib_pypy/_functools.py b/lib_pypy/_functools.py --- a/lib_pypy/_functools.py +++ b/lib_pypy/_functools.py @@ -42,6 +42,13 @@ self, func, args = args[0], args[1], args[2:] if not callable(func): raise TypeError("the first argument must be callable") + if isinstance(func, partial): + args = func._args + args + tmpkw = func._keywords.copy() + tmpkw.update(keywords) + keywords = tmpkw + del tmpkw + func = func._func self._func = func self._args = args self._keywords = keywords @@ -113,3 +120,24 @@ self.__dict__.clear() else: self.__dict__.update(d) + + +@builtinify +def cmp_to_key(mycmp): + """Convert a cmp= function into a key= function""" + class K(object): + __slots__ = ['obj'] + def __init__(self, obj): + self.obj = obj + def __lt__(self, other): + return mycmp(self.obj, other.obj) < 0 + def __gt__(self, other): + return mycmp(self.obj, other.obj) > 0 + def __eq__(self, other): + return mycmp(self.obj, other.obj) == 0 + def __le__(self, other): + return mycmp(self.obj, other.obj) <= 0 + def __ge__(self, other): + return mycmp(self.obj, other.obj) >= 0 + __hash__ = None + return K diff --git a/lib_pypy/_libmpdec/io.c b/lib_pypy/_libmpdec/io.c --- a/lib_pypy/_libmpdec/io.c +++ b/lib_pypy/_libmpdec/io.c @@ -446,7 +446,7 @@ if (mpd_isspecial(dec)) { - mem = sizeof "-Infinity"; + mem = sizeof "-Infinity%"; if (mpd_isnan(dec) && dec->len > 0) { /* diagnostic code */ mem += dec->digits; @@ -609,10 +609,10 @@ *cp++ = (flags&MPD_FMT_UPPER) ? 'E' : 'e'; cp = exp_to_string(cp, ldigits-dplace); } + } - if (flags&MPD_FMT_PERCENT) { - *cp++ = '%'; - } + if (flags&MPD_FMT_PERCENT) { + *cp++ = '%'; } assert(cp < decstring+mem); @@ -1260,6 +1260,9 @@ stackspec.align = '>'; spec = &stackspec; } + if (type == '%') { + flags |= MPD_FMT_PERCENT; + } } else { uint32_t workstatus = 0; diff --git a/lib_pypy/_libmpdec/mpdecimal.c b/lib_pypy/_libmpdec/mpdecimal.c --- a/lib_pypy/_libmpdec/mpdecimal.c +++ b/lib_pypy/_libmpdec/mpdecimal.c @@ -43,6 +43,7 @@ #ifdef PPRO #if defined(_MSC_VER) #include <float.h> + #pragma float_control(precise, on) #pragma fenv_access(on) #elif !defined(__OpenBSD__) && !defined(__NetBSD__) /* C99 */ diff --git a/lib_pypy/_libmpdec/mpdecimal.h b/lib_pypy/_libmpdec/mpdecimal.h --- a/lib_pypy/_libmpdec/mpdecimal.h +++ b/lib_pypy/_libmpdec/mpdecimal.h @@ -108,9 +108,13 @@ #define MPD_MAJOR_VERSION 2 #define MPD_MINOR_VERSION 4 -#define MPD_MICRO_VERSION 0 +#define MPD_MICRO_VERSION 1 -#define MPD_VERSION "2.4.0" +#define MPD_VERSION "2.4.1" + +#define MPD_VERSION_HEX ((MPD_MAJOR_VERSION << 24) | \ + (MPD_MINOR_VERSION << 16) | \ + (MPD_MICRO_VERSION << 8)) const char *mpd_version(void); diff --git a/lib_pypy/_tkinter/app.py b/lib_pypy/_tkinter/app.py --- a/lib_pypy/_tkinter/app.py +++ b/lib_pypy/_tkinter/app.py @@ -359,7 +359,7 @@ for i in range(objc[0]): result.append(FromObj(self, objv[0][i])) return tuple(result) - elif isinstance(arg, tuple): + elif isinstance(arg, (tuple, list)): return self._splitObj(arg) if isinstance(arg, str): arg = arg.encode('utf-8') @@ -378,6 +378,8 @@ return tuple(result) elif isinstance(arg, tuple): return arg + elif isinstance(arg, list): + return tuple(arg) elif isinstance(arg, str): arg = arg.encode('utf8') @@ -411,6 +413,9 @@ result[i] = newelem if result is not None: return tuple(result) + if isinstance(arg, list): + # Recursively invoke SplitObj for all list items. + return tuple(self._splitObj(elem) for elem in arg) elif isinstance(arg, str): argc = tkffi.new("int*") argv = tkffi.new("char***") @@ -483,7 +488,10 @@ def getboolean(self, s): if isinstance(s, int): return bool(s) - s = s.encode('utf-8') + try: + s = s.encode('utf-8') + except AttributeError: + raise TypeError if b'\x00' in s: raise TypeError v = tkffi.new("int*") @@ -493,9 +501,12 @@ return bool(v[0]) def getint(self, s): - if isinstance(s, (int, long)): + if isinstance(s, int): return s - s = s.encode('utf-8') + try: + s = s.encode('utf-8') + except AttributeError: + raise TypeError if b'\x00' in s: raise TypeError if tklib.HAVE_LIBTOMMATH or tklib.HAVE_WIDE_INT_TYPE: @@ -517,11 +528,14 @@ return v[0] def getdouble(self, s): - if isinstance(s, float): - return s - if '\x00' in s: + if isinstance(s, (float, int)): + return float(s) + try: + s = s.encode('utf-8') + except AttributeError: raise TypeError - s = s.encode('utf-8') + if b'\x00' in s: + raise TypeError v = tkffi.new("double*") res = tklib.Tcl_GetDouble(self.interp, s, v) if res == tklib.TCL_ERROR: diff --git a/lib_pypy/_tkinter/tclobj.py b/lib_pypy/_tkinter/tclobj.py --- a/lib_pypy/_tkinter/tclobj.py +++ b/lib_pypy/_tkinter/tclobj.py @@ -70,7 +70,7 @@ def AsBignumObj(value): sign = -1 if value < 0 else 1 - hexstr = '%x' % abs(value) + hexstr = b'%x' % abs(value) bigValue = tkffi.new("mp_int*") tklib.mp_init(bigValue) try: @@ -133,7 +133,7 @@ def AsObj(value): if isinstance(value, bytes): - return tklib.Tcl_NewStringObj(value, len(value)) + return tklib.Tcl_NewByteArrayObj(value, len(value)) if isinstance(value, bool): return tklib.Tcl_NewBooleanObj(value) if isinstance(value, int): @@ -151,7 +151,7 @@ return AsBignumObj(value) if isinstance(value, float): return tklib.Tcl_NewDoubleObj(value) - if isinstance(value, tuple): + if isinstance(value, (tuple, list)): argv = tkffi.new("Tcl_Obj*[]", len(value)) for i in range(len(value)): argv[i] = AsObj(value[i]) 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.8.4 +Version: 1.9.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.8.4" -__version_info__ = (1, 8, 4) +__version__ = "1.9.0" +__version_info__ = (1, 9, 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 @@ -141,9 +141,9 @@ #define _cffi_to_c_char \ ((int(*)(PyObject *))_cffi_exports[9]) #define _cffi_from_c_pointer \ - ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[10]) + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[10]) #define _cffi_to_c_pointer \ - ((char *(*)(PyObject *, CTypeDescrObject *))_cffi_exports[11]) + ((char *(*)(PyObject *, struct _cffi_ctypedescr *))_cffi_exports[11]) #define _cffi_get_struct_layout \ not used any more #define _cffi_restore_errno \ @@ -153,11 +153,11 @@ #define _cffi_from_c_char \ ((PyObject *(*)(char))_cffi_exports[15]) #define _cffi_from_c_deref \ - ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[16]) + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[16]) #define _cffi_to_c \ - ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[17]) + ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[17]) #define _cffi_from_c_struct \ - ((PyObject *(*)(char *, CTypeDescrObject *))_cffi_exports[18]) + ((PyObject *(*)(char *, struct _cffi_ctypedescr *))_cffi_exports[18]) #define _cffi_to_c_wchar_t \ ((wchar_t(*)(PyObject *))_cffi_exports[19]) #define _cffi_from_c_wchar_t \ @@ -167,21 +167,22 @@ #define _cffi_to_c__Bool \ ((_Bool(*)(PyObject *))_cffi_exports[22]) #define _cffi_prepare_pointer_call_argument \ - ((Py_ssize_t(*)(CTypeDescrObject *, PyObject *, char **))_cffi_exports[23]) + ((Py_ssize_t(*)(struct _cffi_ctypedescr *, \ + PyObject *, char **))_cffi_exports[23]) #define _cffi_convert_array_from_object \ - ((int(*)(char *, CTypeDescrObject *, PyObject *))_cffi_exports[24]) + ((int(*)(char *, struct _cffi_ctypedescr *, PyObject *))_cffi_exports[24]) #define _CFFI_CPIDX 25 #define _cffi_call_python \ ((void(*)(struct _cffi_externpy_s *, char *))_cffi_exports[_CFFI_CPIDX]) #define _CFFI_NUM_EXPORTS 26 -typedef struct _ctypedescr CTypeDescrObject; +struct _cffi_ctypedescr; static void *_cffi_exports[_CFFI_NUM_EXPORTS]; #define _cffi_type(index) ( \ assert((((uintptr_t)_cffi_types[index]) & 1) == 0), \ - (CTypeDescrObject *)_cffi_types[index]) + (struct _cffi_ctypedescr *)_cffi_types[index]) static PyObject *_cffi_init(const char *module_name, Py_ssize_t version, const struct _cffi_type_context_s *ctx) 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.8.4" + "\ncompiled with cffi version: 1.9.0" "\n_cffi_backend module: ", f); modules = PyImport_GetModuleDict(); mod = PyDict_GetItemString(modules, "_cffi_backend"); @@ -366,7 +366,7 @@ const char *code; } _cffi_pypy_init = { _CFFI_MODULE_NAME, - _CFFI_PYTHON_STARTUP_FUNC, + (void(*)(const void *[]))_CFFI_PYTHON_STARTUP_FUNC, _CFFI_PYTHON_STARTUP_CODE, }; diff --git a/pypy/doc/contributor.rst b/pypy/doc/contributor.rst --- a/pypy/doc/contributor.rst +++ b/pypy/doc/contributor.rst @@ -9,8 +9,8 @@ Philip Jenvey Ronan Lamy Brian Kearns + Richard Plangger Michael Hudson - Richard Plangger Manuel Jacob David Schneider Holger Krekel @@ -54,10 +54,10 @@ Jason Creighton Mark Young Alex Martelli + Spenser Bauman Michal Bendowski stian Jan de Mooij - Spenser Bauman Tyler Wade Vincent Legoll Michael Foord @@ -65,13 +65,13 @@ Stefan Schwarzer Valentino Volonghi Tomek Meka + Stefano Rivera Patrick Maupin Devin Jeanpierre Bob Ippolito Bruno Gola David Malcolm Jean-Paul Calderone - Stefano Rivera Timo Paulssen Edd Barrett Squeaky @@ -89,12 +89,12 @@ Dario Bertini Mark Pearse Simon Cross + Jeremy Thurgood Andreas Stührk Tobias Pape Jean-Philippe St. Pierre Guido van Rossum Pavel Vinogradov - Jeremy Thurgood Paweł Piotr Przeradowski Paul deGrandis Ilya Osadchiy @@ -128,10 +128,11 @@ Anton Gulenko Amit Regmi Ben Young - Sergey Matyunin + Jasper Schulz Nicolas Chauvat Andrew Durdin Andrew Chambers + Sergey Matyunin Michael Schneider Nicholas Riley Jason Chu @@ -147,17 +148,16 @@ Jared Grubb Karl Bartel Wouter van Heyst - Sebastian Pawluś Brian Dorsey Victor Stinner Andrews Medina + Sebastian Pawluś Stuart Williams Daniel Patrick - Jasper Schulz - Christian Hudon + Aaron Iles Toby Watson Antoine Pitrou - Aaron Iles + Christian Hudon Michael Cheng Justas Sadzevicius Gasper Zejn @@ -165,8 +165,8 @@ Stanislaw Halik Mikael Schönenberg Berkin Ilbeyi + Faye Zhao Elmo Mäntynen - Faye Zhao Jonathan David Riehl Anders Qvist Corbin Simpson @@ -175,11 +175,12 @@ Alex Perry Vaibhav Sood Alan McIntyre + Reuben Cummings Alexander Sedov p_ziesch...@yahoo.de Attila Gobi - Jasper.Schulz Christopher Pope + Aaron Gallagher Florin Papa Christian Tismer Marc Abramowitz @@ -196,7 +197,6 @@ Gabriel Lukas Vacek Kunal Grover - Aaron Gallagher Andrew Dalke Sylvain Thenault Jakub Stasiak @@ -219,6 +219,7 @@ Philipp Rustemeuer Henrik Vendelbo Richard Lancaster + Yasir Suhail Dan Buch Miguel de Val Borro Artur Lisiecki @@ -231,6 +232,7 @@ Catalin Gabriel Manciu Tomo Cocoa Kim Jin Su + rafalgalczyn...@gmail.com Toni Mattis Amber Brown Lucas Stadler @@ -258,9 +260,7 @@ Michael Hudson-Doyle Anders Sigfridsson Nikolay Zinov - Yasir Suhail Jason Michalski - rafalgalczyn...@gmail.com Floris Bruynooghe Laurens Van Houtven Akira Li @@ -274,10 +274,10 @@ James Lan Volodymyr Vladymyrov shoma hosaka - Daniel Neuhäuser Ben Mather Niclas Olofsson - "Aaron Gallagher + Matthew Miller + Rodrigo Araújo halgari Boglarka Vezer Chris Pressey @@ -287,8 +287,9 @@ Dinu Gherman Chris Lambacher coolbutusel...@gmail.com + Daniil Yarancev Jim Baker - Rodrigo Araújo + Dan Crosta Nikolaos-Digenis Karagiannis James Robert Armin Ronacher @@ -302,13 +303,11 @@ Tomer Chachamu Christopher Groskopf Asmo Soinio - Stefan Marr jiaaro Mads Kiilerich - opassembler.py - JohnDoe Antony Lee Jason Madden + Daniel Neuh�user reub...@gmail.com Yaroslav Fedevych Jim Hunziker @@ -316,25 +315,24 @@ Even Wiik Thomassen jbs squeaky - Zearin soareschen Jonas Pfannschmidt Kurt Griffiths Mike Bayer - Matthew Miller + Stefan Marr Flavio Percoco Kristoffer Kleine - yasirs Michael Chermside Anna Ravencroft pizi remarkablerocket Andrey Churin - Dan Crosta + Zearin Eli Stevens Tobias Diaz Julien Phalip Roman Podoliaka Dan Loewenherz werat - hgattic + + diff --git a/pypy/doc/faq.rst b/pypy/doc/faq.rst --- a/pypy/doc/faq.rst +++ b/pypy/doc/faq.rst @@ -407,3 +407,18 @@ long and gnarly. On the other hand, all our infrastructure (buildbots, benchmarking, etc) would have to be adapted. So unless somebody steps up and volunteers to do all that work, it will likely not happen. + + +What is needed for Windows 64 support of PyPy? +----------------------------------------------- + +First, please note that the Windows 32 PyPy binary works just fine on Windows +64. The only problem is that it only supports up to 4GB of heap per process. + +As to real Windows 64 support: Currently we don't have an active PyPy developer +whose main development platform is Windows. So if you are interested in getting +Windows 64 support, we encourage you to volunteer `to make it happen`_! Another +option would be to pay some PyPy developers to implement Windows 64 support, +but so far there doesn't seem to be an overwhelming commercial interest in it. + +.. _`to make it happen`: windows.html#what-is-missing-for-a-full-64-bit-translation diff --git a/pypy/doc/how-to-release.rst b/pypy/doc/how-to-release.rst --- a/pypy/doc/how-to-release.rst +++ b/pypy/doc/how-to-release.rst @@ -1,4 +1,4 @@ -The PyPy Release Process +PyPy's Release Process ======================== Release Policy @@ -39,41 +39,60 @@ Some of the next updates may be done before or after branching; make sure things are ported back to the trunk and to the branch as necessary. -* update pypy/doc/contributor.rst (and possibly LICENSE) - pypy/doc/tool/makecontributor.py generates the list of contributors -* rename pypy/doc/whatsnew_head.rst to whatsnew_VERSION.rst - create a fresh whatsnew_head.rst after the release - and add the new file to pypy/doc/index-of-whatsnew.rst -* go to pypy/tool/release and run - ``force-builds.py <release branch>`` - The following JIT binaries should be built, however, we need more buildbots - windows, linux-32, linux-64, osx64, armhf-raring, armhf-raspberrian, armel, - freebsd64 -* wait for builds to complete, make sure there are no failures -* download the builds, repackage binaries. Tag the release version - and download and repackage source from bitbucket. You may find it - convenient to use the ``repackage.sh`` script in pypy/tool/release to do this. +* Update and write documentation - Otherwise repackage and upload source "-src.tar.bz2" to bitbucket - and to cobra, as some packagers prefer a clearly labeled source package - ( download e.g. https://bitbucket.org/pypy/pypy/get/release-2.5.x.tar.bz2, - unpack, rename the top-level directory to "pypy-2.5.0-src", repack, and upload) + * update pypy/doc/contributor.rst (and possibly LICENSE) + pypy/doc/tool/makecontributor.py generates the list of contributors -* Upload binaries to https://bitbucket.org/pypy/pypy/downloads + * rename pypy/doc/whatsnew_head.rst to whatsnew_VERSION.rst + create a fresh whatsnew_head.rst after the release + and add the new file to pypy/doc/index-of-whatsnew.rst -* write release announcement pypy/doc/release-x.y(.z).txt + * write release announcement pypy/doc/release-VERSION.rst + The release announcement should contain a direct link to the download page - The release announcement should contain a direct link to the download page + * Add the new files to pypy/doc/index-of-{whatsnew,release-notes}.rst -* Add the new files to pypy/doc/index-of-{whatsnew,release-notes}.rst +* Build and upload the release tar-balls -* update pypy.org (under extradoc/pypy.org), rebuild and commit + * go to pypy/tool/release and run + ``force-builds.py <release branch>`` + The following JIT binaries should be built, however, we need more buildbots + windows, linux-32, linux-64, osx64, armhf-raring, armhf-raspberrian, armel, + freebsd64 -* post announcement on morepypy.blogspot.com -* send announcements to twitter.com, pypy-dev, python-list, - python-announce, python-dev ... + * wait for builds to complete, make sure there are no failures -* add a tag on the pypy/jitviewer repo that corresponds to pypy release -* add a tag on the codespeed web site that corresponds to pypy release -* revise versioning at https://readthedocs.org/projects/pypy + * send out a mailing list message asking for people to test before uploading + to prevent having to upload more than once + + * add a tag on the pypy/jitviewer repo that corresponds to pypy release, so + that the source tarball can be produced in the next steps + + * download the builds, repackage binaries. Tag the release version + and download and repackage source from bitbucket. You may find it + convenient to use the ``repackage.sh`` script in pypy/tool/release to do this. + + Otherwise repackage and upload source "-src.tar.bz2" to bitbucket + and to cobra, as some packagers prefer a clearly labeled source package + ( download e.g. https://bitbucket.org/pypy/pypy/get/release-2.5.x.tar.bz2, + unpack, rename the top-level directory to "pypy-2.5.0-src", repack, and upload) + + * Upload binaries to https://bitbucket.org/pypy/pypy/downloads + +* Send out a mailing list message asking for last-minute comments and testing + +* RELEASE ! + + * update pypy.org (under extradoc/pypy.org), rebuild and commit, using the + hashes produced from the ``repackage.sh`` script or by hand + + * post announcement on morepypy.blogspot.com + * send announcements to twitter.com, pypy-dev, python-list, + python-announce, python-dev ... + +* If all is OK, document the released version + + * add a tag on the codespeed web site that corresponds to pypy release + * revise versioning at https://readthedocs.org/projects/pypy 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.6.0.rst release-pypy2.7-v5.4.1.rst release-pypy2.7-v5.4.0.rst release-pypy2.7-v5.3.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.6.0.rst whatsnew-pypy2-5.4.0.rst whatsnew-pypy2-5.3.1.rst whatsnew-pypy2-5.3.0.rst diff --git a/pypy/doc/release-pypy2.7-v5.6.0.rst b/pypy/doc/release-pypy2.7-v5.6.0.rst --- a/pypy/doc/release-pypy2.7-v5.6.0.rst +++ b/pypy/doc/release-pypy2.7-v5.6.0.rst @@ -6,17 +6,24 @@ This new PyPy2.7 release includes the upstream stdlib version 2.7.12. We continue to make incremental improvements to our C-API -compatability layer (cpyext). We pass all but a few of the tests in the +compatibility layer (cpyext). We pass all but a few of the tests in the upstream numpy `test suite`_. Work proceeds at a good pace on the PyPy3.5 version due to a grant_ from the Mozilla Foundation, and some of those -changes have been backported to PyPy2.7 where relevant +changes have been backported to PyPy2.7 where relevant. + +The PowerPC and s390x backend have been enhanced_ with the capability use SIMD instructions + for micronumpy loops. We changed ``timeit`` to now report average +- standard deviation, which is better than the misleading minimum value reported in CPython. -XXX +We now support building PyPy with OpenSSL 1.1 in our built-in _ssl module, as +well as maintaining support for previous versions. + +CFFI_ has been updated to 1.9, improving an already great package for +interfacing with C. As always, this release fixed many issues and bugs raised by the growing community of PyPy users. We strongly recommend updating. @@ -35,12 +42,13 @@ with making RPython's JIT even better. .. _`test suite`: https://bitbucket.org/pypy/pypy/wiki/Adventures%20in%20cpyext%20compatibility -.. _cffi: https://cffi.readthedocs.org +.. _CFFI: https://cffi.readthedocs.io/en/latest/whatsnew.html .. _grant: https://morepypy.blogspot.com/2016/08/pypy-gets-funding-from-mozilla-for.html .. _`PyPy`: http://doc.pypy.org .. _`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 +.. _`enhanced`: https://morepypy.blogspot.co.at/2016/11/vectorization-extended-powerpc-and-s390x.html What is PyPy? ============= @@ -64,42 +72,46 @@ * **s390x** running Linux .. _`PyPy and CPython 2.7.x`: http://speed.pypy.org -.. _`dynamic languages`: http://pypyjs.org +.. _`dynamic languages`: http://rpython.readthedocs.io/en/latest/examples.html Other Highlights (since 5.4 released Aug 31, 2016) ========================================================= * New features + * Allow tests run with `-A` to find `libm.so` even if it is a script not a dynamically loadable file - * Backport fixes to rposix on windows from py2.5 + * Backport fixes to rposix on windows from py3.5 * Allow user-defined ``__getitem__`` on subclasses of ``str`` and ``unicode`` * Add ``inode`` to ``scandir()`` on posix systems * Support more attributes on ``super`` * Issue #2386: non-latin1 unicode keys were ignored in ``unicode.format(**d)`` * Restore the ability to translate with CPython - * Update to CFFI 1.8.4 + * Update to CFFI 1.9.0 * Support the new buffer protocol in cpyext and numpypy * Add ``rposix.sync()`` * Support full-precision nanosecond times in os.stat() * Add documentation about the assembler backends to RPYthon * Search for the stdlibs from the libpypy shared object rather than the pypy-c exe, - changes downstream packaging requirments + changes downstream packaging requirements * Add ``try_inline``, like ``always_inline`` and ``dont_inline`` to RPython * Reject ``'a'.strip(buffer(' '))`` like cpython (the argument to strip must be ``str`` or ``unicode``) * Allow ``warning.warn(('something', 1), Warning)`` like on CPython * Refactor ``rclock`` and add some more ``CLOCK_xxx`` constants on relevant platforms - * Backport the ``'faulthandler`` module from py3.5 + * Backport the ``faulthandler`` module from py3.5 * Improve the error message when trying to call a method where the ``self`` parameter is missing in the definition * Implement ``rposix.cpu_count`` * Support translation on FreeBSD running on PowerPC * Implement ``__rmod__`` on ``str`` and ``unicode`` types * Issue warnings for stricter handling of ``__new__``, ``__init__`` args + * When using ``struct.unpack('q', ...`` try harder to prefer int to long + * Support OpenSSL version 1.1 (in addition to version 1.0) * Bug Fixes + * Tweak a float comparison with 0 in `backendopt.inline` to avoid rounding errors * Fix translation of the sandbox * Fix for an issue where `unicode.decode('utf8', 'custom_replace')` messed up @@ -120,6 +132,7 @@ * ``_numpypy.add.reduce`` returns a scalar now * Performance improvements: + * Improve method calls on oldstyle classes * Clean and refactor code for testing cpyext to allow sharing with py3.5 * Refactor a building the map of reflected ops in ``_numpypy`` diff --git a/pypy/doc/test/test_whatsnew.py b/pypy/doc/test/test_whatsnew.py --- a/pypy/doc/test/test_whatsnew.py +++ b/pypy/doc/test/test_whatsnew.py @@ -111,4 +111,4 @@ "hg log -r %s --template '{branch}'" % startrev) if errcode != 0: py.test.skip('no Mercurial repo') - assert wc_branch == 'default' + assert wc_branch in ('default', "'default'") # sometimes the ' leaks (windows) 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 @@ -32,7 +32,7 @@ 'Niklaus Haldimann': ['nik'], 'Alexander Schremmer': ['xoraxax'], 'Anders Hammarquist': ['iko'], - 'David Edelsohn': ['edelsoh', 'edelsohn'], + 'David Edelsohn': ['edelsoh', 'edelsohn','opassembler.py'], 'Niko Matsakis': ['niko'], 'Jakub Gustak': ['jlg'], 'Guido Wesdorp': ['guido'], @@ -75,6 +75,9 @@ 'Spenser Bauman':['Spenser Andrew Bauman'], 'Raffael Tfirst':['raffael.tfi...@gmail.com'], 'timo':['t...@eistee.fritz.box'], + 'Jasper Schulz':['Jasper.Schulz'], + 'Aaron Gallagher':['"Aaron Gallagher'], + 'Yasir Suhail':['yasirs'], } 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,9 +1,9 @@ ========================== -What's new in PyPy2.7 5.4+ +What's new in PyPy2.7 5.6+ ========================== -.. this is a revision shortly after release-pypy2.7-v5.4 -.. startrev: 522736f816dc +.. this is a revision shortly after release-pypy2.7-v5.6 +.. startrev: 7e9787939641 .. branch: mappingproxy .. branch: py3k-finish_time @@ -14,75 +14,8 @@ .. branch: rpython-resync Backport rpython changes made directly on the py3k and py3.5 branches. -.. branch: buffer-interface -Implement PyObject_GetBuffer, PyMemoryView_GET_BUFFER, and handles memoryviews -in numpypy +.. branch: rpython-error-to-systemerror -.. branch: force-virtual-state -Improve merging of virtual states in the JIT in order to avoid jumping to the -preamble. Accomplished by allocating virtual objects where non-virtuals are -expected. - -.. branch: conditional_call_value_3 -JIT residual calls: if the called function starts with a fast-path -like "if x.foo != 0: return x.foo", then inline the check before -doing the CALL. For now, string hashing is about the only case. - -.. branch: search-path-from-libpypy - -The compiled pypy now looks for its lib-python/lib_pypy path starting -from the location of the *libpypy-c* instead of the executable. This is -arguably more consistent, and also it is what occurs anyway if you're -embedding pypy. Linux distribution packagers, take note! At a minimum, -the ``libpypy-c.so`` must really be inside the path containing -``lib-python`` and ``lib_pypy``. Of course, you can put a symlink to it -from somewhere else. You no longer have to do the same with the -``pypy`` executable, as long as it finds its ``libpypy-c.so`` library. - -.. branch: _warnings - -CPython allows warning.warn(('something', 1), Warning), on PyPy this -produced a "expected a readable buffer object" error. Test and fix. - -.. branch: stricter-strip - -CPython rejects 'a'.strip(buffer(' ')); only None, str or unicode are -allowed as arguments. Test and fix for str and unicode - -.. branch: faulthandler - -Port the 'faulthandler' module to PyPy default. This module is standard -in Python 3.3 but can also be installed from CPython >= 2.6 from PyPI. - -.. branch: test-cpyext - -Refactor cpyext testing to be more pypy3-friendly. - -.. branch: better-error-missing-self - -Improve the error message when the user forgot the "self" argument of a method. - - -.. fb6bb835369e -Change the ``timeit`` module: it now prints the average time and the standard -deviation over 7 runs by default, instead of the minimum. The minimum is often -misleading. - -.. branch: unrecursive-opt - -Make optimiseopt iterative instead of recursive so it can be reasoned about -more easily and debugging is faster. - -.. branch: Tiberiumk/fix-2412-1476011166874 -.. branch: redirect-assembler-jitlog - - - -.. branch: stdlib-2.7.12 - -Update stdlib to version 2.7.12 - -.. branch: buffer-interface2 - -Improve support for new buffer interface in cpyext, bf_getbuffer on built-in -types still missing +Any uncaught RPython exception (from a PyPy bug) is turned into an +app-level SystemError. This should improve the lot of users hitting an +uncaught RPython error. diff --git a/pypy/doc/whatsnew-pypy2-5.6.0.rst b/pypy/doc/whatsnew-pypy2-5.6.0.rst new file mode 100644 --- /dev/null +++ b/pypy/doc/whatsnew-pypy2-5.6.0.rst @@ -0,0 +1,113 @@ +========================= +What's new in PyPy2.7 5.6 +========================= + +.. this is a revision shortly after release-pypy2.7-v5.4 +.. startrev: 522736f816dc + +.. branch: mappingproxy +.. branch: py3k-finish_time +.. branch: py3k-kwonly-builtin +.. branch: py3k_add_terminal_size +.. branch: testing-cleanup-py3k + +.. branch: rpython-resync +Backport rpython changes made directly on the py3k and py3.5 branches. + +.. branch: buffer-interface +Implement PyObject_GetBuffer, PyMemoryView_GET_BUFFER, and handles memoryviews +in numpypy + +.. branch: force-virtual-state +Improve merging of virtual states in the JIT in order to avoid jumping to the +preamble. Accomplished by allocating virtual objects where non-virtuals are +expected. + +.. branch: conditional_call_value_3 +JIT residual calls: if the called function starts with a fast-path +like "if x.foo != 0: return x.foo", then inline the check before +doing the CALL. For now, string hashing is about the only case. + +.. branch: search-path-from-libpypy + +The compiled pypy now looks for its lib-python/lib_pypy path starting +from the location of the *libpypy-c* instead of the executable. This is +arguably more consistent, and also it is what occurs anyway if you're +embedding pypy. Linux distribution packagers, take note! At a minimum, +the ``libpypy-c.so`` must really be inside the path containing +``lib-python`` and ``lib_pypy``. Of course, you can put a symlink to it +from somewhere else. You no longer have to do the same with the +``pypy`` executable, as long as it finds its ``libpypy-c.so`` library. + +.. branch: _warnings + +CPython allows warning.warn(('something', 1), Warning), on PyPy this +produced a "expected a readable buffer object" error. Test and fix. + +.. branch: stricter-strip + +CPython rejects 'a'.strip(buffer(' ')); only None, str or unicode are +allowed as arguments. Test and fix for str and unicode + +.. branch: faulthandler + +Port the 'faulthandler' module to PyPy default. This module is standard +in Python 3.3 but can also be installed from CPython >= 2.6 from PyPI. + +.. branch: test-cpyext + +Refactor cpyext testing to be more pypy3-friendly. + +.. branch: better-error-missing-self + +Improve the error message when the user forgot the "self" argument of a method. + + +.. fb6bb835369e +Change the ``timeit`` module: it now prints the average time and the standard +deviation over 7 runs by default, instead of the minimum. The minimum is often +misleading. + +.. branch: unrecursive-opt + +Make optimiseopt iterative instead of recursive so it can be reasoned about +more easily and debugging is faster. + +.. branch: Tiberiumk/fix-2412-1476011166874 +.. branch: redirect-assembler-jitlog + + + +.. branch: stdlib-2.7.12 + +Update stdlib to version 2.7.12 + +.. branch: buffer-interface2 + +Improve support for new buffer interface in cpyext, bf_getbuffer on built-in +types still missing + + +.. branch: fix-struct-unpack-Q + +Improve compatibility with CPython in the ``struct`` module. In particular, +``struct.unpack`` now returns an ``int`` whenever the returned value fits, +while previously it always returned a ``long`` for certains format codes such +as ``Q`` (and also ``I``, ``L`` and ``q`` on 32 bit) + +.. branch: zarch-simd-support + +s390x implementation for vector operations used in VecOpt + +.. branch: ppc-vsx-support + +PowerPC implementation for vector operations used in VecOpt + +.. branch: newinitwarn + +Match CPython's stricter handling of __new/init__ arguments + +.. branch: openssl-1.1 + +Support for OpenSSL version 1.1 (in addition to version 1.0). +Tested on Linux (1.1, 1.0), on Win32, and Mac (1.0 only) diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst --- a/pypy/doc/windows.rst +++ b/pypy/doc/windows.rst @@ -20,6 +20,22 @@ .. _our downloads: http://pypy.org/download.html +Installing Visual Compiler v9 (for Python 2.7) +---------------------------------------------- + +This compiler, while the standard one for Python 2.7, is depricated. Microsoft has +made it available as the `Microsoft Visual C++ Compiler for Python 2.7`_ (the link +was checked in Nov 2016). Note that the compiler suite will be installed in +``C:\Users\<user name>\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python``. +Using a current version of ``setuptools`` will be able to find it there. For +Windows 10, you must right-click the download, and under ``Properties`` -> +``Compatibility`` mark it as ``Run run this program in comatibility mode for`` +``Previous version...``. Also, you must download and install the ``.Net Framework 3.5``, +otherwise ``mt.exe`` will silently fail. Installation will begin automatically +by running the mt.exe command by hand from a DOS window (that is how the author +discovered the problem). + +.. _Microsoft Visual C++ Compiler for Python 2.7: https://www.microsoft.com/en-us/download/details.aspx?id=44266 Translating PyPy with Visual Studio ----------------------------------- diff --git a/pypy/goal/targetpypystandalone.py b/pypy/goal/targetpypystandalone.py --- a/pypy/goal/targetpypystandalone.py +++ b/pypy/goal/targetpypystandalone.py @@ -34,7 +34,12 @@ if w_dict is not None: # for tests w_entry_point = space.getitem(w_dict, space.wrap('entry_point')) w_run_toplevel = space.getitem(w_dict, space.wrap('run_toplevel')) + w_initstdio = space.getitem(w_dict, space.wrap('initstdio')) withjit = space.config.objspace.usemodules.pypyjit + else: + w_initstdio = space.appexec([], """(): + return lambda unbuffered: None + """) def entry_point(argv): if withjit: @@ -110,18 +115,23 @@ " not found in %s or in any parent directory" % home1) return rffi.cast(rffi.INT, 1) space.startup() - space.appexec([w_path], """(path): - import sys - sys.path[:] = path - """) - # import site + must_leave = space.threadlocals.try_enter_thread(space) try: - space.setattr(space.getbuiltinmodule('sys'), - space.wrap('executable'), - space.wrap(home)) - import_ = space.getattr(space.getbuiltinmodule('builtins'), - space.wrap('__import__')) - space.call_function(import_, space.wrap('site')) + # initialize sys.{path,executable,stdin,stdout,stderr} + # (in unbuffered mode, to avoid troubles) and import site + space.appexec([w_path, space.wrap(home), w_initstdio], + r"""(path, home, initstdio): + import sys + sys.path[:] = path + sys.executable = home + initstdio(unbuffered=True) + try: + import site + except Exception as e: + sys.stderr.write("'import site' failed:\n") + import traceback + traceback.print_exc() + """) return rffi.cast(rffi.INT, 0) except OperationError as e: if verbose: @@ -129,6 +139,9 @@ debug(" operror-type: " + e.w_type.getname(space).encode('utf-8')) debug(" operror-value: " + space.str_w(space.str(e.get_w_value(space)))) return rffi.cast(rffi.INT, -1) + finally: + if must_leave: + space.threadlocals.leave_thread(space) @entrypoint_highlevel('main', [rffi.CCHARP], c_name='pypy_execute_source') def pypy_execute_source(ll_source): @@ -247,7 +260,8 @@ raise Exception("Cannot use the --output option with PyPy " "when --shared is on (it is by default). " "See issue #1971.") - if config.translation.profopt is not None: + if (config.translation.profopt is not None + and not config.translation.noprofopt): raise Exception("Cannot use the --profopt option " "when --shared is on (it is by default). " "See issue #2398.") diff --git a/pypy/interpreter/astcompiler/assemble.py b/pypy/interpreter/astcompiler/assemble.py --- a/pypy/interpreter/astcompiler/assemble.py +++ b/pypy/interpreter/astcompiler/assemble.py @@ -662,7 +662,7 @@ ops.LOAD_DEREF: 1, ops.STORE_DEREF: -1, ops.DELETE_DEREF: 0, - + ops.GET_AWAITABLE: 0, ops.SETUP_ASYNC_WITH: 0, ops.BEFORE_ASYNC_WITH: 1, @@ -682,10 +682,10 @@ ops.JUMP_IF_FALSE_OR_POP: 0, ops.POP_JUMP_IF_TRUE: -1, ops.POP_JUMP_IF_FALSE: -1, - # TODO + # TODO ops.JUMP_IF_NOT_DEBUG: 0, - # TODO + # TODO ops.BUILD_LIST_FROM_ARG: 1, # TODO ops.LOAD_CLASSDEREF: 1, diff --git a/pypy/interpreter/astcompiler/codegen.py b/pypy/interpreter/astcompiler/codegen.py --- a/pypy/interpreter/astcompiler/codegen.py +++ b/pypy/interpreter/astcompiler/codegen.py @@ -210,7 +210,9 @@ def sub_scope(self, kind, name, node, lineno): """Convenience function for compiling a sub scope.""" - if self.qualname: + if self.scope.lookup(name) == symtable.SCOPE_GLOBAL_EXPLICIT: + qualname = name + elif self.qualname: qualname = '%s.%s' % (self.qualname, name) else: qualname = name @@ -578,7 +580,7 @@ self.pop_frame_block(F_BLOCK_LOOP, start) self.visit_sequence(fr.orelse) self.use_next_block(end) - + def visit_AsyncFor(self, fr): self.update_position(fr.lineno, True) b_try = self.new_block() @@ -588,21 +590,21 @@ b_try_cleanup = self.new_block() b_after_loop = self.new_block() b_after_loop_else = self.new_block() - + self.emit_jump(ops.SETUP_LOOP, b_after_loop) self.push_frame_block(F_BLOCK_LOOP, b_try) - + fr.iter.walkabout(self) self.emit_op(ops.GET_AITER) self.load_const(self.space.w_None) self.emit_op(ops.YIELD_FROM) - + self.use_next_block(b_try) # This adds another line, so each for iteration can be traced. self.lineno_set = False self.emit_jump(ops.SETUP_EXCEPT, b_except) self.push_frame_block(F_BLOCK_EXCEPT, b_try) - + self.emit_op(ops.GET_ANEXT) self.load_const(self.space.w_None) self.emit_op(ops.YIELD_FROM) @@ -610,13 +612,13 @@ self.emit_op(ops.POP_BLOCK) self.pop_frame_block(F_BLOCK_EXCEPT, b_try) self.emit_jump(ops.JUMP_FORWARD, b_after_try) - + self.use_next_block(b_except) self.emit_op(ops.DUP_TOP) self.emit_op_name(ops.LOAD_GLOBAL, self.names, "StopAsyncIteration") self.emit_op_arg(ops.COMPARE_OP, 10) self.emit_jump(ops.POP_JUMP_IF_FALSE, b_try_cleanup, True) - + self.emit_op(ops.POP_TOP) self.emit_op(ops.POP_TOP) self.emit_op(ops.POP_TOP) @@ -630,23 +632,23 @@ self.emit_op(ops.POP_TOP) self.emit_op(ops.POP_BLOCK) # for SETUP_LOOP self.emit_jump(ops.JUMP_ABSOLUTE, b_after_loop_else, True) - + self.use_next_block(b_try_cleanup) self.emit_op(ops.END_FINALLY) - + self.use_next_block(b_after_try) self.visit_sequence(fr.body) self.emit_jump(ops.JUMP_ABSOLUTE, b_try, True) - + self.emit_op(ops.POP_BLOCK) # for SETUP_LOOP self.pop_frame_block(F_BLOCK_LOOP, b_try) - + self.use_next_block(b_after_loop) self.emit_jump(ops.JUMP_ABSOLUTE, b_end, True) - + self.use_next_block(b_after_loop_else) self.visit_sequence(fr.orelse) - + self.use_next_block(b_end) def visit_While(self, wh): @@ -701,7 +703,7 @@ self.emit_op(ops.POP_TOP) if handler.name: ## generate the equivalent of: - ## + ## ## try: ## # body ## except type as name: @@ -960,7 +962,7 @@ def visit_AsyncWith(self, wih): self.update_position(wih.lineno, True) - self.handle_asyncwithitem(wih, 0, is_async=True) + self.handle_withitem(wih, 0, is_async=True) def visit_Raise(self, rais): self.update_position(rais.lineno, True) @@ -1008,7 +1010,7 @@ self.emit_op(ops.GET_YIELD_FROM_ITER) self.load_const(self.space.w_None) self.emit_op(ops.YIELD_FROM) - + def visit_Await(self, aw): self.update_position(aw.lineno) aw.value.walkabout(self) @@ -1147,7 +1149,7 @@ self.emit_op_arg(outer_op, elt_subitems) else: self.emit_op_arg(single_op, seen_star) - + def _visit_assignment(self, node, elts, ctx): elt_count = len(elts) if elts else 0 if ctx == ast.Store: @@ -1210,14 +1212,8 @@ d.values[i].walkabout(self) containers += 1 else: - # TODO: key.walkabout has to be called before d.values.walkabout - # that would fix the error "keywords must be strings" - # for some reason the keys and values seem to be in reverse order - # in some cases, so another error has to be fixed in order for - # this to work, otherwise it breaks everything - # after fix: remove dirty fixes in pyopcode + key.walkabout(self) d.values[i].walkabout(self) - key.walkabout(self) elements += 1 if elements or containers == 0: self.emit_op_arg(ops.BUILD_MAP, elements) @@ -1230,7 +1226,7 @@ self.emit_op_arg(ops.BUILD_MAP_UNPACK, oparg) containers -= (oparg - 1) is_unpacking = False - + def visit_Set(self, s): self._visit_starunpack(s, s.elts, ops.BUILD_SET, ops.BUILD_SET, ops.BUILD_SET_UNPACK) @@ -1286,7 +1282,7 @@ # If we ended up with more than one stararg, we need # to concatenate them into a single sequence. self.emit_op_arg(ops.BUILD_LIST_UNPACK, nsubargs) - + # Repeat procedure for keyword args nseen = 0 # the number of keyword arguments on the stack following if keywords is not None: @@ -1301,8 +1297,8 @@ nsubkwargs += 1 elif nsubkwargs: # A keyword argument and we already have a dict. + self.load_const(self.space.wrap(kw.arg.decode('utf-8'))) kw.value.walkabout(self) - self.load_const(self.space.wrap(kw.arg.decode('utf-8'))) nseen += 1 else: # keyword argument @@ -1340,7 +1336,7 @@ _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit