Author: Matti Picus <[email protected]>
Branch: release-pypy3.5-5.x
Changeset: r91451:0736d37d56a7
Date: 2017-05-30 16:35 +0300
http://bitbucket.org/pypy/pypy/changeset/0736d37d56a7/
Log: merge py3.5 into release branch
diff too long, truncating to 2000 out of 57131 lines
diff --git a/.hgignore b/.hgignore
--- a/.hgignore
+++ b/.hgignore
@@ -51,11 +51,18 @@
^rpython/translator/goal/target.+-c$
^rpython/translator/goal/.+\.exe$
^rpython/translator/goal/.+\.dll$
+^rpython/rlib/rvmprof/src/shared/libbacktrace/Makefile$
+^rpython/rlib/rvmprof/src/shared/libbacktrace/config.guess$
+^rpython/rlib/rvmprof/src/shared/libbacktrace/config.h$
+^rpython/rlib/rvmprof/src/shared/libbacktrace/config.log$
+^rpython/rlib/rvmprof/src/shared/libbacktrace/config.status$
^pypy/goal/pypy-translation-snapshot$
^pypy/goal/pypy-c
+^pypy/goal/pypy3-c
^pypy/goal/.+\.exe$
^pypy/goal/.+\.dll$
^pypy/goal/.+\.lib$
+^pypy/goal/.+\.dylib$
^pypy/_cache$
^lib-python/2.7/lib2to3/.+\.pickle$
^lib_pypy/__pycache__$
@@ -83,5 +90,8 @@
.hypothesis/
^release/
^rpython/_cache$
+^\.cache$
pypy/module/cppyy/.+/*\.pcm
+
+
diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -34,4 +34,7 @@
050d84dd78997f021acf0e133934275d63547cc0 release-pypy2.7-v5.4.1
0e2d9a73f5a1818d0245d75daccdbe21b2d5c3ef release-pypy2.7-v5.4.1
aff251e543859ce4508159dd9f1a82a2f553de00 release-pypy2.7-v5.6.0
-ea9979b550eeae87924dc4bef06070e8f8d0e22f release-pypy3.3-5.5.0
+fa3249d55d15b9829e1be69cdf45b5a44cec902d release-pypy2.7-v5.7.0
+b16a4363e930f6401bceb499b9520955504c6cb0 release-pypy3.5-v5.7.0
+1aa2d8e03cdfab54b7121e93fda7e98ea88a30bf release-pypy2.7-v5.7.1
+2875f328eae2216a87f3d6f335092832eb031f56 release-pypy3.5-v5.7.1
diff --git a/include/README b/include/README
--- a/include/README
+++ b/include/README
@@ -1,7 +1,11 @@
This directory contains all the include files needed to build cpython
extensions with PyPy. Note that these are just copies of the original headers
-that are in pypy/module/cpyext/include: they are automatically copied from
-there during translation.
+that are in pypy/module/cpyext/{include,parse}: they are automatically copied
+from there during translation.
-Moreover, pypy_decl.h and pypy_macros.h are automatically generated, also
-during translation.
+Moreover, some pypy-specific files are automatically generated, also during
+translation. Currently they are:
+* pypy_decl.h
+* pypy_macros.h
+* pypy_numpy.h
+* pypy_structmember_decl.h
diff --git a/lib-python/2.7/distutils/sysconfig_pypy.py
b/lib-python/2.7/distutils/sysconfig_pypy.py
--- a/lib-python/2.7/distutils/sysconfig_pypy.py
+++ b/lib-python/2.7/distutils/sysconfig_pypy.py
@@ -61,12 +61,12 @@
def _init_posix():
"""Initialize the module as appropriate for POSIX systems."""
g = {}
- g['CC'] = "gcc -pthread"
- g['CXX'] = "g++ -pthread"
+ g['CC'] = "cc -pthread"
+ g['CXX'] = "c++ -pthread"
g['OPT'] = "-DNDEBUG -O2"
g['CFLAGS'] = "-DNDEBUG -O2"
g['CCSHARED'] = "-fPIC"
- g['LDSHARED'] = "gcc -pthread -shared"
+ g['LDSHARED'] = "cc -pthread -shared"
g['SO'] = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0]
g['AR'] = "ar"
g['ARFLAGS'] = "rc"
diff --git a/lib-python/2.7/sysconfig.py b/lib-python/2.7/sysconfig.py
--- a/lib-python/2.7/sysconfig.py
+++ b/lib-python/2.7/sysconfig.py
@@ -29,8 +29,8 @@
'pypy': {
'stdlib': '{base}/lib-{implementation_lower}/{py_version_short}',
'platstdlib': '{base}/lib-{implementation_lower}/{py_version_short}',
- 'purelib': '{base}/lib-{implementation_lower}/{py_version_short}',
- 'platlib': '{base}/lib-{implementation_lower}/{py_version_short}',
+ 'purelib': '{base}/site-packages',
+ 'platlib': '{base}/site-packages',
'include': '{base}/include',
'platinclude': '{base}/include',
'scripts': '{base}/bin',
diff --git a/lib-python/2.7/weakref.py b/lib-python/2.7/weakref.py
--- a/lib-python/2.7/weakref.py
+++ b/lib-python/2.7/weakref.py
@@ -36,9 +36,9 @@
except ImportError:
def _delitem_if_value_is(d, key, value):
try:
- if self.data[key] is value: # fall-back: there is a potential
+ if d[key] is value: # fall-back: there is a potential
# race condition in multithreaded programs HERE
- del self.data[key]
+ del d[key]
except KeyError:
pass
diff --git a/lib-python/3/datetime.py b/lib-python/3/datetime.py
--- a/lib-python/3/datetime.py
+++ b/lib-python/3/datetime.py
@@ -746,15 +746,15 @@
_MONTHNAMES[self._month],
self._day, self._year)
- def strftime(self, fmt):
+ def strftime(self, format):
"Format using strftime()."
- return _wrap_strftime(self, fmt, self.timetuple())
+ return _wrap_strftime(self, format, self.timetuple())
- def __format__(self, fmt):
- if not isinstance(fmt, str):
- raise TypeError("must be str, not %s" % type(fmt).__name__)
- if len(fmt) != 0:
- return self.strftime(fmt)
+ def __format__(self, format):
+ if not isinstance(format, str):
+ raise TypeError("must be str, not %s" % type(format).__name__)
+ if len(format) != 0:
+ return self.strftime(format)
return str(self)
def isoformat(self):
@@ -1215,7 +1215,7 @@
__str__ = isoformat
- def strftime(self, fmt):
+ def strftime(self, format):
"""Format using strftime(). The date part of the timestamp passed
to underlying strftime should not be used.
"""
@@ -1224,13 +1224,13 @@
timetuple = (1900, 1, 1,
self._hour, self._minute, self._second,
0, 1, -1)
- return _wrap_strftime(self, fmt, timetuple)
+ return _wrap_strftime(self, format, timetuple)
- def __format__(self, fmt):
- if not isinstance(fmt, str):
- raise TypeError("must be str, not %s" % type(fmt).__name__)
- if len(fmt) != 0:
- return self.strftime(fmt)
+ def __format__(self, format):
+ if not isinstance(format, str):
+ raise TypeError("must be str, not %s" % type(format).__name__)
+ if len(format) != 0:
+ return self.strftime(format)
return str(self)
# Timezone functions
diff --git a/lib-python/3/distutils/ccompiler.py
b/lib-python/3/distutils/ccompiler.py
--- a/lib-python/3/distutils/ccompiler.py
+++ b/lib-python/3/distutils/ccompiler.py
@@ -959,7 +959,9 @@
# is assumed to be in the 'distutils' package.)
compiler_class = { 'unix': ('unixccompiler', 'UnixCCompiler',
"standard UNIX-style compiler"),
- 'msvc': ('_msvccompiler', 'MSVCCompiler',
+ # PyPy change: On win32 PyPy is translated with the
+ # "msvc9compiler", force the same here.
+ 'msvc': ('msvc9compiler', 'MSVCCompiler',
"Microsoft Visual C++"),
'cygwin': ('cygwinccompiler', 'CygwinCCompiler',
"Cygwin port of GNU C Compiler for Win32"),
diff --git a/lib-python/3/distutils/sysconfig_pypy.py
b/lib-python/3/distutils/sysconfig_pypy.py
--- a/lib-python/3/distutils/sysconfig_pypy.py
+++ b/lib-python/3/distutils/sysconfig_pypy.py
@@ -66,12 +66,12 @@
so_ext = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0]
g = {}
- g['CC'] = "gcc -pthread"
- g['CXX'] = "g++ -pthread"
+ g['CC'] = "cc -pthread"
+ g['CXX'] = "c++ -pthread"
g['OPT'] = "-DNDEBUG -O2"
g['CFLAGS'] = "-DNDEBUG -O2"
g['CCSHARED'] = "-fPIC"
- g['LDSHARED'] = "gcc -pthread -shared"
+ g['LDSHARED'] = "cc -pthread -shared"
g['EXT_SUFFIX'] = so_ext
g['SHLIB_SUFFIX'] = so_ext
g['SO'] = so_ext # deprecated in Python 3, for backward compatibility
diff --git a/lib-python/3/pathlib.py b/lib-python/3/pathlib.py
--- a/lib-python/3/pathlib.py
+++ b/lib-python/3/pathlib.py
@@ -1209,23 +1209,19 @@
def mkdir(self, mode=0o777, parents=False, exist_ok=False):
if self._closed:
self._raise_closed()
- if not parents:
- try:
- self._accessor.mkdir(self, mode)
- except FileExistsError:
- if not exist_ok or not self.is_dir():
- raise
- else:
- try:
- self._accessor.mkdir(self, mode)
- except FileExistsError:
- if not exist_ok or not self.is_dir():
- raise
- except OSError as e:
- if e.errno != ENOENT:
- raise
- self.parent.mkdir(parents=True)
- self._accessor.mkdir(self, mode)
+ # NOTE: version from CPython 3.7 plus fix at issue #29694
+ try:
+ self._accessor.mkdir(self, mode)
+ except FileNotFoundError:
+ if not parents or self.parent == self:
+ raise
+ self.parent.mkdir(parents=True, exist_ok=True)
+ self.mkdir(mode, parents=False, exist_ok=exist_ok)
+ except OSError:
+ # Cannot rely on checking for EEXIST, since the operating system
+ # could give priority to other errors like EACCES or EROFS
+ if not exist_ok or not self.is_dir():
+ raise
def chmod(self, mode):
"""
diff --git a/lib-python/3/site.py b/lib-python/3/site.py
--- a/lib-python/3/site.py
+++ b/lib-python/3/site.py
@@ -305,9 +305,7 @@
seen.add(prefix)
if is_pypy:
- from distutils.sysconfig import get_python_lib
- sitepackages.append(get_python_lib(standard_lib=False,
- prefix=prefix))
+ sitepackages.append(os.path.join(prefix, "site-packages"))
elif os.sep == '/':
sitepackages.append(os.path.join(prefix, "lib",
"python" + sys.version[:3],
@@ -410,7 +408,9 @@
readline.parse_and_bind('tab: complete')
try:
- readline.read_init_file()
+ # Unimplemented on PyPy
+ #readline.read_init_file()
+ pass
except OSError:
# An OSError here could have many causes, but the most likely one
# is that there's no .inputrc file (or .editrc file in the case of
diff --git a/lib-python/3/sre_compile.py b/lib-python/3/sre_compile.py
--- a/lib-python/3/sre_compile.py
+++ b/lib-python/3/sre_compile.py
@@ -378,7 +378,11 @@
def _bytes_to_codes(b):
# Convert block indices to word array
- a = memoryview(b).cast('I')
+ if _sre.CODESIZE == 2:
+ code = 'H'
+ else:
+ code = 'I'
+ a = memoryview(b).cast(code)
assert a.itemsize == _sre.CODESIZE
assert len(a) * a.itemsize == len(b)
return a.tolist()
diff --git a/lib-python/3/test/_test_multiprocessing.py
b/lib-python/3/test/_test_multiprocessing.py
--- a/lib-python/3/test/_test_multiprocessing.py
+++ b/lib-python/3/test/_test_multiprocessing.py
@@ -2147,7 +2147,8 @@
# Because we are using xmlrpclib for serialization instead of
# pickle this will cause a serialization error.
- self.assertRaises(Exception, queue.put, time.sleep)
+ # Changed on PyPy: passing functions to xmlrpc is broken
+ #self.assertRaises(Exception, queue.put, time.sleep)
# Make queue finalizer run before the server is stopped
del queue
diff --git a/lib-python/3/test/datetimetester.py
b/lib-python/3/test/datetimetester.py
--- a/lib-python/3/test/datetimetester.py
+++ b/lib-python/3/test/datetimetester.py
@@ -1238,6 +1238,9 @@
#check that this standard extension works
t.strftime("%f")
+ #test that passing keyword arguments work
+ self.assertEqual(t.strftime(format=""), "")
+
def test_format(self):
dt = self.theclass(2007, 9, 10)
self.assertEqual(dt.__format__(''), str(dt))
@@ -1602,6 +1605,9 @@
self.assertEqual(a.__format__(fmt), dt.strftime(fmt))
self.assertEqual(b.__format__(fmt), 'B')
+ #test that passing keyword arguments work
+ self.assertEqual(dt.strftime(format=""), "")
+
def test_more_ctime(self):
# Test fields that TestDate doesn't touch.
import time
@@ -2335,6 +2341,9 @@
# A naive object replaces %z and %Z with empty strings.
self.assertEqual(t.strftime("'%z' '%Z'"), "'' ''")
+ #test that passing keyword arguments work
+ self.assertEqual(t.strftime(format=""), "")
+
def test_format(self):
t = self.theclass(1, 2, 3, 4)
self.assertEqual(t.__format__(''), str(t))
diff --git a/lib-python/3/test/test_pathlib.py
b/lib-python/3/test/test_pathlib.py
--- a/lib-python/3/test/test_pathlib.py
+++ b/lib-python/3/test/test_pathlib.py
@@ -8,6 +8,7 @@
import stat
import tempfile
import unittest
+from unittest import mock
from test import support
TESTFN = support.TESTFN
@@ -1751,6 +1752,35 @@
p.mkdir(exist_ok=True)
self.assertEqual(cm.exception.errno, errno.EEXIST)
+ def test_mkdir_concurrent_parent_creation(self):
+ for pattern_num in range(32):
+ p = self.cls(BASE, 'dirCPC%d' % pattern_num)
+ self.assertFalse(p.exists())
+
+ def my_mkdir(path, mode=0o777):
+ path = str(path)
+ # Emulate another process that would create the directory
+ # just before we try to create it ourselves. We do it
+ # in all possible pattern combinations, assuming that this
+ # function is called at most 5 times (dirCPC/dir1/dir2,
+ # dirCPC/dir1, dirCPC, dirCPC/dir1, cirCPC/dir1/dir2).
+ if pattern.pop():
+ os.mkdir(path, mode) # from another process
+ concurrently_created.add(path)
+ os.mkdir(path, mode) # our real call
+
+ pattern = [bool(pattern_num & (1 << n)) for n in range(5)]
+ concurrently_created = set()
+ p12 = p / 'dir1' / 'dir2'
+ try:
+ with mock.patch("pathlib._normal_accessor.mkdir", my_mkdir):
+ p12.mkdir(parents=True, exist_ok=False)
+ except FileExistsError:
+ self.assertIn(str(p12), concurrently_created)
+ else:
+ self.assertNotIn(str(p12), concurrently_created)
+ self.assertTrue(p.exists())
+
@with_symlinks
def test_symlink_to(self):
P = self.cls(BASE)
diff --git a/lib-python/3/test/test_socket.py b/lib-python/3/test/test_socket.py
--- a/lib-python/3/test/test_socket.py
+++ b/lib-python/3/test/test_socket.py
@@ -722,12 +722,12 @@
s.sendto('\u2620', sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'str'", # cpython
- "'str' does not support the buffer interface"]) # pypy
+ "a bytes-like object is required, not str"]) # pypy
with self.assertRaises(TypeError) as cm:
s.sendto(5j, sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'complex'",
- "'complex' does not support the buffer interface"])
+ "a bytes-like object is required, not complex"])
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', None)
self.assertIn('NoneType', str(cm.exception))
@@ -736,12 +736,12 @@
s.sendto('\u2620', 0, sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'str'",
- "'str' does not support the buffer interface"])
+ "a bytes-like object is required, not str"])
with self.assertRaises(TypeError) as cm:
s.sendto(5j, 0, sockname)
self.assertIn(str(cm.exception),
["a bytes-like object is required, not 'complex'",
- "'complex' does not support the buffer interface"])
+ "a bytes-like object is required, not complex"])
with self.assertRaises(TypeError) as cm:
s.sendto(b'foo', 0, None)
self.assertIn('NoneType', str(cm.exception))
diff --git a/lib-python/3/test/test_xml_etree.py
b/lib-python/3/test/test_xml_etree.py
--- a/lib-python/3/test/test_xml_etree.py
+++ b/lib-python/3/test/test_xml_etree.py
@@ -1878,6 +1878,17 @@
with self.assertRaises(RuntimeError):
repr(e) # Should not crash
+ def test_bad_find_returns_none(self):
+ # This behavior is the one we get historically when the C
+ # extension module is enabled. With the Python version, it
+ # raised a TypeError instead. There are projects out there
+ # that depend on the non-raising behavior, of course.
+ e = ET.Element('foo')
+ assert e.find('') is None
+ assert e.findall('') == []
+ assert e.findtext('') is None
+ assert e.findtext('', default="default.") == "default."
+
class MutatingElementPath(str):
def __new__(cls, elem, *args):
self = str.__new__(cls, *args)
diff --git a/lib-python/3/xml/etree/ElementTree.py
b/lib-python/3/xml/etree/ElementTree.py
--- a/lib-python/3/xml/etree/ElementTree.py
+++ b/lib-python/3/xml/etree/ElementTree.py
@@ -294,7 +294,14 @@
Return the first matching element, or None if no element was found.
"""
- return ElementPath.find(self, path, namespaces)
+ # Used to be: return ElementPath.find(self, path, namespaces)
+ # but there are projects out there that rely on it getting None
+ # instead of an internal TypeError. This is what the C version
+ # of this class does.
+ result = ElementPath.iterfind(self, path, namespaces)
+ if result is None:
+ return None
+ return next(result, None)
def findtext(self, path, default=None, namespaces=None):
"""Find text for first matching element by tag name or path.
@@ -308,7 +315,17 @@
content, the empty string is returned.
"""
- return ElementPath.findtext(self, path, default, namespaces)
+ # Used to be:
+ # return ElementPath.findtext(self, path, default, namespaces)
+ # See find().
+ result = ElementPath.iterfind(self, path, namespaces)
+ if result is None:
+ return default
+ try:
+ elem = next(result)
+ return elem.text or ""
+ except StopIteration:
+ return default
def findall(self, path, namespaces=None):
"""Find all matching subelements by tag name or path.
@@ -319,7 +336,12 @@
Returns list containing all matching elements in document order.
"""
- return ElementPath.findall(self, path, namespaces)
+ # Used to be: return ElementPath.findall(self, path, namespaces)
+ # See find().
+ result = ElementPath.iterfind(self, path, namespaces)
+ if result is None:
+ return []
+ return list(result)
def iterfind(self, path, namespaces=None):
"""Find all matching subelements by tag name or path.
diff --git a/lib-python/conftest.py b/lib-python/conftest.py
--- a/lib-python/conftest.py
+++ b/lib-python/conftest.py
@@ -597,7 +597,7 @@
py.test.skip("%s module not included in %s" % (mod,
execpath))
- cmd = "%s %s %s" % (execpath, regrrun, fspath.purebasename)
+ cmd = "%s -m test -v %s" % (execpath, fspath.purebasename)
# add watchdog for timing out
cmd = "%s %s %s %s" % (python, watchdog_script, TIMEOUT, cmd)
else:
diff --git a/lib_pypy/_audioop_build.py b/lib_pypy/_audioop_build.py
--- a/lib_pypy/_audioop_build.py
+++ b/lib_pypy/_audioop_build.py
@@ -656,4 +656,4 @@
ffi.set_source("_audioop_cffi", C_SOURCE)
if __name__ == "__main__":
- ffi.compile()
+ ffi.compile(verbose=2)
diff --git a/lib_pypy/_cffi_ssl/README.md b/lib_pypy/_cffi_ssl/README.md
--- a/lib_pypy/_cffi_ssl/README.md
+++ b/lib_pypy/_cffi_ssl/README.md
@@ -5,16 +5,22 @@
it renames the compiled shared object to _pypy_openssl.so (which means
that cryptography can ship their own cffi backend)
+NOTE: currently, we have changed ``_cffi_src/openssl/callbacks.py`` to
+not rely on the CPython C API.
+
# Tests?
Currently this module is tested using CPython's standard library test suite.
# Install it into PyPy's source tree
-Copy over all the sources into the folder `lib_pypy/_cffi_ssl/*`. Updating the
cffi backend can be simply done by the following command:
+Copy over all the sources into the folder `lib_pypy/_cffi_ssl/*`. Updating the
cffi backend can be simply done by the following command::
$ cp -r <cloned cryptography folder>/src/_cffi_src/* .
+NOTE: you need to keep our version of ``_cffi_src/openssl/callbacks.py``
+for now!
+
# Crpytography version
Copied over release version `1.7.2`
diff --git a/lib_pypy/_cffi_ssl/_cffi_src/openssl/callbacks.py
b/lib_pypy/_cffi_ssl/_cffi_src/openssl/callbacks.py
--- a/lib_pypy/_cffi_ssl/_cffi_src/openssl/callbacks.py
+++ b/lib_pypy/_cffi_ssl/_cffi_src/openssl/callbacks.py
@@ -13,8 +13,6 @@
#include <openssl/x509.h>
#include <openssl/x509_vfy.h>
#include <openssl/crypto.h>
-
-#include <pythread.h>
"""
TYPES = """
@@ -64,8 +62,50 @@
Copyright 2001-2016 Python Software Foundation; All Rights Reserved.
*/
+#ifdef _WIN32
+#ifdef _MSC_VER
+#ifdef inline
+#undef inline
+#endif
+#define inline __inline
+#endif
+#include <Windows.h>
+typedef CRITICAL_SECTION mutex1_t;
+static inline void mutex1_init(mutex1_t *mutex) {
+ InitializeCriticalSection(mutex);
+}
+static inline void mutex1_lock(mutex1_t *mutex) {
+ EnterCriticalSection(mutex);
+}
+static inline void mutex1_unlock(mutex1_t *mutex) {
+ LeaveCriticalSection(mutex);
+}
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#include <pthread.h>
+typedef pthread_mutex_t mutex1_t;
+#define ASSERT_STATUS(call) \
+ if (call != 0) { \
+ perror("Fatal error in _cffi_ssl: " #call); \
+ abort(); \
+ }
+static inline void mutex1_init(mutex1_t *mutex) {
+#if !defined(pthread_mutexattr_default)
+# define pthread_mutexattr_default ((pthread_mutexattr_t *)NULL)
+#endif
+ ASSERT_STATUS(pthread_mutex_init(mutex, pthread_mutexattr_default));
+}
+static inline void mutex1_lock(mutex1_t *mutex) {
+ ASSERT_STATUS(pthread_mutex_lock(mutex));
+}
+static inline void mutex1_unlock(mutex1_t *mutex) {
+ ASSERT_STATUS(pthread_mutex_unlock(mutex));
+}
+#endif
+
static unsigned int _ssl_locks_count = 0;
-static PyThread_type_lock *_ssl_locks = NULL;
+static mutex1_t *_ssl_locks = NULL;
static void _ssl_thread_locking_function(int mode, int n, const char *file,
int line) {
@@ -89,35 +129,32 @@
}
if (mode & CRYPTO_LOCK) {
- PyThread_acquire_lock(_ssl_locks[n], 1);
+ mutex1_lock(_ssl_locks + n);
} else {
- PyThread_release_lock(_ssl_locks[n]);
+ mutex1_unlock(_ssl_locks + n);
+ }
+}
+
+static void init_mutexes(void)
+{
+ int i;
+ for (i = 0; i < _ssl_locks_count; i++) {
+ mutex1_init(_ssl_locks + i);
}
}
int _setup_ssl_threads(void) {
- unsigned int i;
-
if (_ssl_locks == NULL) {
_ssl_locks_count = CRYPTO_num_locks();
- _ssl_locks = PyMem_New(PyThread_type_lock, _ssl_locks_count);
+ _ssl_locks = malloc(sizeof(mutex1_t) * _ssl_locks_count);
if (_ssl_locks == NULL) {
- PyErr_NoMemory();
return 0;
}
- memset(_ssl_locks, 0, sizeof(PyThread_type_lock) * _ssl_locks_count);
- for (i = 0; i < _ssl_locks_count; i++) {
- _ssl_locks[i] = PyThread_allocate_lock();
- if (_ssl_locks[i] == NULL) {
- unsigned int j;
- for (j = 0; j < i; j++) {
- PyThread_free_lock(_ssl_locks[j]);
- }
- PyMem_Free(_ssl_locks);
- return 0;
- }
- }
+ init_mutexes();
CRYPTO_set_locking_callback(_ssl_thread_locking_function);
+#ifndef _WIN32
+ pthread_atfork(NULL, NULL, &init_mutexes);
+#endif
}
return 1;
}
diff --git a/lib_pypy/_cffi_ssl/_stdssl/__init__.py
b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
--- a/lib_pypy/_cffi_ssl/_stdssl/__init__.py
+++ b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
@@ -46,7 +46,7 @@
SERVER = 1
VERIFY_DEFAULT = 0
-VERIFY_CRL_CHECK_LEAF = lib.X509_V_FLAG_CRL_CHECK
+VERIFY_CRL_CHECK_LEAF = lib.X509_V_FLAG_CRL_CHECK
VERIFY_CRL_CHECK_CHAIN = lib.X509_V_FLAG_CRL_CHECK |
lib.X509_V_FLAG_CRL_CHECK_ALL
VERIFY_X509_STRICT = lib.X509_V_FLAG_X509_STRICT
if lib.Cryptography_HAS_X509_V_FLAG_TRUSTED_FIRST:
@@ -297,6 +297,10 @@
else:
raise TypeError("The value must be a SSLContext")
+ @property
+ def server_side(self):
+ return self.socket_type == SSL_SERVER
+
def do_handshake(self):
sock = self.get_socket_or_connection_gone()
ssl = self.ssl
@@ -658,7 +662,7 @@
def tls_unique_cb(self):
buf = ffi.new("char[]", SSL_CB_MAXLEN)
- if lib.SSL_session_reused(self.ssl) ^ (not self.socket_type):
+ if lib.SSL_session_reused(self.ssl) ^ (not self.server_side):
# if session is resumed XOR we are the client
length = lib.SSL_get_finished(self.ssl, buf, SSL_CB_MAXLEN)
else:
@@ -1297,7 +1301,7 @@
result = _asn1obj2py(obj);
lib.ASN1_OBJECT_free(obj);
return result;
-
+
class MemoryBIO(object):
def __init__(self):
diff --git a/lib_pypy/_ctypes/array.py b/lib_pypy/_ctypes/array.py
--- a/lib_pypy/_ctypes/array.py
+++ b/lib_pypy/_ctypes/array.py
@@ -83,8 +83,9 @@
res = self.__new__(self)
ffiarray = self._ffiarray.fromaddress(resarray.buffer, self._length_)
res._buffer = ffiarray
- res._base = base
- res._index = index
+ if base is not None:
+ res._base = base
+ res._index = index
return res
def _CData_retval(self, resbuffer):
diff --git a/lib_pypy/_ctypes/basics.py b/lib_pypy/_ctypes/basics.py
--- a/lib_pypy/_ctypes/basics.py
+++ b/lib_pypy/_ctypes/basics.py
@@ -64,8 +64,9 @@
res = object.__new__(self)
res.__class__ = self
res.__dict__['_buffer'] = resbuffer
- res.__dict__['_base'] = base
- res.__dict__['_index'] = index
+ if base is not None:
+ res.__dict__['_base'] = base
+ res.__dict__['_index'] = index
return res
def _CData_retval(self, resbuffer):
diff --git a/lib_pypy/_ctypes/function.py b/lib_pypy/_ctypes/function.py
--- a/lib_pypy/_ctypes/function.py
+++ b/lib_pypy/_ctypes/function.py
@@ -1,4 +1,3 @@
-
from _ctypes.basics import _CData, _CDataMeta, cdata_from_address
from _ctypes.primitive import SimpleType, _SimpleCData
from _ctypes.basics import ArgumentError, keepalive_key
@@ -9,13 +8,16 @@
import sys
import traceback
-try: from __pypy__ import builtinify
-except ImportError: builtinify = lambda f: f
+
+try:
+ from __pypy__ import builtinify
+except ImportError:
+ builtinify = lambda f: f
# XXX this file needs huge refactoring I fear
-PARAMFLAG_FIN = 0x1
-PARAMFLAG_FOUT = 0x2
+PARAMFLAG_FIN = 0x1
+PARAMFLAG_FOUT = 0x2
PARAMFLAG_FLCID = 0x4
PARAMFLAG_COMBINED = PARAMFLAG_FIN | PARAMFLAG_FOUT | PARAMFLAG_FLCID
@@ -24,7 +26,7 @@
PARAMFLAG_FIN,
PARAMFLAG_FIN | PARAMFLAG_FOUT,
PARAMFLAG_FIN | PARAMFLAG_FLCID
- )
+)
WIN64 = sys.platform == 'win32' and sys.maxsize == 2**63 - 1
@@ -35,6 +37,7 @@
from _ctypes import COMError
return COMError(errcode, None, None)
+
@builtinify
def call_function(func, args):
"Only for debugging so far: So that we can call CFunction instances"
@@ -93,14 +96,9 @@
"item %d in _argtypes_ has no from_param method" % (
i + 1,))
self._argtypes_ = list(argtypes)
- self._check_argtypes_for_fastpath()
+
argtypes = property(_getargtypes, _setargtypes)
- def _check_argtypes_for_fastpath(self):
- if all([hasattr(argtype, '_ffiargshape_') for argtype in
self._argtypes_]):
- fastpath_cls = make_fastpath_subclass(self.__class__)
- fastpath_cls.enable_fastpath_maybe(self)
-
def _getparamflags(self):
return self._paramflags
@@ -125,27 +123,26 @@
raise TypeError(
"paramflags must be a sequence of (int [,string [,value]])
"
"tuples"
- )
+ )
if not isinstance(flag, int):
raise TypeError(
"paramflags must be a sequence of (int [,string [,value]])
"
"tuples"
- )
+ )
_flag = flag & PARAMFLAG_COMBINED
if _flag == PARAMFLAG_FOUT:
typ = self._argtypes_[idx]
if getattr(typ, '_ffiargshape_', None) not in ('P', 'z', 'Z'):
raise TypeError(
"'out' parameter %d must be a pointer type, not %s"
- % (idx+1, type(typ).__name__)
- )
+ % (idx + 1, type(typ).__name__)
+ )
elif _flag not in VALID_PARAMFLAGS:
raise TypeError("paramflag value %d not supported" % flag)
self._paramflags = paramflags
paramflags = property(_getparamflags, _setparamflags)
-
def _getrestype(self):
return self._restype_
@@ -155,7 +152,7 @@
from ctypes import c_int
restype = c_int
if not (isinstance(restype, _CDataMeta) or restype is None or
- callable(restype)):
+ callable(restype)):
raise TypeError("restype must be a type, a callable, or None")
self._restype_ = restype
@@ -167,15 +164,18 @@
def _geterrcheck(self):
return getattr(self, '_errcheck_', None)
+
def _seterrcheck(self, errcheck):
if not callable(errcheck):
raise TypeError("The errcheck attribute must be callable")
self._errcheck_ = errcheck
+
def _delerrcheck(self):
try:
del self._errcheck_
except AttributeError:
pass
+
errcheck = property(_geterrcheck, _seterrcheck, _delerrcheck)
def _ffishapes(self, args, restype):
@@ -187,7 +187,7 @@
raise TypeError("invalid result type for callback function")
restype = restype._ffiargshape_
else:
- restype = 'O' # void
+ restype = 'O' # void
return argtypes, restype
def _set_address(self, address):
@@ -200,7 +200,7 @@
def __init__(self, *args):
self.name = None
- self._objects = {keepalive_key(0):self}
+ self._objects = {keepalive_key(0): self}
self._needs_free = True
# Empty function object -- this is needed for casts
@@ -221,10 +221,8 @@
if self._argtypes_ is None:
self._argtypes_ = []
self._ptr = self._getfuncptr_fromaddress(self._argtypes_, restype)
- self._check_argtypes_for_fastpath()
return
-
# A callback into python
if callable(argument) and not argsl:
self.callable = argument
@@ -258,7 +256,7 @@
if (sys.platform == 'win32' and isinstance(argument, int)
and argsl):
ffiargs, ffires = self._ffishapes(self._argtypes_, self._restype_)
- self._com_index = argument + 0x1000
+ self._com_index = argument + 0x1000
self.name = argsl.pop(0)
if argsl:
self.paramflags = argsl.pop(0)
@@ -280,6 +278,7 @@
except SystemExit as e:
handle_system_exit(e)
raise
+
return f
def __call__(self, *args, **kwargs):
@@ -328,7 +327,7 @@
# really slow". Now we don't worry that much about slowness
# of ctypes, and it's strange to get warnings for perfectly-
# legal code.
- #warnings.warn('C function without declared arguments called',
+ # warnings.warn('C function without declared arguments called',
# RuntimeWarning, stacklevel=2)
argtypes = []
@@ -337,7 +336,7 @@
if not args:
raise ValueError(
"native COM method call without 'this' parameter"
- )
+ )
thisvalue = args[0]
thisarg = cast(thisvalue, POINTER(POINTER(c_void_p)))
keepalives, newargs, argtypes, outargs, errcheckargs = (
@@ -366,7 +365,6 @@
return tuple(outargs)
def _call_funcptr(self, funcptr, *newargs):
-
if self._flags_ & _rawffi.FUNCFLAG_USE_ERRNO:
tmp = _rawffi.get_errno()
_rawffi.set_errno(get_errno())
@@ -431,7 +429,7 @@
ffiargs = [argtype.get_ffi_argtype() for argtype in argtypes]
ffires = restype.get_ffi_argtype()
return _ffi.FuncPtr.fromaddr(ptr, '', ffiargs, ffires,
self._flags_)
-
+
cdll = self.dll._handle
try:
ffi_argtypes = [argtype.get_ffi_argtype() for argtype in argtypes]
@@ -450,7 +448,7 @@
# funcname -> _funcname@<n>
# where n is 0, 4, 8, 12, ..., 128
for i in range(33):
- mangled_name = "_%s@%d" % (self.name, i*4)
+ mangled_name = "_%s@%d" % (self.name, i * 4)
try:
return cdll.getfunc(mangled_name,
ffi_argtypes, ffi_restype,
@@ -492,7 +490,7 @@
for argtype, arg in zip(argtypes, args):
param = argtype.from_param(arg)
_type_ = getattr(argtype, '_type_', None)
- if _type_ == 'P': # special-case for c_void_p
+ if _type_ == 'P': # special-case for c_void_p
param = param._get_buffer_value()
elif self._is_primitive(argtype):
param = param.value
@@ -668,69 +666,11 @@
self._needs_free = False
-def make_fastpath_subclass(CFuncPtr):
- if CFuncPtr._is_fastpath:
- return CFuncPtr
- #
- try:
- return make_fastpath_subclass.memo[CFuncPtr]
- except KeyError:
- pass
-
- class CFuncPtrFast(CFuncPtr):
-
- _is_fastpath = True
- _slowpath_allowed = True # set to False by tests
-
- @classmethod
- def enable_fastpath_maybe(cls, obj):
- if (obj.callable is None and
- obj._com_index is None):
- obj.__class__ = cls
-
- def __rollback(self):
- assert self._slowpath_allowed
- self.__class__ = CFuncPtr
-
- # disable the fast path if we reset argtypes
- def _setargtypes(self, argtypes):
- self.__rollback()
- self._setargtypes(argtypes)
- argtypes = property(CFuncPtr._getargtypes, _setargtypes)
-
- def _setcallable(self, func):
- self.__rollback()
- self.callable = func
- callable = property(lambda x: None, _setcallable)
-
- def _setcom_index(self, idx):
- self.__rollback()
- self._com_index = idx
- _com_index = property(lambda x: None, _setcom_index)
-
- def __call__(self, *args):
- thisarg = None
- argtypes = self._argtypes_
- restype = self._restype_
- funcptr = self._getfuncptr(argtypes, restype, thisarg)
- try:
- result = self._call_funcptr(funcptr, *args)
- result, _ = self._do_errcheck(result, args)
- except (TypeError, ArgumentError, UnicodeDecodeError):
- assert self._slowpath_allowed
- return CFuncPtr.__call__(self, *args)
- return result
-
- make_fastpath_subclass.memo[CFuncPtr] = CFuncPtrFast
- return CFuncPtrFast
-make_fastpath_subclass.memo = {}
-
-
def handle_system_exit(e):
# issue #1194: if we get SystemExit here, then exit the interpreter.
# Highly obscure imho but some people seem to depend on it.
if sys.flags.inspect:
- return # Don't exit if -i flag was given.
+ return # Don't exit if -i flag was given.
else:
code = e.code
if isinstance(code, int):
diff --git a/lib_pypy/_ctypes/structure.py b/lib_pypy/_ctypes/structure.py
--- a/lib_pypy/_ctypes/structure.py
+++ b/lib_pypy/_ctypes/structure.py
@@ -233,6 +233,9 @@
if ('_abstract_' in cls.__dict__ or cls is Structure
or cls is union.Union):
raise TypeError("abstract class")
+ if hasattr(cls, '_swappedbytes_'):
+ raise NotImplementedError("missing in PyPy: structure/union with "
+ "swapped (non-native) byte ordering")
if hasattr(cls, '_ffistruct_'):
self.__dict__['_buffer'] = self._ffistruct_(autofree=True)
return self
diff --git a/lib_pypy/_decimal_build.py b/lib_pypy/_decimal_build.py
--- a/lib_pypy/_decimal_build.py
+++ b/lib_pypy/_decimal_build.py
@@ -226,6 +226,16 @@
_libdir = os.path.join(os.path.dirname(__file__), '_libmpdec')
ffi.set_source('_decimal_cffi',
"""
+#ifdef _MSC_VER
+ #if defined(_WIN64)
+ typedef __int64 LONG_PTR;
+ #else
+ typedef long LONG_PTR;
+ #endif
+ typedef LONG_PTR ssize_t;
+#else
+ #define HAVE_STDINT_H
+#endif
#include "mpdecimal.h"
#define MPD_Float_operation MPD_Not_implemented
@@ -266,7 +276,6 @@
include_dirs=[_libdir],
extra_compile_args=[
"-DANSI",
- "-DHAVE_STDINT_H",
"-DHAVE_INTTYPES_H",
"-DCONFIG_64" if sys.maxsize > 1 << 32 else "-DCONFIG_32",
],
diff --git a/lib_pypy/_lzma_build.py b/lib_pypy/_lzma_build.py
--- a/lib_pypy/_lzma_build.py
+++ b/lib_pypy/_lzma_build.py
@@ -235,6 +235,9 @@
""")
ffi.set_source('_lzma_cffi', """
+#ifdef _MSC_VER
+#define LZMA_API_STATIC
+#endif
#include <lzma.h>
#include <stdlib.h>
void _pylzma_stream_init(lzma_stream *strm) {
diff --git a/lib_pypy/_md5.py b/lib_pypy/_md5.py
--- a/lib_pypy/_md5.py
+++ b/lib_pypy/_md5.py
@@ -53,10 +53,10 @@
j = 0
i = 0
while i < imax:
- b0 = ord(list[j])
- b1 = ord(list[j+1]) << 8
- b2 = ord(list[j+2]) << 16
- b3 = ord(list[j+3]) << 24
+ b0 = list[j]
+ b1 = list[j+1] << 8
+ b2 = list[j+2] << 16
+ b3 = list[j+3] << 24
hl[i] = b0 | b1 |b2 | b3
i = i+1
j = j+4
@@ -319,7 +319,7 @@
else:
padLen = 120 - index
- padding = [b'\200'] + [b'\000'] * 63
+ padding = [128] + [0] * 63
self.update(padding[:padLen])
# Append length (before padding).
diff --git a/lib_pypy/_pypy_collections.py b/lib_pypy/_pypy_collections.py
--- a/lib_pypy/_pypy_collections.py
+++ b/lib_pypy/_pypy_collections.py
@@ -1,6 +1,5 @@
-from __pypy__ import reversed_dict, move_to_end
+from __pypy__ import reversed_dict, move_to_end, objects_in_repr
from _operator import eq as _eq
-from reprlib import recursive_repr as _recursive_repr
import _collections_abc
@@ -44,12 +43,21 @@
'''
return move_to_end(self, key, last)
- @_recursive_repr()
def __repr__(self):
'od.__repr__() <==> repr(od)'
if not self:
return '%s()' % (self.__class__.__name__,)
- return '%s(%r)' % (self.__class__.__name__, list(self.items()))
+ currently_in_repr = objects_in_repr()
+ if self in currently_in_repr:
+ return '...'
+ currently_in_repr[self] = 1
+ try:
+ return '%s(%r)' % (self.__class__.__name__, list(self.items()))
+ finally:
+ try:
+ del currently_in_repr[self]
+ except:
+ pass
def __reduce__(self):
'Return state information for pickling'
diff --git a/lib_pypy/_pypy_testcapi.py b/lib_pypy/_pypy_testcapi.py
--- a/lib_pypy/_pypy_testcapi.py
+++ b/lib_pypy/_pypy_testcapi.py
@@ -61,13 +61,12 @@
# set link options
output_filename = modulename + _get_c_extension_suffix()
if sys.platform == 'win32':
- # XXX pyconfig.h uses a pragma to link to the import library,
- # which is currently python3.lib
- library = os.path.join(thisdir, '..', 'libs', 'python32')
+ libname = 'python{0[0]}{0[1]}'.format(sys.version_info)
+ library = os.path.join(thisdir, '..', 'lib', libname)
if not os.path.exists(library + '.lib'):
# For a local translation or nightly build
- library = os.path.join(thisdir, '..', 'pypy', 'goal', 'python32')
- assert os.path.exists(library + '.lib'),'Could not find import library
"%s"' % library
+ library = os.path.join(thisdir, '..', 'pypy', 'goal', libname)
+ assert os.path.exists(library + '.lib'), 'Could not find import
library "%s"' % library
libraries = [library, 'oleaut32']
extra_ldargs = ['/MANIFEST', # needed for VC10
'/EXPORT:PyInit_' + modulename]
diff --git a/lib_pypy/_pypy_winbase_build.py b/lib_pypy/_pypy_winbase_build.py
--- a/lib_pypy/_pypy_winbase_build.py
+++ b/lib_pypy/_pypy_winbase_build.py
@@ -76,6 +76,9 @@
HANDLE WINAPI GetCurrentProcess(void);
BOOL WINAPI DuplicateHandle(HANDLE, HANDLE, HANDLE, LPHANDLE,
DWORD, BOOL, DWORD);
+BOOL WINAPI CreateProcessA(char *, char *, void *,
+ void *, BOOL, DWORD, char *,
+ char *, LPSTARTUPINFO, LPPROCESS_INFORMATION);
BOOL WINAPI CreateProcessW(wchar_t *, wchar_t *, void *,
void *, BOOL, DWORD, wchar_t *,
wchar_t *, LPSTARTUPINFO, LPPROCESS_INFORMATION);
@@ -84,6 +87,12 @@
BOOL WINAPI TerminateProcess(HANDLE, UINT);
HANDLE WINAPI GetStdHandle(DWORD);
DWORD WINAPI GetModuleFileNameW(HANDLE, wchar_t *, DWORD);
+
+UINT WINAPI SetErrorMode(UINT);
+#define SEM_FAILCRITICALERRORS 0x0001
+#define SEM_NOGPFAULTERRORBOX 0x0002
+#define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
+#define SEM_NOOPENFILEERRORBOX 0x8000
""")
# --------------------
diff --git a/lib_pypy/_pypy_winbase_cffi.py b/lib_pypy/_pypy_winbase_cffi.py
--- a/lib_pypy/_pypy_winbase_cffi.py
+++ b/lib_pypy/_pypy_winbase_cffi.py
@@ -3,8 +3,8 @@
ffi = _cffi_backend.FFI('_pypy_winbase_cffi',
_version = 0x2601,
- _types =
b'\x00\x00\x01\x0D\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x09\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x19\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x15\x03\x00\x00\x13\x11\x00\x00\x59\x03\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x08\x01\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x16\x03\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x15\x11\x00\x00\x15\x11\x00\x00\x13\x11\x00\x00\x0A\x01\x00\x00\x07\x01\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x4C\x03\x00\x00\x2D\x11\x00\x00\x15\x11\x00\x00\x15\x11\x00\x00\x07\x01\x00\x00\x0A\x01\x00\x00\x2D\x11\x00\x00\x2D\x11\x00\x00\x54\x03\x00\x00\x53\x03\x00\x00\x02\x0F\x00\x00\x0D\x0D\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x16\x0D\x00\x00\x15\x11\x00\x
00\x0A\x01\x00\x00\x02\x0F\x00\x00\x16\x0D\x00\x00\x15\x11\x00\x00\x2D\x11\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x16\x0D\x00\x00\x02\x0F\x00\x00\x47\x0D\x00\x00\x06\x01\x00\x00\x00\x0F\x00\x00\x47\x0D\x00\x00\x00\x0F\x00\x00\x47\x0D\x00\x00\x10\x01\x00\x00\x00\x0F\x00\x00\x15\x0D\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x15\x0D\x00\x00\x02\x0F\x00\x00\x00\x09\x00\x00\x01\x09\x00\x00\x56\x03\x00\x00\x02\x01\x00\x00\x58\x03\x00\x00\x04\x01\x00\x00\x00\x01',
- _globals =
(b'\x00\x00\x18\x23CloseHandle',0,b'\x00\x00\x12\x23CreatePipe',0,b'\x00\x00\x2C\x23CreateProcessW',0,b'\x00\x00\x23\x23DuplicateHandle',0,b'\x00\x00\x51\x23GetCurrentProcess',0,b'\x00\x00\x1F\x23GetExitCodeProcess',0,b'\x00\x00\x3F\x23GetModuleFileNameW',0,b'\x00\x00\x4E\x23GetStdHandle',0,b'\x00\x00\x44\x23GetVersion',0,b'\x00\x00\x1B\x23TerminateProcess',0,b'\x00\x00\x3B\x23WaitForSingleObject',0,b'\x00\x00\x38\x23_get_osfhandle',0,b'\x00\x00\x10\x23_getch',0,b'\x00\x00\x10\x23_getche',0,b'\x00\x00\x49\x23_getwch',0,b'\x00\x00\x49\x23_getwche',0,b'\x00\x00\x10\x23_kbhit',0,b'\x00\x00\x07\x23_locking',0,b'\x00\x00\x0C\x23_open_osfhandle',0,b'\x00\x00\x00\x23_putch',0,b'\x00\x00\x4B\x23_putwch',0,b'\x00\x00\x03\x23_setmode',0,b'\x00\x00\x00\x23_ungetch',0,b'\x00\x00\x46\x23_ungetwch',0),
- _struct_unions =
((b'\x00\x00\x00\x53\x00\x00\x00\x02$PROCESS_INFORMATION',b'\x00\x00\x15\x11hProcess',b'\x00\x00\x15\x11hThread',b'\x00\x00\x16\x11dwProcessId',b'\x00\x00\x16\x11dwThreadId'),(b'\x00\x00\x00\x54\x00\x00\x00\x02$STARTUPINFO',b'\x00\x00\x16\x11cb',b'\x00\x00\x55\x11lpReserved',b'\x00\x00\x55\x11lpDesktop',b'\x00\x00\x55\x11lpTitle',b'\x00\x00\x16\x11dwX',b'\x00\x00\x16\x11dwY',b'\x00\x00\x16\x11dwXSize',b'\x00\x00\x16\x11dwYSize',b'\x00\x00\x16\x11dwXCountChars',b'\x00\x00\x16\x11dwYCountChars',b'\x00\x00\x16\x11dwFillAttribute',b'\x00\x00\x16\x11dwFlags',b'\x00\x00\x47\x11wShowWindow',b'\x00\x00\x47\x11cbReserved2',b'\x00\x00\x57\x11lpReserved2',b'\x00\x00\x15\x11hStdInput',b'\x00\x00\x15\x11hStdOutput',b'\x00\x00\x15\x11hStdError')),
- _typenames =
(b'\x00\x00\x00\x36LPPROCESS_INFORMATION',b'\x00\x00\x00\x35LPSTARTUPINFO',b'\x00\x00\x00\x53PROCESS_INFORMATION',b'\x00\x00\x00\x54STARTUPINFO',b'\x00\x00\x00\x47wint_t'),
+ _types =
b'\x00\x00\x01\x0D\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x07\x01\x00\x00\x07\x01\x00\x00\x09\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x19\x01\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x00\x0F\x00\x00\x01\x0D\x00\x00\x64\x03\x00\x00\x13\x11\x00\x00\x67\x03\x00\x00\x15\x11\x00\x00\x07\x01\x00\x00\x0A\x01\x00\x00\x13\x11\x00\x00\x13\x11\x00\x00\x63\x03\x00\x00\x62\x03\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x03\x00\x00\x1F\x11\x00\x00\x15\x11\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x08\x01\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x18\x03\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x15\x11\x00\x00\x15\x11\x00\x00\x15\x11\x00\x00\x1F\x11\x00\x00\x0A\x01\x00\x00\x07\x01\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x01\x0D\x00\x00\x5B\x03\x00\x00\x39\x11\x00\x00\x15\x11\x00\x00\x15\x11\x00\x
00\x07\x01\x00\x00\x0A\x01\x00\x00\x39\x11\x00\x00\x39\x11\x00\x00\x1B\x11\x00\x00\x1C\x11\x00\x00\x02\x0F\x00\x00\x0D\x0D\x00\x00\x07\x01\x00\x00\x00\x0F\x00\x00\x29\x0D\x00\x00\x08\x01\x00\x00\x02\x0F\x00\x00\x18\x0D\x00\x00\x15\x11\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x18\x0D\x00\x00\x15\x11\x00\x00\x39\x11\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x18\x0D\x00\x00\x02\x0F\x00\x00\x56\x0D\x00\x00\x06\x01\x00\x00\x00\x0F\x00\x00\x56\x0D\x00\x00\x00\x0F\x00\x00\x56\x0D\x00\x00\x10\x01\x00\x00\x00\x0F\x00\x00\x15\x0D\x00\x00\x0A\x01\x00\x00\x02\x0F\x00\x00\x15\x0D\x00\x00\x02\x0F\x00\x00\x00\x09\x00\x00\x01\x09\x00\x00\x02\x01\x00\x00\x66\x03\x00\x00\x04\x01\x00\x00\x00\x01',
+ _globals =
(b'\x00\x00\x24\x23CloseHandle',0,b'\x00\x00\x1E\x23CreatePipe',0,b'\x00\x00\x12\x23CreateProcessA',0,b'\x00\x00\x38\x23CreateProcessW',0,b'\x00\x00\x2F\x23DuplicateHandle',0,b'\x00\x00\x60\x23GetCurrentProcess',0,b'\x00\x00\x2B\x23GetExitCodeProcess',0,b'\x00\x00\x4E\x23GetModuleFileNameW',0,b'\x00\x00\x5D\x23GetStdHandle',0,b'\x00\x00\x53\x23GetVersion',0,b'\xFF\xFF\xFF\x1FSEM_FAILCRITICALERRORS',1,b'\xFF\xFF\xFF\x1FSEM_NOALIGNMENTFAULTEXCEPT',4,b'\xFF\xFF\xFF\x1FSEM_NOGPFAULTERRORBOX',2,b'\xFF\xFF\xFF\x1FSEM_NOOPENFILEERRORBOX',32768,b'\x00\x00\x47\x23SetErrorMode',0,b'\x00\x00\x27\x23TerminateProcess',0,b'\x00\x00\x4A\x23WaitForSingleObject',0,b'\x00\x00\x44\x23_get_osfhandle',0,b'\x00\x00\x10\x23_getch',0,b'\x00\x00\x10\x23_getche',0,b'\x00\x00\x58\x23_getwch',0,b'\x00\x00\x58\x23_getwche',0,b'\x00\x00\x10\x23_kbhit',0,b'\x00\x00\x07\x23_locking',0,b'\x00\x00\x0C\x23_open_osfhandle',0,b'\x00\x00\x00\x23_putch',0,b'\x00\x00\x5A\x23_putwch',0,b'\x00\x00\x03\x23_set
mode',0,b'\x00\x00\x00\x23_ungetch',0,b'\x00\x00\x55\x23_ungetwch',0),
+ _struct_unions =
((b'\x00\x00\x00\x62\x00\x00\x00\x02$PROCESS_INFORMATION',b'\x00\x00\x15\x11hProcess',b'\x00\x00\x15\x11hThread',b'\x00\x00\x18\x11dwProcessId',b'\x00\x00\x18\x11dwThreadId'),(b'\x00\x00\x00\x63\x00\x00\x00\x02$STARTUPINFO',b'\x00\x00\x18\x11cb',b'\x00\x00\x13\x11lpReserved',b'\x00\x00\x13\x11lpDesktop',b'\x00\x00\x13\x11lpTitle',b'\x00\x00\x18\x11dwX',b'\x00\x00\x18\x11dwY',b'\x00\x00\x18\x11dwXSize',b'\x00\x00\x18\x11dwYSize',b'\x00\x00\x18\x11dwXCountChars',b'\x00\x00\x18\x11dwYCountChars',b'\x00\x00\x18\x11dwFillAttribute',b'\x00\x00\x18\x11dwFlags',b'\x00\x00\x56\x11wShowWindow',b'\x00\x00\x56\x11cbReserved2',b'\x00\x00\x65\x11lpReserved2',b'\x00\x00\x15\x11hStdInput',b'\x00\x00\x15\x11hStdOutput',b'\x00\x00\x15\x11hStdError')),
+ _typenames =
(b'\x00\x00\x00\x1CLPPROCESS_INFORMATION',b'\x00\x00\x00\x1BLPSTARTUPINFO',b'\x00\x00\x00\x62PROCESS_INFORMATION',b'\x00\x00\x00\x63STARTUPINFO',b'\x00\x00\x00\x56wint_t'),
)
diff --git a/lib_pypy/_sqlite3.py b/lib_pypy/_sqlite3.py
--- a/lib_pypy/_sqlite3.py
+++ b/lib_pypy/_sqlite3.py
@@ -32,10 +32,11 @@
import threading
try:
- from __pypy__ import newlist_hint
+ from __pypy__ import newlist_hint, add_memory_pressure
except ImportError:
assert '__pypy__' not in sys.builtin_module_names
newlist_hint = lambda sizehint: []
+ add_memory_pressure = lambda size: None
if sys.version_info[0] >= 3:
StandardError = Exception
@@ -152,6 +153,9 @@
check_same_thread=True, factory=None, cached_statements=100,
uri=0):
factory = Connection if not factory else factory
+ # an sqlite3 db seems to be around 100 KiB at least (doesn't matter if
+ # backed by :memory: or a file)
+ add_memory_pressure(100 * 1024)
return factory(database, timeout, detect_types, isolation_level,
check_same_thread, factory, cached_statements, uri)
diff --git a/lib_pypy/_structseq.py b/lib_pypy/_structseq.py
--- a/lib_pypy/_structseq.py
+++ b/lib_pypy/_structseq.py
@@ -129,3 +129,38 @@
parts = ["%s=%r" % (fields[index].__name__, value)
for index, value in enumerate(self[:visible_count])]
return "%s(%s)" % (self._name, ", ".join(parts))
+
+
+class SimpleNamespace:
+ """A simple attribute-based namespace.
+
+SimpleNamespace(**kwargs)"""
+
+ def __init__(self, **kwargs):
+ self.__dict__.update(kwargs)
+
+ def __repr__(self):
+ ident = id(self)
+ if ident in sns_recurse:
+ return "namespace(...)"
+ sns_recurse.add(ident)
+ try:
+ pairs = ('%s=%r' % item for item in sorted(self.__dict__.items()))
+ return "namespace(%s)" % ', '.join(pairs)
+ finally:
+ sns_recurse.discard(ident)
+
+ def __eq__(self, other):
+ if issubclass(type(other), SimpleNamespace):
+ return self.__dict__ == other.__dict__
+ return NotImplemented
+
+ def __ne__(self, other):
+ if issubclass(type(other), SimpleNamespace):
+ return self.__dict__ != other.__dict__
+ return NotImplemented
+
+sns_recurse = set()
+
+# This class is not exposed in sys, but by the types module.
+SimpleNamespace.__module__ = 'types'
diff --git a/lib_pypy/_sysconfigdata.py b/lib_pypy/_sysconfigdata.py
--- a/lib_pypy/_sysconfigdata.py
+++ b/lib_pypy/_sysconfigdata.py
@@ -1,6 +1,6 @@
-import imp
+import _imp
-so_ext = [s[0] for s in imp.get_suffixes() if s[2] == imp.C_EXTENSION][0]
+so_ext = _imp.extension_suffixes()[0]
build_time_vars = {
"EXT_SUFFIX": so_ext,
diff --git a/lib_pypy/cffi/api.py b/lib_pypy/cffi/api.py
--- a/lib_pypy/cffi/api.py
+++ b/lib_pypy/cffi/api.py
@@ -563,7 +563,7 @@
if sys.platform == "win32":
# we need 'libpypy-c.lib'. Current distributions of
# pypy (>= 4.1) contain it as 'libs/python27.lib'.
- pythonlib = "python27"
+ pythonlib = "python{0[0]}{0[1]}".format(sys.version_info)
if hasattr(sys, 'prefix'):
ensure('library_dirs', os.path.join(sys.prefix, 'libs'))
else:
diff --git a/lib_pypy/msvcrt.py b/lib_pypy/msvcrt.py
--- a/lib_pypy/msvcrt.py
+++ b/lib_pypy/msvcrt.py
@@ -16,6 +16,7 @@
import _rawffi
from _pypy_winbase_cffi import ffi as _ffi
_lib = _ffi.dlopen(_rawffi.get_libc().name)
+_kernel32 = _ffi.dlopen('kernel32')
import errno
@@ -122,3 +123,9 @@
def ungetwch(ch):
if _lib._ungetwch(ord(ch)) == -1: # EOF
_ioerr()
+
+SetErrorMode = _kernel32.SetErrorMode
+SEM_FAILCRITICALERRORS = _lib.SEM_FAILCRITICALERRORS
+SEM_NOGPFAULTERRORBOX = _lib.SEM_NOGPFAULTERRORBOX
+SEM_NOALIGNMENTFAULTEXCEPT = _lib.SEM_NOALIGNMENTFAULTEXCEPT
+SEM_NOOPENFILEERRORBOX = _lib.SEM_NOOPENFILEERRORBOX
diff --git a/lib_pypy/pyrepl/commands.py b/lib_pypy/pyrepl/commands.py
--- a/lib_pypy/pyrepl/commands.py
+++ b/lib_pypy/pyrepl/commands.py
@@ -384,4 +384,7 @@
class quoted_insert(Command):
kills_digit_arg = 0
def do(self):
- self.reader.push_input_trans(QITrans())
+ # XXX in Python 3, processing insert/C-q/C-v keys crashes
+ # because of a mixture of str and bytes. Disable these keys.
+ pass
+ #self.reader.push_input_trans(QITrans())
diff --git a/lib_pypy/pyrepl/keymaps.py b/lib_pypy/pyrepl/keymaps.py
--- a/lib_pypy/pyrepl/keymaps.py
+++ b/lib_pypy/pyrepl/keymaps.py
@@ -62,7 +62,7 @@
(r'\M-\n', 'self-insert'),
(r'\<backslash>', 'self-insert')] + \
[(c, 'self-insert')
- for c in map(chr, range(32, 127)) if c <> '\\'] + \
+ for c in map(chr, range(32, 127)) if c != '\\'] + \
[(c, 'self-insert')
for c in map(chr, range(128, 256)) if c.isalpha()] + \
[(r'\<up>', 'up'),
@@ -101,7 +101,7 @@
reader_vi_insert_keymap = tuple(
[(c, 'self-insert')
- for c in map(chr, range(32, 127)) if c <> '\\'] + \
+ for c in map(chr, range(32, 127)) if c != '\\'] + \
[(c, 'self-insert')
for c in map(chr, range(128, 256)) if c.isalpha()] + \
[(r'\C-d', 'delete'),
diff --git a/lib_pypy/pyrepl/pygame_console.py
b/lib_pypy/pyrepl/pygame_console.py
--- a/lib_pypy/pyrepl/pygame_console.py
+++ b/lib_pypy/pyrepl/pygame_console.py
@@ -130,7 +130,7 @@
s.fill(c, [0, 600 - bmargin, 800, bmargin])
s.fill(c, [800 - rmargin, 0, lmargin, 600])
- def refresh(self, screen, (cx, cy)):
+ def refresh(self, screen, cxy):
self.screen = screen
self.pygame_screen.fill(colors.bg,
[0, tmargin + self.cur_top + self.scroll,
@@ -139,6 +139,7 @@
line_top = self.cur_top
width, height = self.fontsize
+ cx, cy = cxy
self.cxy = (cx, cy)
cp = self.char_pos(cx, cy)
if cp[1] < tmargin:
@@ -282,7 +283,7 @@
def forgetinput(self):
"""Forget all pending, but not yet processed input."""
- while pygame.event.poll().type <> NOEVENT:
+ while pygame.event.poll().type != NOEVENT:
pass
def getpending(self):
@@ -299,7 +300,7 @@
def wait(self):
"""Wait for an event."""
- raise Exception, "erp!"
+ raise Exception("erp!")
def repaint(self):
# perhaps we should consolidate grobs?
diff --git a/lib_pypy/pyrepl/pygame_keymap.py b/lib_pypy/pyrepl/pygame_keymap.py
--- a/lib_pypy/pyrepl/pygame_keymap.py
+++ b/lib_pypy/pyrepl/pygame_keymap.py
@@ -90,22 +90,22 @@
s += 2
elif c == "c":
if key[s + 2] != '-':
- raise KeySpecError, \
+ raise KeySpecError(
"\\C must be followed by `-' (char %d of %s)"%(
- s + 2, repr(key))
+ s + 2, repr(key)))
if ctrl:
- raise KeySpecError, "doubled \\C- (char %d of %s)"%(
- s + 1, repr(key))
+ raise KeySpecError("doubled \\C- (char %d of %s)"%(
+ s + 1, repr(key)))
ctrl = 1
s += 3
elif c == "m":
if key[s + 2] != '-':
- raise KeySpecError, \
+ raise KeySpecError(
"\\M must be followed by `-' (char %d of %s)"%(
- s + 2, repr(key))
+ s + 2, repr(key)))
if meta:
- raise KeySpecError, "doubled \\M- (char %d of %s)"%(
- s + 1, repr(key))
+ raise KeySpecError("doubled \\M- (char %d of %s)"%(
+ s + 1, repr(key)))
meta = 1
s += 3
elif c.isdigit():
@@ -119,22 +119,22 @@
elif c == '<':
t = key.find('>', s)
if t == -1:
- raise KeySpecError, \
+ raise KeySpecError(
"unterminated \\< starting at char %d of %s"%(
- s + 1, repr(key))
+ s + 1, repr(key)))
try:
ret = _keynames[key[s+2:t].lower()]
s = t + 1
except KeyError:
- raise KeySpecError, \
+ raise KeySpecError(
"unrecognised keyname `%s' at char %d of %s"%(
- key[s+2:t], s + 2, repr(key))
+ key[s+2:t], s + 2, repr(key)))
if ret is None:
return None, s
else:
- raise KeySpecError, \
+ raise KeySpecError(
"unknown backslash escape %s at char %d of %s"%(
- `c`, s + 2, repr(key))
+ repr(c), s + 2, repr(key)))
else:
if ctrl:
ret = chr(ord(key[s]) & 0x1f) # curses.ascii.ctrl()
@@ -160,9 +160,9 @@
r.setdefault(key[0], {})[key[1:]] = value
for key, value in r.items():
if value.has_key(()):
- if len(value) <> 1:
- raise KeySpecError, \
- "key definitions for %s clash"%(value.values(),)
+ if len(value) != 1:
+ raise KeySpecError(
+ "key definitions for %s clash"%(value.values(),))
else:
r[key] = value[()]
else:
@@ -202,7 +202,7 @@
return ''
name, s = keyname(keyseq)
if name:
- if name <> 'escape' or s == len(keyseq):
+ if name != 'escape' or s == len(keyseq):
return '\\<' + name + '>' + unparse_key(keyseq[s:])
else:
return '\\M-' + unparse_key(keyseq[1:])
@@ -226,7 +226,7 @@
return []
name, s = keyname(keyseq)
if name:
- if name <> 'escape' or s == len(keyseq):
+ if name != 'escape' or s == len(keyseq):
return [name] + _unparse_keyf(keyseq[s:])
else:
rest = _unparse_keyf(keyseq[1:])
diff --git a/pypy/config/pypyoption.py b/pypy/config/pypyoption.py
--- a/pypy/config/pypyoption.py
+++ b/pypy/config/pypyoption.py
@@ -46,8 +46,9 @@
from rpython.jit.backend import detect_cpu
try:
if detect_cpu.autodetect().startswith('x86'):
- working_modules.add('_vmprof')
- working_modules.add('faulthandler')
+ if not sys.platform.startswith('openbsd'):
+ working_modules.add('_vmprof')
+ working_modules.add('faulthandler')
except detect_cpu.ProcessorAutodetectError:
pass
@@ -72,8 +73,6 @@
if "cppyy" in working_modules:
working_modules.remove("cppyy") # not tested on win32
- if "faulthandler" in working_modules:
- working_modules.remove("faulthandler") # missing details
# The _locale module is needed by site.py on Windows
default_modules.add("_locale")
@@ -224,9 +223,6 @@
BoolOption("withsmalllong", "use a version of 'long' in a C long long",
default=False),
- BoolOption("withstrbuf", "use strings optimized for addition (ver 2)",
- default=False),
-
BoolOption("withspecialisedtuple",
"use specialised tuples",
default=False),
diff --git a/pypy/doc/build.rst b/pypy/doc/build.rst
--- a/pypy/doc/build.rst
+++ b/pypy/doc/build.rst
@@ -79,6 +79,9 @@
_ssl
libssl
+_vmprof
+ libunwind (optional, loaded dynamically at runtime)
+
Make sure to have these libraries (with development headers) installed
before building PyPy, otherwise the resulting binary will not contain
these modules. Furthermore, the following libraries should be present
@@ -107,22 +110,22 @@
apt-get install gcc make libffi-dev pkg-config libz-dev libbz2-dev \
libsqlite3-dev libncurses-dev libexpat1-dev libssl-dev libgdbm-dev \
- tk-dev libgc-dev \
+ tk-dev libgc-dev python-cffi \
liblzma-dev # For lzma on PyPy3.
On Fedora::
dnf install gcc make libffi-devel pkgconfig zlib-devel bzip2-devel \
sqlite-devel ncurses-devel expat-devel openssl-devel tk-devel \
- gdbm-devel \
+ gdbm-devel python-cffi\
xz-devel # For lzma on PyPy3.
On SLES11::
zypper install gcc make python-devel pkg-config \
zlib-devel libopenssl-devel libbz2-devel sqlite3-devel \
- libexpat-devel libffi-devel python-curses \
- xz-devel # For lzma on PyPy3.
+ libexpat-devel libffi-devel python-curses python-cffi \
+ xz-devel # For lzma on PyPy3.
(XXX plus the SLES11 version of libgdbm-dev and tk-dev)
On Mac OS X, most of these build-time dependencies are installed alongside
@@ -185,7 +188,7 @@
::
cd pypy/tool/release
- ./package.py pypy-VER-PLATFORM
+ ./package.py --archive-name=pypy-VER-PLATFORM
This creates a clean and prepared hierarchy, as well as a ``.tar.bz2``
with the same content; both are found by default in
diff --git a/pypy/doc/cpython_differences.rst b/pypy/doc/cpython_differences.rst
--- a/pypy/doc/cpython_differences.rst
+++ b/pypy/doc/cpython_differences.rst
@@ -364,6 +364,24 @@
.. __:
https://bitbucket.org/pypy/pypy/issue/1974/different-behaviour-for-collections-of
+Performance Differences
+-------------------------
+
+CPython has an optimization that can make repeated string concatenation not
+quadratic. For example, this kind of code runs in O(n) time::
+
+ s = ''
+ for string in mylist:
+ s += string
+
+In PyPy, this code will always have quadratic complexity. Note also, that the
+CPython optimization is brittle and can break by having slight variations in
+your code anyway. So you should anyway replace the code with::
+
+ parts = []
+ for string in mylist:
+ parts.append(string)
+ s = "".join(parts)
Miscellaneous
-------------
@@ -496,7 +514,14 @@
the rest is kept. If you return an unexpected string from
``__hex__()`` you get an exception (or a crash before CPython 2.7.13).
-* PyPy3: ``__class__`` attritube assignment between heaptypes and non
heaptypes.
+* In PyPy, dictionaries passed as ``**kwargs`` can contain only string keys,
+ even for ``dict()`` and ``dict.update()``. CPython 2.7 allows non-string
+ keys in these two cases (and only there, as far as we know). E.g. this
+ code produces a ``TypeError``, on CPython 3.x as well as on any PyPy:
+ ``dict(**{1: 2})``. (Note that ``dict(**d1)`` is equivalent to
+ ``dict(d1)``.)
+
+* PyPy3: ``__class__`` attribute assignment between heaptypes and non
heaptypes.
CPython allows that for module subtypes, but not for e.g. ``int``
or ``float`` subtypes. Currently PyPy does not support the
``__class__`` attribute assignment for any non heaptype subtype.
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-v5.7.1.rst
release-v5.7.0.rst
release-pypy2.7-v5.6.0.rst
release-pypy2.7-v5.4.1.rst
@@ -59,6 +60,7 @@
.. toctree::
+ release-v5.7.1.rst
release-v5.7.0.rst
CPython 3.3 compatible versions
diff --git a/pypy/doc/install.rst b/pypy/doc/install.rst
--- a/pypy/doc/install.rst
+++ b/pypy/doc/install.rst
@@ -32,10 +32,10 @@
.. code-block:: console
- $ tar xf pypy-2.1.tar.bz2
- $ ./pypy-2.1/bin/pypy
- Python 2.7.3 (480845e6b1dd, Jul 31 2013, 11:05:31)
- [PyPy 2.1.0 with GCC 4.4.3] on linux2
+ $ tar xf pypy-x.y.z.tar.bz2
+ $ ./pypy-x.y.z/bin/pypy
+ Python 2.7.x (xxxxxxxxxxxx, Date, Time)
+ [PyPy x.y.z with GCC x.y.z] on linux2
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``PyPy is an exciting
technology
that lets you to write fast, portable, multi-platform interpreters with
less
@@ -57,6 +57,7 @@
.. code-block:: console
$ ./pypy-xxx/bin/pypy -m ensurepip
+ $ ./pypy-xxx/bin/pip install -U pip wheel # to upgrade to the latest
versions
$ ./pypy-xxx/bin/pip install pygments # for example
Third party libraries will be installed in ``pypy-xxx/site-packages``, and
@@ -77,7 +78,17 @@
# from the mercurial checkout
$ virtualenv -p /path/to/pypy/pypy/translator/goal/pypy-c my-pypy-env
-Note that bin/python is now a symlink to bin/pypy.
+ # in any case activate it
+ $ source my-pypy-env/bin/activate
+
+Note that my-pypy-env/bin/python is now a symlink to my-pypy-env/bin/pypy
+so you should be able to run pypy simply by typing::
+
+ $ python
+
+You should still upgrade pip and wheel to the latest versions via::
+
+ $ my-pypy-env/bin/pip install -U pip wheel
.. _pip: http://pypi.python.org/pypi/pip
.. _ensurepip: https://docs.python.org/2.7/library/ensurepip.html
diff --git a/pypy/doc/release-v5.7.0.rst b/pypy/doc/release-v5.7.0.rst
--- a/pypy/doc/release-v5.7.0.rst
+++ b/pypy/doc/release-v5.7.0.rst
@@ -2,8 +2,11 @@
PyPy2.7 and PyPy3.5 v5.7 - two in one release
=============================================
-We have released PyPy2.7 v5.7, and a beta-quality PyPy3.5 v5.7 (for
-Linux 64bit only at first).
+The PyPy team is proud to release both PyPy2.7 v5.7 (an interpreter supporting
+Python v2.7 syntax), and a beta-quality PyPy3.5 v5.7 (an interpreter for Python
+v3.5 syntax). The two releases are both based on much the same codebase, thus
+the dual release. Note that PyPy3.5 supports Linux 64bit only for now.
+
This new PyPy2.7 release includes the upstream stdlib version 2.7.13, and
PyPy3.5 (our first in the 3.5 series) includes the upstream stdlib version
3.5.3.
@@ -88,14 +91,15 @@
* New features and cleanups
* update the format of the PYPYLOG file and improvements to vmprof
- * emit more sysconfig values for downstream cextension packages
+ * emit more sysconfig values for downstream cextension packages including
+ properly setting purelib and platlib to site-packages
* add ``PyAnySet_Check``, ``PyModule_GetName``, ``PyWeakref_Check*``,
``_PyImport_{Acquire,Release}Lock``, ``PyGen_Check*``, ``PyOS_AfterFork``,
* detect and raise on recreation of a PyPy object from a PyObject during
tp_dealloc
* refactor and clean up poor handling of unicode exposed in work on py3.5
* builtin module cppyy_ supports C++ 11, 14, etc. via cling (reflex has been
removed)
- * adapt ``weakref`` according to CPython issue #19542_, will be in CPython
2.7.14
+ * adapt ``weakref`` according to CPython issue 19542_, will be in CPython
2.7.14
* support translations with cpyext and the Boehm GC (for special cases like
RevDB_
* implement ``StringBuffer.get_raw_address`` for the buffer protocol, it is
@@ -121,16 +125,18 @@
* disable ``clock_gettime()`` on OS/X, since we support 10.11 and it was only
added in 10.12
* support ``HAVE_FSTATVFS`` which was unintentionally always false
- * fix user-created C-API heaptype, issue #2434_
+ * fix user-created C-API heaptype, issue 2434_
* fix ``PyDict_Update`` is not actually the same as ``dict.update``
* assign ``tp_doc`` on ``PyTypeObject`` and tie it to the app-level
``__doc__`` attribute
- issue #2446_
+ issue 2446_
* clean up memory leaks around ``PyObject_GetBuffer``,
``PyMemoryView_GET_BUFFER``,
``PyMemoryView_FromBuffer``, and ``PyBuffer_Release``
* improve support for creating C-extension objects from app-level classes,
filling more slots, especially ``tp_new`` and ``tp_dealloc``
- * fix for ``ctypes.c_bool`` returning ``bool`` restype, issue #2475_
+ * fix for ``ctypes.c_bool`` returning ``bool`` restype, issue 2475_
* fix in corner cases with the GIL and C-API functions
+ * allow overriding thread.local.__init__ in a subclass, issue 2501_
+ * allow ``PyClass_New`` to be called with NULL as the first arguemnt, issue
2504_
* Performance improvements:
@@ -183,21 +189,19 @@
* Performance improvements:
* do not create a list whenever ``descr_new`` of a ``bytesobject`` is called
- *
- *
- *
* The following features of Python 3.5 are not implemented yet in PyPy:
* PEP 442: Safe object finalization
* PEP 489: Multi-phase extension module initialization
- * XXX what else?
.. _resolved: whatsnew-pypy2-5.7.0.html
.. _19542: https://bugs.python.org/issue19542
.. _2434:
https://bitbucket.org/pypy/pypy/issues/2434/support-pybind11-in-conjunction-with-pypys
.. _2446:
https://bitbucket.org/pypy/pypy/issues/2446/cpyext-tp_doc-field-not-reflected-on
.. _2475: https://bitbucket.org/pypy/pypy/issues/2475
+.. _2501: https://bitbucket.org/pypy/pypy/issues/2501
+.. _2504: https://bitbucket.org/pypy/pypy/issues/2504
.. _RevDB: https://bitbucket.org/pypy/revdb
.. _cryptography: https://cryptography.io
.. _cppyy: cppyy.html
diff --git a/pypy/doc/release-v5.7.1.rst b/pypy/doc/release-v5.7.1.rst
new file mode 100644
--- /dev/null
+++ b/pypy/doc/release-v5.7.1.rst
@@ -0,0 +1,50 @@
+==========
+PyPy 5.7.1
+==========
+
+We have released a bugfix PyPy2.7-v5.7.1 and PyPy3.5-v5.7.1 beta (Linux 64bit),
+due to the following issues:
+
+ * correctly handle an edge case in dict.pop (issue 2508_)
+
+ * fix a regression to correctly handle multiple inheritance in a C-API type
+ where the second base is an app-level class with a ``__new__`` function
+
+ * fix a regression to fill a C-API type's ``tp_getattr`` slot from a
+ ``__getattr__`` method (issue 2523_)
+
+Thanks to those who reported the issues.
+
+.. _2508: https://bitbucket.org/pypy/pypy/issues/2508
+.. _2523: https://bitbucket.org/pypy/pypy/issues/2523
+
+What is PyPy?
+=============
+
+PyPy is a very compliant Python interpreter, almost a drop-in replacement for
+CPython 2.7 and CPython 3.5. It's fast (`PyPy and CPython 2.7.x`_ performance
comparison)
+due to its integrated tracing JIT compiler.
+
+We also welcome developers of other `dynamic languages`_ to see what RPython
+can do for them.
+
+The PyPy 2.7 release supports:
+
+ * **x86** machines on most common operating systems
+ (Linux 32/64 bits, Mac OS X 64 bits, Windows 32 bits, OpenBSD, FreeBSD)
+
+ * newer **ARM** hardware (ARMv6 or ARMv7, with VFPv3) running Linux,
+
+ * big- and little-endian variants of **PPC64** running Linux,
+
+ * **s390x** running Linux
+
+.. _`PyPy and CPython 2.7.x`: http://speed.pypy.org
+.. _`dynamic languages`: http://rpython.readthedocs.io/en/latest/examples.html
+
+Please update, and continue to help us make PyPy better.
+
+Cheers
+
+The PyPy Team
+
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
@@ -102,6 +102,8 @@
assert not not_documented
if branch == 'py3k':
assert not not_merged
+ else:
+ assert branch in documented, 'Please document this branch before
merging: %s' % branch
def test_startrev_on_default():
doc = ROOT.join('pypy', 'doc')
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
@@ -2,7 +2,69 @@
What's new in PyPy2.7 5.8+
==========================
-.. this is a revision shortly after release-pypy2.7-v5.7
+.. this is a revision shortly after release-pypy2.7-v5.7.0
.. startrev: 44f31f6dd39f
+Add cpyext interfaces for ``PyModule_New``
+Correctly handle `dict.pop`` where the ``pop``
+key is not the same type as the ``dict``'s and ``pop``
+is called with a default (will be part of release 5.7.1)
+
+.. branch: issue2522
+
+Fix missing tp_new on w_object called through multiple inheritance
+(will be part of release 5.7.1)
+
+.. branch: lstrip_to_empty_string
+
+.. branch: vmprof-native
+
+PyPy support to profile native frames in vmprof.
+
+.. branch: reusing-r11
+.. branch: branch-prediction
+
+Performance tweaks in the x86 JIT-generated machine code: rarely taken
+blocks are moved off-line. Also, the temporary register used to contain
+large constants is reused across instructions.
+
+.. branch: vmprof-0.4.4
+
+.. branch: controller-refactor
+
+Refactor rpython.rtyper.controllerentry.
+
+.. branch: PyBuffer-backport
+
+Internal refactoring of buffers and memoryviews. Memoryviews will now be
+accepted in a few more places, e.g. in compile().
+
+.. branch: sthalik/fix-signed-integer-sizes-1494493539409
+
+.. branch: cpyext-obj-stealing
+
+Redo much of the refcount semantics in PyList_{SG}etItem to closer match
+CPython and ensure the same PyObject stored in the list can be later
+retrieved
+
+.. branch: cpyext-recursionlimit
+
+Implement Py_EnterRecursiveCall and associated functions
+
+.. branch: pypy_ctypes_nosegfault_nofastpath
+
+Remove faulty fastpath from ctypes
+
+.. branch: sockopt_zero
+
+Passing a buffersize of 0 to socket.getsockopt
+
+.. branch: better-test-whatsnew
+
+.. branch: faster-rstruct-2
+
+Improve the performance of struct.pack and struct.pack_into by using raw_store
+or gc_store_indexed whenever possible. Moreover, enable the existing
+struct.unpack fast path to all the existing buffer types, whereas previously
+it was enabled only for strings
diff --git a/pypy/doc/whatsnew-pypy3-head.rst b/pypy/doc/whatsnew-pypy3-head.rst
--- a/pypy/doc/whatsnew-pypy3-head.rst
+++ b/pypy/doc/whatsnew-pypy3-head.rst
@@ -5,3 +5,24 @@
.. this is the revision after release-pypy3.3-5.7.x was branched
.. startrev: afbf09453369
+.. branch: mtest
+Use "<python> -m test" to run the CPython test suite, as documented by CPython,
+instead of our outdated regrverbose.py script.
+
+.. branch: win32-faulthandler
+
+Enable the 'faulthandler' module on Windows;
+this unblocks the Python test suite.
+
+.. branch: superjumbo
+
+Implement posix.posix_fallocate() and posix.posix_fadvise()
+
+.. branch: py3.5-mac-translate
+
+Fix for different posix primitives on MacOS
+
+.. branch: PyBuffer
+
+Internal refactoring of memoryviews and buffers, fixing some related
+performance issues.
diff --git a/pypy/doc/windows.rst b/pypy/doc/windows.rst
--- a/pypy/doc/windows.rst
+++ b/pypy/doc/windows.rst
@@ -11,7 +11,7 @@
To build pypy-c you need a working python environment, and a C compiler.
It is possible to translate with a CPython 2.6 or later, but this is not
-the preferred way, because it will take a lot longer to run – depending
+the preferred way, because it will take a lot longer to run � depending
on your architecture, between two and three times as long. So head to
`our downloads`_ and get the latest stable version.
@@ -23,11 +23,11 @@
Installing Visual Compiler v9 (for Python 2.7)
----------------------------------------------
-This compiler, while the standard one for Python 2.7, is depricated. Microsoft
has
+This compiler, while the standard one for Python 2.7, is deprecated. 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
+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``,
@@ -40,8 +40,9 @@
Translating PyPy with Visual Studio
-----------------------------------
-We routinely test translation using Visual Studio 2008, Express
-Edition. Other configurations may work as well.
+We routinely test translation using v9, also known as Visual Studio 2008.
+Our buildbot is still using the Express Edition, not the compiler noted above.
+Other configurations may work as well.
The translation scripts will set up the appropriate environment variables
for the compiler, so you do not need to run vcvars before translation.
@@ -117,6 +118,9 @@
-----------------------------------------------------------
Download the versions of all the external packages from
+https://bitbucket.org/pypy/pypy/downloads/local_5.8.zip
+(for post-5.7.1 builds) with sha256 checksum
+``fbe769bf3a4ab6f5a8b0a05b61930fc7f37da2a9a85a8f609cf5a9bad06e2554`` or
https://bitbucket.org/pypy/pypy/downloads/local_2.4.zip
(for 2.4 release and later) or
https://bitbucket.org/pypy/pypy/downloads/local.zip
@@ -124,9 +128,9 @@
Then expand it into the base directory (base_dir) and modify your environment
to reflect this::
- set PATH=<base_dir>\bin;<base_dir>\tcltk\bin;%PATH%
- set INCLUDE=<base_dir>\include;<base_dir>\tcltk\include;%INCLUDE%
- set LIB=<base_dir>\lib;<base_dir>\tcltk\lib;%LIB%
+ set PATH=<base_dir>\bin;%PATH%
+ set INCLUDE=<base_dir>\include;%INCLUDE%
+ set LIB=<base_dir>\lib;%LIB%
Now you should be good to go. If you choose this method, you do not need
to download/build anything else.
@@ -173,13 +177,14 @@
The zlib compression library
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-Download http://www.gzip.org/zlib/zlib-1.2.3.tar.gz and extract it in
-the base directory. Then compile as a static library::
+Download http://www.gzip.org/zlib/zlib-1.2.11.tar.gz and extract it in
+the base directory. Then compile::
- cd zlib-1.2.3
+ cd zlib-1.2.11
nmake -f win32\Makefile.msc
copy zlib.lib <somewhere in LIB>
copy zlib.h zconf.h <somewhere in INCLUDE>
+ copy zlib1.dll <in PATH> # (needed for tests via ll2ctypes)
The bz2 compression library
@@ -198,22 +203,23 @@
PyPy uses cffi to interact with sqlite3.dll. Only the dll is needed, the cffi
wrapper is compiled when the module is imported for the first time.
-The sqlite3.dll should be version 3.6.21 for CPython2.7 compatablility.
+The sqlite3.dll should be version 3.8.11 for CPython2.7 compatablility.
The expat XML parser
~~~~~~~~~~~~~~~~~~~~
Download the source code of expat on sourceforge:
-http://sourceforge.net/projects/expat/ and extract it in the base directory.
-Version 2.1.0 is known to pass tests. Then open the project file ``expat.dsw``
+https://github.com/libexpat/libexpat/releases and extract it in the base
directory.
+Version 2.1.1 is known to pass tests. Then open the project file ``expat.dsw``
with Visual Studio; follow the instruction for converting the project files,
switch to the "Release" configuration, use the ``expat_static`` project,
-reconfigure the runtime for Multi-threaded DLL (/MD) and build.
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit