[pypy-commit] pypy reverse-debugger: update to release 5.4.0
arigo
pypy.commits at gmail.com
Wed Aug 31 08:13:08 EDT 2016
Author: Armin Rigo <arigo at tunes.org>
Branch: reverse-debugger
Changeset: r86776:652ce0f5b981
Date: 2016-08-31 14:12 +0200
http://bitbucket.org/pypy/pypy/changeset/652ce0f5b981/
Log: update to release 5.4.0
diff --git a/lib_pypy/gdbm.py b/lib_pypy/gdbm.py
--- a/lib_pypy/gdbm.py
+++ b/lib_pypy/gdbm.py
@@ -137,6 +137,8 @@
lib.gdbm_sync(self.__ll_dbm)
def open(filename, flags='r', mode=0666):
+ if isinstance(filename, unicode):
+ filename = filename.encode()
if flags[0] == 'r':
iflags = lib.GDBM_READER
elif flags[0] == 'w':
diff --git a/pypy/doc/conf.py b/pypy/doc/conf.py
--- a/pypy/doc/conf.py
+++ b/pypy/doc/conf.py
@@ -58,16 +58,16 @@
# General information about the project.
project = u'PyPy'
-copyright = u'2015, The PyPy Project'
+copyright = u'2016, The PyPy Project'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '4.0'
+version = '5.4'
# The full version, including alpha/beta/rc tags.
-release = '4.0.0'
+release = '5.4.0'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
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.4.0.rst
whatsnew-pypy2-5.3.1.rst
whatsnew-pypy2-5.3.0.rst
whatsnew-5.1.0.rst
diff --git a/pypy/doc/project-ideas.rst b/pypy/doc/project-ideas.rst
--- a/pypy/doc/project-ideas.rst
+++ b/pypy/doc/project-ideas.rst
@@ -57,7 +57,7 @@
--------------
Our cpyext C-API compatiblity layer can now run upstream NumPy unmodified.
-Release PyPy2.7-v5.3 still fails about 200 of the ~6000 test in the NumPy
+Release PyPy2.7-v5.4 still fails about 60 of the ~6000 test in the NumPy
test suite. We could use help analyzing the failures and fixing them either
as patches to upstream NumPy, or as fixes to PyPy.
diff --git a/pypy/doc/release-pypy2.7-v5.4.0.rst b/pypy/doc/release-pypy2.7-v5.4.0.rst
--- a/pypy/doc/release-pypy2.7-v5.4.0.rst
+++ b/pypy/doc/release-pypy2.7-v5.4.0.rst
@@ -5,8 +5,14 @@
We have released PyPy2.7 v5.4, a little under two months after PyPy2.7 v5.3.
This new PyPy2.7 release includes further improvements to our C-API compatability layer (cpyext), enabling us to pass over 99% of the upstream
numpy `test suite`_. We updated built-in cffi_ support to version 1.8,
-and fixed many issues and bugs raised by the growing community of PyPy
-users.
+which now supports the "limited API" mode for c-extensions on
+CPython >=3.2.
+
+We improved tooling for the PyPy JIT_, and expanded VMProf
+support to OpenBSD and Dragon Fly BSD
+
+As always, this release fixed many issues and bugs raised by the
+growing community of PyPy users.
XXXXX MORE ???
@@ -25,6 +31,7 @@
.. _`test suite`: https://bitbucket.org/pypy/pypy/wiki/Adventures%20in%20cpyext%20compatibility
.. _cffi: https://cffi.readthedocs.org
+.. _JIT: https://morepypy.blogspot.com.au/2016/08/pypy-tooling-upgrade-jitviewer-and.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
@@ -74,13 +81,47 @@
`issubclass()` as well as `type.__instancecheck__()` and
`type.__subclasscheck__()`
+ * Expose the name of CDLL objects
+
+ * Rewrite the win32 dependencies of `subprocess` to use cffi
+ instead of ctypes
+
+ * Improve the `JIT logging`_ facitilities
+
+ * (RPython) make int * string work
+
+ * Allocate all RPython strings with one extra byte, normally
+ unused. This now allows `ffi.from_buffer(string)` in CFFI with
+ no copy
+
+ * Adds a new commandline option `-X track-resources` that will
+ produce a `ResourceWarning` when the GC closes a file or socket.
+ The traceback for the place where the file or socket was allocated
+ is given as well, which aids finding places where `close()` is
+ missing
+
+ * Add missing `PyObject_Realloc`, `PySequence_GetSlice`
+
+ * `type.__dict__` now returns a `dict_proxy` object, like on CPython.
+ Previously it returned what looked like a regular dict object (but
+ it was already read-only)
+
+ * (RPython) add `rposix.{get,set}_inheritable()`, needed by Python 3.5
+
+ * (RPython) add `rposix_scandir` portably, needed for Python 3.5
+
+ * Support for memoryview attributes (format, itemsize, ...) which also
+ adds support for `PyMemoryView_FromObject`
+
* Bug Fixes
* Reject `mkdir()` in read-only sandbox filesystems
* Add include guards to pymem.h to enable c++ compilation
- * Fix OpenBSD build breakage and support OpenBSD in VMProf.
+ * Fix build breakage on OpenBSD and FreeBSD
+
+ * Support OpenBSD, Dragon Fly BSD in VMProf
* Fix for `bytearray('').replace('a', 'ab')` for empty strings
@@ -104,10 +145,30 @@
`MADV_DONTNEED` on freed arenas to release memory back to the
OS for resource monitoring
+ * Fix overflow detection in conversion of float to 64-bit integer
+ in timeout argument to various thread/threading primitives
+
+ * Fix win32 outputting `\r\r\n` in some cases
+
+ * Make `hash(-1)` return -2, as CPython does, and fix all the
+ ancilary places this matters
+
* Issues reported with our previous release were resolved_ after
reports from users on our issue tracker at
https://bitbucket.org/pypy/pypy/issues or on IRC at #pypy
+ * Fix `PyNumber_Check()` to behave more like CPython
+
+ * (VMProf) Try hard to not miss any Python-level frame in the
+ captured stacks, even if there is metainterp or blackhole interp
+ involved. Also fix the stacklet (greenlet) support
+
+ * Fix a critical JIT bug where `raw_malloc` -equivalent functions
+ lost the additional flags
+
+ * Fix the mapdict cache for subclasses of builtin types that
+ provide a dict
+
* Performance improvements:
* Add a before_call()-like equivalent before a few operations like
@@ -135,7 +196,23 @@
RPython functions, eventually exhausting the stack, while at
app-level the traceback is very short
-.. _resolved: http://doc.pypy.org/en/latest/whatsnew-5.3.0.html
+ * Check for NULL returns from calls to the raw-malloc and raise,
+ rather than a guard
+
+ * Improve `socket.recvfrom()` so that it copies less if possible
+
+ * When generating C code, inline `goto` to blocks with only one
+ predecessor, generating less lines of code
+
+ * When running the final backend-optimization phase before emitting
+ C code, constant-fold calls to we_are_jitted to return False. This
+ makes the generated C code a few percent smaller
+
+ * Refactor the `uid_t/gid_t` handling in `rlib.rposix` and in
+ `interp_posix.py`, based on the clean-up of CPython 2.7.x
+
+.. _`JIT logging`: https://morepypy.blogspot.com/2016/08/pypy-tooling-upgrade-jitviewer-and.html
+.. _resolved: http://doc.pypy.org/en/latest/whatsnew-5.4.0.html
Please update, and continue to help us make PyPy better.
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,161 +1,8 @@
==========================
-What's new in PyPy2.7 5.3+
+What's new in PyPy2.7 5.4+
==========================
-.. this is a revision shortly after release-pypy2.7-v5.3
-.. startrev: 873218a739f1
+.. this is a revision shortly after release-pypy2.7-v5.4
+.. startrev: 522736f816dc
-.. 418b05f95db5
-Improve CPython compatibility for ``is``. Now code like ``if x is ():``
-works the same way as it does on CPython. See http://pypy.readthedocs.io/en/latest/cpython_differences.html#object-identity-of-primitive-values-is-and-id .
-.. pull request #455
-Add sys.{get,set}dlopenflags, for cpyext extensions.
-
-.. branch: fix-gen-dfa
-
-Resolves an issue with the generator script to build the dfa for Python syntax.
-
-.. branch: z196-support
-
-Fixes a critical issue in the register allocator and extends support on s390x.
-PyPy runs and translates on the s390x revisions z10 (released February 2008, experimental)
-and z196 (released August 2010) in addition to zEC12 and z13.
-To target e.g. z196 on a zEC12 machine supply CFLAGS="-march=z196" to your shell environment.
-
-.. branch: s390x-5.3-catchup
-
-Implement the backend related changes for s390x.
-
-.. branch: incminimark-ll_assert
-.. branch: vmprof-openbsd
-
-.. branch: testing-cleanup
-
-Simplify handling of interp-level tests and make it more forward-
-compatible.
-
-.. branch: pyfile-tell
-Sync w_file with the c-level FILE* before returning FILE* in PyFile_AsFile
-
-.. branch: rw-PyString_AS_STRING
-Allow rw access to the char* returned from PyString_AS_STRING, also refactor
-PyStringObject to look like cpython's and allow subclassing PyString_Type and
-PyUnicode_Type
-
-.. branch: save_socket_errno
-
-Bug fix: if ``socket.socket()`` failed, the ``socket.error`` did not show
-the errno of the failing system call, but instead some random previous
-errno.
-
-.. branch: PyTuple_Type-subclass
-
-Refactor PyTupleObject to look like cpython's and allow subclassing
-PyTuple_Type
-
-.. branch: call-via-pyobj
-
-Use offsets from PyTypeObject to find actual c function to call rather than
-fixed functions, allows function override after PyType_Ready is called
-
-.. branch: issue2335
-
-Avoid exhausting the stack in the JIT due to successive guard
-failures in the same Python function ending up as successive levels of
-RPython functions, while at app-level the traceback is very short
-
-.. branch: use-madv-free
-
-Try harder to memory to the OS. See e.g. issue #2336. Note that it does
-not show up as a reduction of the VIRT column in ``top``, and the RES
-column might also not show the reduction, particularly on Linux >= 4.5 or
-on OS/X: it uses MADV_FREE, which only marks the pages as returnable to
-the OS if the memory is low.
-
-.. branch: cpyext-slotdefs2
-
-Fill in more slots when creating a PyTypeObject from a W_TypeObject
-More slots are still TBD, like tp_print and richcmp
-
-.. branch: json-surrogates
-
-Align json module decode with the cpython's impl, fixes issue 2345
-
-.. branch: issue2343
-
-Copy CPython's logic more closely for handling of ``__instancecheck__()``
-and ``__subclasscheck__()``. Fixes issue 2343.
-
-.. branch: msvcrt-cffi
-
-Rewrite the Win32 dependencies of 'subprocess' to use cffi instead
-of ctypes. This avoids importing ctypes in many small programs and
-scripts, which in turn avoids enabling threads (because ctypes
-creates callbacks at import time, and callbacks need threads).
-
-.. branch: new-jit-log
-
-The new logging facility that integrates with and adds features to vmprof.com.
-
-.. branch: jitlog-32bit
-
-Resolve issues to use the new logging facility on a 32bit system
-
-.. branch: ep2016sprint
-
-Trying harder to make hash(-1) return -2, like it does on CPython
-
-.. branch: jitlog-exact-source-lines
-
-Log exact line positions in debug merge points.
-
-.. branch: null_byte_after_str
-
-Allocate all RPython strings with one extra byte, normally unused.
-It is used to hold a final zero in case we need some ``char *``
-representation of the string, together with checks like ``not
-can_move()`` or object pinning. Main new thing that this allows:
-``ffi.from_buffer(string)`` in CFFI. Additionally, and most
-importantly, CFFI calls that take directly a string as argument don't
-copy the string any more---this is like CFFI on CPython.
-
-.. branch: resource_warning
-
-Add a new command line option -X track-resources which will produce
-ResourceWarnings when the GC closes unclosed files and sockets.
-
-.. branch: cpyext-realloc
-
-Implement PyObject_Realloc
-
-.. branch: inline-blocks
-
-Improve a little bit the readability of the generated C code
-
-.. branch: improve-vmprof-testing
-
-Improved vmprof support: now tries hard to not miss any Python-level
-frame in the captured stacks, even if there is the metainterp or
-blackhole interp involved. Also fix the stacklet (greenlet) support.
-
-.. branch: py2-mappingproxy
-
-``type.__dict__`` now returns a ``dict_proxy`` object, like on CPython.
-Previously it returned what looked like a regular dict object (but it
-was already read-only).
-
-
-.. branch: const-fold-we-are-jitted
-
-Reduce the size of the generated C code by constant-folding ``we_are_jitted``
-in non-jitcode.
-
-.. branch: memoryview-attributes
-
-Support for memoryview attributes (format, itemsize, ...).
-Extends the cpyext emulation layer.
-
-.. branch: redirect-assembler-jitlog
-
-Log more information to properly rebuild the redirected traces in jitviewer.
diff --git a/pypy/doc/whatsnew-head.rst b/pypy/doc/whatsnew-pypy2-5.4.0.rst
copy from pypy/doc/whatsnew-head.rst
copy to pypy/doc/whatsnew-pypy2-5.4.0.rst
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-pypy2-5.4.0.rst
@@ -1,6 +1,6 @@
-==========================
-What's new in PyPy2.7 5.3+
-==========================
+=========================
+What's new in PyPy2.7 5.4
+=========================
.. this is a revision shortly after release-pypy2.7-v5.3
.. startrev: 873218a739f1
@@ -159,3 +159,7 @@
.. branch: redirect-assembler-jitlog
Log more information to properly rebuild the redirected traces in jitviewer.
+
+.. branch: cpyext-subclass
+
+Copy Py_TPFLAGS_CHECKTYPES, Py_TPFLAGS_HAVE_INPLACEOPS when inheriting
diff --git a/pypy/interpreter/test/test_pyframe.py b/pypy/interpreter/test/test_pyframe.py
--- a/pypy/interpreter/test/test_pyframe.py
+++ b/pypy/interpreter/test/test_pyframe.py
@@ -48,10 +48,10 @@
return f.f_code
assert g() is g.func_code
- def test_f_trace_del(self):
+ def test_f_trace_del(self):
import sys
- f = sys._getframe()
- del f.f_trace
+ f = sys._getframe()
+ del f.f_trace
assert f.f_trace is None
def test_f_lineno(self):
@@ -116,7 +116,7 @@
def f():
assert sys._getframe().f_code.co_name == g()
def g():
- return sys._getframe().f_back.f_code.co_name
+ return sys._getframe().f_back.f_code.co_name
f()
def test_f_back_virtualref(self):
@@ -233,7 +233,7 @@
def test_trace_exc(self):
import sys
l = []
- def ltrace(a,b,c):
+ def ltrace(a,b,c):
if b == 'exception':
l.append(c)
return ltrace
@@ -298,7 +298,7 @@
def test_trace_return_exc(self):
import sys
l = []
- def trace(a,b,c):
+ def trace(a,b,c):
if b in ('exception', 'return'):
l.append((b, c))
return trace
@@ -444,7 +444,7 @@
def test_dont_trace_on_reraise(self):
import sys
l = []
- def ltrace(a,b,c):
+ def ltrace(a,b,c):
if b == 'exception':
l.append(c)
return ltrace
@@ -466,7 +466,7 @@
def test_dont_trace_on_raise_with_tb(self):
import sys
l = []
- def ltrace(a,b,c):
+ def ltrace(a,b,c):
if b == 'exception':
l.append(c)
return ltrace
diff --git a/pypy/interpreter/test/test_zzpickle_and_slow.py b/pypy/interpreter/test/test_zzpickle_and_slow.py
--- a/pypy/interpreter/test/test_zzpickle_and_slow.py
+++ b/pypy/interpreter/test/test_zzpickle_and_slow.py
@@ -3,7 +3,7 @@
from pypy.interpreter import gateway
from rpython.rlib.jit import non_virtual_ref, vref_None
-class AppTestSlow:
+class AppTestSlow:
spaceconfig = dict(usemodules=['itertools'])
def setup_class(cls):
@@ -64,7 +64,7 @@
space.setitem(space.builtin.w_dict,
space.wrap('read_exc_type'),
space.wrap(read_exc_type_gw))
-
+
def _detach_helpers(space):
space.delitem(space.builtin.w_dict,
space.wrap('hide_top_frame'))
@@ -92,7 +92,7 @@
pckl = pickle.dumps(code)
result = pickle.loads(pckl)
assert code == result
-
+
def test_pickle_global_func(self):
import new
mod = new.module('mod')
@@ -109,7 +109,7 @@
assert func is result
finally:
del sys.modules['mod']
-
+
def test_pickle_not_imported_module(self):
import new
mod = new.module('mod')
@@ -119,13 +119,13 @@
result = pickle.loads(pckl)
assert mod.__name__ == result.__name__
assert mod.__dict__ == result.__dict__
-
+
def test_pickle_builtin_func(self):
import pickle
pckl = pickle.dumps(map)
result = pickle.loads(pckl)
assert map is result
-
+
def test_pickle_non_top_reachable_func(self):
def func():
return 42
@@ -142,7 +142,7 @@
assert func.func_dict == result.func_dict
assert func.func_doc == result.func_doc
assert func.func_globals == result.func_globals
-
+
def test_pickle_cell(self):
def g():
x = [42]
@@ -171,7 +171,7 @@
f1 = f()
saved = hide_top_frame(f1)
pckl = pickle.dumps(f1)
- restore_top_frame(f1, saved)
+ restore_top_frame(f1, saved)
f2 = pickle.loads(pckl)
assert type(f1) is type(f2)
@@ -223,7 +223,7 @@
f1 = f()
saved = hide_top_frame(f1)
pckl = pickle.dumps(f1)
- restore_top_frame(f1, saved)
+ restore_top_frame(f1, saved)
f2 = pickle.loads(pckl)
def test_frame_setstate_crash(self):
@@ -257,21 +257,21 @@
pckl = pickle.dumps(mod)
result = pickle.loads(pckl)
assert mod is result
-
+
def test_pickle_moduledict(self):
import pickle
moddict = pickle.__dict__
pckl = pickle.dumps(moddict)
result = pickle.loads(pckl)
assert moddict is result
-
+
def test_pickle_bltins_module(self):
import pickle
mod = __builtins__
pckl = pickle.dumps(mod)
result = pickle.loads(pckl)
assert mod is result
-
+
def test_pickle_buffer(self):
skip("Can't pickle buffer objects on top of CPython either. "
"Do we really need it?")
@@ -280,14 +280,14 @@
pckl = pickle.dumps(a)
result = pickle.loads(pckl)
assert a == result
-
+
def test_pickle_complex(self):
import pickle
a = complex(1.23,4.567)
pckl = pickle.dumps(a)
result = pickle.loads(pckl)
assert a == result
-
+
def test_pickle_method(self):
class myclass(object):
def f(self):
@@ -308,7 +308,7 @@
assert method() == result()
finally:
del sys.modules['mod']
-
+
def test_pickle_staticmethod(self):
class myclass(object):
def f():
@@ -319,7 +319,7 @@
pckl = pickle.dumps(method)
result = pickle.loads(pckl)
assert method() == result()
-
+
def test_pickle_classmethod(self):
class myclass(object):
def f(cls):
@@ -337,7 +337,7 @@
assert method() == result()
finally:
del sys.modules['mod']
-
+
def test_pickle_sequenceiter(self):
'''
In PyPy there is no distinction here between listiterator and
diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -120,7 +120,7 @@
constant_names = """
Py_TPFLAGS_READY Py_TPFLAGS_READYING Py_TPFLAGS_HAVE_GETCHARBUFFER
METH_COEXIST METH_STATIC METH_CLASS Py_TPFLAGS_BASETYPE
-METH_NOARGS METH_VARARGS METH_KEYWORDS METH_O
+METH_NOARGS METH_VARARGS METH_KEYWORDS METH_O Py_TPFLAGS_HAVE_INPLACEOPS
Py_TPFLAGS_HEAPTYPE Py_TPFLAGS_HAVE_CLASS Py_TPFLAGS_HAVE_NEWBUFFER
Py_LT Py_LE Py_EQ Py_NE Py_GT Py_GE Py_TPFLAGS_CHECKTYPES
""".split()
diff --git a/pypy/module/cpyext/include/patchlevel.h b/pypy/module/cpyext/include/patchlevel.h
--- a/pypy/module/cpyext/include/patchlevel.h
+++ b/pypy/module/cpyext/include/patchlevel.h
@@ -29,8 +29,8 @@
#define PY_VERSION "2.7.10"
/* PyPy version as a string */
-#define PYPY_VERSION "5.3.2-alpha0"
-#define PYPY_VERSION_NUM 0x05030200
+#define PYPY_VERSION "5.4.0"
+#define PYPY_VERSION_NUM 0x05040000
/* Defined to mean a PyPy where cpyext holds more regular references
to PyObjects, e.g. staying alive as long as the internal PyPy object
diff --git a/pypy/module/cpyext/test/buffer_test.c b/pypy/module/cpyext/test/buffer_test.c
--- a/pypy/module/cpyext/test/buffer_test.c
+++ b/pypy/module/cpyext/test/buffer_test.c
@@ -1,3 +1,6 @@
+#ifdef _MSC_VER
+#define _CRT_SECURE_NO_WARNINGS 1
+#endif
#include <Python.h>
#include <stdlib.h>
#include <stdio.h>
@@ -10,7 +13,7 @@
/* Structure defines a 1-dimensional strided array */
typedef struct{
int* arr;
- long length;
+ Py_ssize_t length;
} MyArray;
/* initialize the array with integers 0...length */
@@ -61,13 +64,13 @@
static int
PyMyArray_init(PyMyArray *self, PyObject *args, PyObject *kwds)
{
+ int length = 0;
+ static char *kwlist[] = {"length", NULL};
// init may have already been called
if (self->arr.arr != NULL) {
deallocate_MyArray(&self->arr);
}
- int length = 0;
- static char *kwlist[] = {"length", NULL};
if (! PyArg_ParseTupleAndKeywords(args, kwds, "|i", kwlist, &length))
return -1;
@@ -103,16 +106,19 @@
static int
PyMyArray_getbuffer(PyObject *obj, Py_buffer *view, int flags)
{
+ PyMyArray* self = (PyMyArray*)obj;
+ fprintf(stdout, "in PyMyArray_getbuffer\n");
if (view == NULL) {
+ fprintf(stdout, "view is NULL\n");
PyErr_SetString(PyExc_ValueError, "NULL view in getbuffer");
return -1;
}
if (flags == 0) {
+ fprintf(stdout, "flags is 0\n");
PyErr_SetString(PyExc_ValueError, "flags == 0 in getbuffer");
return -1;
}
- PyMyArray* self = (PyMyArray*)obj;
view->obj = (PyObject*)self;
view->buf = (void*)self->arr.arr;
view->len = self->arr.length * sizeof(int);
@@ -218,7 +224,6 @@
#ifdef __GNUC__
extern __attribute__((visibility("default")))
#else
-extern __declspec(dllexport)
#endif
PyMODINIT_FUNC
diff --git a/pypy/module/cpyext/test/test_arraymodule.py b/pypy/module/cpyext/test/test_arraymodule.py
--- a/pypy/module/cpyext/test/test_arraymodule.py
+++ b/pypy/module/cpyext/test/test_arraymodule.py
@@ -87,4 +87,13 @@
module.switch_multiply()
res = [1, 2, 3] * arr
assert res == [2, 4, 6]
+
+ def test_subclass(self):
+ module = self.import_module(name='array')
+ class Sub(module.array):
+ pass
+
+ arr = Sub('i', [2])
+ res = [1, 2, 3] * arr
+ assert res == [1, 2, 3, 1, 2, 3]
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -18,7 +18,8 @@
Py_TPFLAGS_HEAPTYPE, METH_VARARGS, METH_KEYWORDS, CANNOT_FAIL,
Py_TPFLAGS_HAVE_GETCHARBUFFER, build_type_checkers, StaticObjectBuilder,
PyObjectFields, Py_TPFLAGS_BASETYPE, PyTypeObject, PyTypeObjectPtr,
- Py_TPFLAGS_HAVE_NEWBUFFER)
+ Py_TPFLAGS_HAVE_NEWBUFFER, Py_TPFLAGS_CHECKTYPES,
+ Py_TPFLAGS_HAVE_INPLACEOPS)
from pypy.module.cpyext.methodobject import (W_PyCClassMethodObject,
W_PyCWrapperObject, PyCFunction_NewEx, PyCFunction_typedef, PyMethodDef,
W_PyCMethodObject, W_PyCFunctionObject)
@@ -386,6 +387,8 @@
pto.c_tp_basicsize = base_pto.c_tp_basicsize
if pto.c_tp_itemsize < base_pto.c_tp_itemsize:
pto.c_tp_itemsize = base_pto.c_tp_itemsize
+ pto.c_tp_flags |= base_pto.c_tp_flags & Py_TPFLAGS_CHECKTYPES
+ pto.c_tp_flags |= base_pto.c_tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS
flags = rffi.cast(lltype.Signed, pto.c_tp_flags)
base_object_pyo = make_ref(space, space.w_object)
base_object_pto = rffi.cast(PyTypeObjectPtr, base_object_pyo)
@@ -814,8 +817,13 @@
# inheriting tp_as_* slots
base = py_type.c_tp_base
if base:
- if not py_type.c_tp_as_number: py_type.c_tp_as_number = base.c_tp_as_number
- if not py_type.c_tp_as_sequence: py_type.c_tp_as_sequence = base.c_tp_as_sequence
+ if not py_type.c_tp_as_number:
+ py_type.c_tp_as_number = base.c_tp_as_number
+ py_type.c_tp_flags |= base.c_tp_flags & Py_TPFLAGS_CHECKTYPES
+ py_type.c_tp_flags |= base.c_tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS
+ if not py_type.c_tp_as_sequence:
+ py_type.c_tp_as_sequence = base.c_tp_as_sequence
+ py_type.c_tp_flags |= base.c_tp_flags & Py_TPFLAGS_HAVE_INPLACEOPS
if not py_type.c_tp_as_mapping: py_type.c_tp_as_mapping = base.c_tp_as_mapping
if not py_type.c_tp_as_buffer: py_type.c_tp_as_buffer = base.c_tp_as_buffer
diff --git a/pypy/module/imp/test/test_import.py b/pypy/module/imp/test/test_import.py
--- a/pypy/module/imp/test/test_import.py
+++ b/pypy/module/imp/test/test_import.py
@@ -143,7 +143,7 @@
def _setup(space):
dn = setup_directory_structure(space)
return space.appexec([space.wrap(dn)], """
- (dn):
+ (dn):
import sys
path = list(sys.path)
sys.path.insert(0, dn)
@@ -1017,7 +1017,7 @@
cpathname = udir.join('test.pyc')
assert not cpathname.check()
-
+
def test_load_source_module_importerror(self):
# the .pyc file is created before executing the module
space = self.space
@@ -1126,11 +1126,11 @@
stream.close()
-def test_PYTHONPATH_takes_precedence(space):
+def test_PYTHONPATH_takes_precedence(space):
if sys.platform == "win32":
py.test.skip("unresolved issues with win32 shell quoting rules")
- from pypy.interpreter.test.test_zpy import pypypath
- extrapath = udir.ensure("pythonpath", dir=1)
+ from pypy.interpreter.test.test_zpy import pypypath
+ extrapath = udir.ensure("pythonpath", dir=1)
extrapath.join("sched.py").write("print 42\n")
old = os.environ.get('PYTHONPATH', None)
oldlang = os.environ.pop('LANG', None)
diff --git a/pypy/module/micronumpy/test/test_complex.py b/pypy/module/micronumpy/test/test_complex.py
--- a/pypy/module/micronumpy/test/test_complex.py
+++ b/pypy/module/micronumpy/test/test_complex.py
@@ -495,8 +495,8 @@
c = array([1.e+110, 1.e-110], dtype=complex128)
d = floor_divide(c**2, c)
assert (d == [1.e+110, 0]).all()
-
-
+
+
def test_basic(self):
import sys
diff --git a/pypy/module/micronumpy/test/test_dtypes.py b/pypy/module/micronumpy/test/test_dtypes.py
--- a/pypy/module/micronumpy/test/test_dtypes.py
+++ b/pypy/module/micronumpy/test/test_dtypes.py
@@ -372,8 +372,8 @@
a = np.array(data, dtype=b)
x = pickle.loads(pickle.dumps(a))
assert (x == a).all()
- assert x.dtype == a.dtype
-
+ assert x.dtype == a.dtype
+
def test_index(self):
import numpy as np
for dtype in [np.int8, np.int16, np.int32, np.int64]:
@@ -1459,7 +1459,7 @@
"'offsets':[0,76800], "
"'itemsize':80000, "
"'aligned':True}")
-
+
assert dt == np.dtype(eval(str(dt)))
dt = np.dtype({'names': ['r', 'g', 'b'], 'formats': ['u1', 'u1', 'u1'],
diff --git a/pypy/module/micronumpy/test/test_ndarray.py b/pypy/module/micronumpy/test/test_ndarray.py
--- a/pypy/module/micronumpy/test/test_ndarray.py
+++ b/pypy/module/micronumpy/test/test_ndarray.py
@@ -1878,7 +1878,7 @@
assert map(isnan, e) == [False, False, False, True, False]
assert map(isinf, e) == [False, False, True, False, False]
assert e.argmax() == 3
- # numpy preserves value for uint16 -> cast_as_float16 ->
+ # numpy preserves value for uint16 -> cast_as_float16 ->
# convert_to_float64 -> convert_to_float16 -> uint16
# even for float16 various float16 nans
all_f16 = arange(0xfe00, 0xffff, dtype='uint16')
@@ -2608,7 +2608,7 @@
a = np.arange(6).reshape(2,3)
i = np.dtype('int32').type(0)
assert (a[0] == a[i]).all()
-
+
def test_ellipsis_indexing(self):
import numpy as np
diff --git a/pypy/module/micronumpy/test/test_object_arrays.py b/pypy/module/micronumpy/test/test_object_arrays.py
--- a/pypy/module/micronumpy/test/test_object_arrays.py
+++ b/pypy/module/micronumpy/test/test_object_arrays.py
@@ -200,7 +200,7 @@
from numpy import arange, dtype
from cPickle import loads, dumps
import sys
-
+
a = arange(15).astype(object)
if '__pypy__' in sys.builtin_module_names:
raises(NotImplementedError, dumps, a)
@@ -211,4 +211,4 @@
a = arange(15).astype(object).reshape((3, 5))
b = loads(dumps(a))
assert (a == b).all()
-
+
diff --git a/pypy/module/sys/version.py b/pypy/module/sys/version.py
--- a/pypy/module/sys/version.py
+++ b/pypy/module/sys/version.py
@@ -10,7 +10,7 @@
#XXX # sync CPYTHON_VERSION with patchlevel.h, package.py
CPYTHON_API_VERSION = 1013 #XXX # sync with include/modsupport.h
-PYPY_VERSION = (5, 3, 2, "alpha", 0) #XXX # sync patchlevel.h
+PYPY_VERSION = (5, 4, 0, "final", 0) #XXX # sync patchlevel.h
import pypy
diff --git a/pypy/module/test_lib_pypy/test_gdbm_extra.py b/pypy/module/test_lib_pypy/test_gdbm_extra.py
--- a/pypy/module/test_lib_pypy/test_gdbm_extra.py
+++ b/pypy/module/test_lib_pypy/test_gdbm_extra.py
@@ -15,3 +15,7 @@
assert len(g) == 2
del g['abc']
assert len(g) == 1
+
+def test_unicode():
+ path = unicode(udir.join('test_gdm_unicode'))
+ g = gdbm.open(path, 'c') # does not crash
diff --git a/pypy/objspace/std/test/test_random_attr.py b/pypy/objspace/std/test/test_random_attr.py
--- a/pypy/objspace/std/test/test_random_attr.py
+++ b/pypy/objspace/std/test/test_random_attr.py
@@ -1,7 +1,10 @@
import pytest
import sys
-from hypothesis import given, strategies, settings
from pypy.tool.pytest.objspace import gettestobjspace
+try:
+ from hypothesis import given, strategies, settings
+except ImportError:
+ pytest.skip("requires hypothesis")
base_initargs = strategies.sampled_from([
("object", (), False),
diff --git a/pypy/objspace/test/test_binop_overriding.py b/pypy/objspace/test/test_binop_overriding.py
--- a/pypy/objspace/test/test_binop_overriding.py
+++ b/pypy/objspace/test/test_binop_overriding.py
@@ -73,7 +73,7 @@
if C is not object:
setattr(C, name, f)
override_in_hier(n-1)
- if C is not object:
+ if C is not object:
delattr(C, name)
override_in_hier()
@@ -105,7 +105,7 @@
if not self.appdirect:
skip("slow test, should be run as appdirect test")
Base, do_test = self.helpers
-
+
class X(Base):
pass
class Y(X):
@@ -116,7 +116,7 @@
assert not fail
def test_binop_combinations_sub(self):
- Base, do_test = self.helpers
+ Base, do_test = self.helpers
class X(Base):
pass
class Y(X):
@@ -124,13 +124,13 @@
fail = do_test(X, Y, 'sub', lambda x,y: x-y)
#print len(fail)
- assert not fail
+ assert not fail
def test_binop_combinations_pow(self):
if not self.appdirect:
skip("slow test, should be run as appdirect test")
Base, do_test = self.helpers
-
+
class X(Base):
pass
class Y(X):
@@ -138,13 +138,13 @@
fail = do_test(X, Y, 'pow', lambda x,y: x**y)
#print len(fail)
- assert not fail
+ assert not fail
def test_binop_combinations_more_exhaustive(self):
if not self.appdirect:
skip("very slow test, should be run as appdirect test")
Base, do_test = self.helpers
-
+
class X(Base):
pass
diff --git a/pypy/tool/release/repackage.sh b/pypy/tool/release/repackage.sh
--- a/pypy/tool/release/repackage.sh
+++ b/pypy/tool/release/repackage.sh
@@ -1,7 +1,7 @@
# Edit these appropriately before running this script
maj=5
-min=3
-rev=1
+min=4
+rev=0
branchname=release-$maj.x # ==OR== release-$maj.$min.x
tagname=release-pypy2.7-v$maj.$min.$rev # ==OR== release-$maj.$min
diff --git a/rpython/rlib/rjitlog/test/test_jitlog.py b/rpython/rlib/rjitlog/test/test_jitlog.py
--- a/rpython/rlib/rjitlog/test/test_jitlog.py
+++ b/rpython/rlib/rjitlog/test/test_jitlog.py
@@ -11,7 +11,7 @@
class FakeCallAssemblerLoopToken(AbstractDescr):
def __init__(self, target):
- self._ll_function_addr = target
+ self._ll_function_addr = target
def repr_of_descr(self):
return 'looptoken'
More information about the pypy-commit
mailing list