Description: Updates from the upstream 2.6 maintainance branch
 Up to b95fc4861fd5.
Origin: upstream
Last-Update: 2015-06-08

--- a/pypy/doc/release-2.6.0.rst
+++ b/pypy/doc/release-2.6.0.rst
@@ -3,7 +3,7 @@
 ========================
 
 We're pleased to announce PyPy 2.6.0, only two months after PyPy 2.5.1.
-We are particulary happy to update `cffi`_ to version 1.0, which makes the
+We are particulary happy to update `cffi`_ to version 1.1, which makes the
 popular ctypes-alternative even easier to use, and to support the new vmprof_
 statistical profiler.
 
@@ -38,13 +38,13 @@
 .. _`on bitbucket`: https://www.bitbucket.org/pypy/numpy
 
 We would also like to encourage new people to join the project. PyPy has many
-layers and we need help with all of them: `PyPy`_ and `Rpython`_ documentation
+layers and we need help with all of them: `PyPy`_ and `RPython`_ documentation
 improvements, tweaking popular `modules`_ to run on pypy, or general `help`_ with making
-Rpython's JIT even better. Nine new people contributed since the last release,
+RPython's JIT even better. Nine new people contributed since the last release,
 you too could be one of them.
 
 .. _`PyPy`: http://doc.pypy.org 
-.. _`Rpython`: https://rpython.readthedocs.org
+.. _`RPython`: https://rpython.readthedocs.org
 .. _`modules`: http://doc.pypy.org/en/latest/project-ideas.html#make-more-python-modules-pypy-friendly
 .. _`help`: http://doc.pypy.org/en/latest/project-ideas.html
 
@@ -115,7 +115,7 @@
     over 7 times faster than cpython
 
 .. _`vmprof`: https://vmprof.readthedocs.org
-.. _resolved: https://doc.pypy.org/en/latest/whatsnew-2.6.0.html
+.. _resolved: http://doc.pypy.org/en/latest/whatsnew-2.6.0.html
 
 Please try it out and let us know what you think. We welcome
 success stories, `experiments`_,  or `benchmarks`_, we know you are using PyPy, please tell us about it!
--- a/pypy/doc/whatsnew-2.6.0.rst
+++ b/pypy/doc/whatsnew-2.6.0.rst
@@ -1,6 +1,6 @@
-=======================
-What's new in PyPy 2.5+
-=======================
+========================
+What's new in PyPy 2.6.0
+========================
 
 .. this is a revision shortly after release-2.5.1
 .. startrev: cb01edcb59414d9d93056e54ed060673d24e67c1
@@ -131,3 +131,11 @@
 
 branch fold-arith-ops
 remove multiple adds on add chains ("1 + 1 + 1 + ...")
+
+.. branch: fix-result-types
+
+branch fix-result-types:
+* Refactor dtype casting and promotion rules for consistency and compatibility
+with CNumPy.
+* Refactor ufunc creation.
+* Implement np.promote_types().
--- a/pypy/doc/whatsnew-head.rst
+++ b/pypy/doc/whatsnew-head.rst
@@ -3,12 +3,6 @@
 =======================
 
 .. this is a revision shortly after release-2.6.0
-.. startrev: 2ac87a870acf562301840cace411e34c1b96589c
+.. startrev: 91904d5c5188
 
-.. branch: fix-result-types
 
-branch fix-result-types:
-* Refactor dtype casting and promotion rules for consistency and compatibility
-with CNumPy.
-* Refactor ufunc creation.
-* Implement np.promote_types().
--- a/pypy/module/_cffi_backend/ctypeobj.py
+++ b/pypy/module/_cffi_backend/ctypeobj.py
@@ -1,3 +1,4 @@
+import sys
 from pypy.interpreter.baseobjspace import W_Root
 from pypy.interpreter.error import OperationError, oefmt
 from pypy.interpreter.gateway import interp2app
@@ -131,6 +132,8 @@
             # obscure hack when untranslated, maybe, approximate, don't use
             if isinstance(align, llmemory.FieldOffset):
                 align = rffi.sizeof(align.TYPE.y)
+                if (1 << (8*align-2)) > sys.maxint:
+                    align /= 2
         else:
             # a different hack when translated, to avoid seeing constants
             # of a symbolic integer type
--- a/pypy/module/_cffi_backend/test/test_recompiler.py
+++ b/pypy/module/_cffi_backend/test/test_recompiler.py
@@ -29,7 +29,7 @@
     rdir = udir.ensure('recompiler', dir=1)
     rdir.join('Python.h').write(
         '#define PYPY_VERSION XX\n'
-        '#define PyMODINIT_FUNC /*exported*/\n'
+        '#define PyMODINIT_FUNC /*exported*/ void\n'
         )
     path = module_name.replace('.', os.sep)
     if '.' in module_name:
@@ -953,3 +953,16 @@
         ffi.typeof('function_t*')
         lib.function(ffi.NULL)
         # assert did not crash
+
+    def test_alignment_of_longlong(self):
+        import _cffi_backend
+        BULongLong = _cffi_backend.new_primitive_type('unsigned long long')
+        x1 = _cffi_backend.alignof(BULongLong)
+        assert x1 in [4, 8]
+        #
+        ffi, lib = self.prepare(
+            "struct foo_s { unsigned long long x; };",
+            'test_alignment_of_longlong',
+            "struct foo_s { unsigned long long x; };")
+        assert ffi.alignof('unsigned long long') == x1
+        assert ffi.alignof('struct foo_s') == x1
--- a/pypy/module/test_lib_pypy/test_curses.py
+++ b/pypy/module/test_lib_pypy/test_curses.py
@@ -6,11 +6,12 @@
 
 # Check that lib_pypy.cffi finds the correct version of _cffi_backend.
 # Otherwise, the test is skipped.  It should never be skipped when run
-# with "pypy py.test -A".
+# with "pypy py.test -A" and _curses_build.py has been run with pypy.
 try:
-    from lib_pypy import cffi; cffi.FFI()
-except (ImportError, AssertionError), e:
-    pytest.skip("no cffi module or wrong version (%s)" % (e,))
+    from lib_pypy import _curses_cffi
+except ImportError:
+    # On CPython, "pip install cffi".  On old PyPy's, no chance
+    pytest.skip("install cffi and run lib_pypy/_curses_build.py manually first")
 
 from lib_pypy import _curses
 
--- a/pypy/module/test_lib_pypy/test_sqlite3.py
+++ b/pypy/module/test_lib_pypy/test_sqlite3.py
@@ -313,10 +313,11 @@
             pytest.skip("_sqlite3 requires Python 2.7")
 
         try:
-            import _cffi_backend
+            from lib_pypy import _sqlite3_cffi
         except ImportError:
             # On CPython, "pip install cffi".  On old PyPy's, no chance
-            pytest.skip("_sqlite3 requires _cffi_backend to be installed")
+            pytest.skip("install cffi and run lib_pypy/_sqlite3_build.py "
+                        "manually first")
 
         global _sqlite3
         from lib_pypy import _sqlite3
