[pypy-commit] pypy release-pypy3.6-v7.x: merge py3.6 into release

mattip pypy.commits at gmail.com
Mon Dec 23 05:48:08 EST 2019


Author: Matti Picus <matti.picus at gmail.com>
Branch: release-pypy3.6-v7.x
Changeset: r98356:1608da62bfc7
Date: 2019-12-23 12:46 +0200
http://bitbucket.org/pypy/pypy/changeset/1608da62bfc7/

Log:	merge py3.6 into release

diff --git a/.hgtags b/.hgtags
--- a/.hgtags
+++ b/.hgtags
@@ -61,3 +61,8 @@
 533398cfd64e5146a07c4824e90a1b629c8b6523 release-pypy3.6-v7.3.0rc1
 285307a0f5a77ffa46781b5c54c52eb1c385081d release-pypy2.7-v7.3.0rc2
 008914050baeedb6d3ca30fe26ef43b78bb63841 release-pypy3.6-v7.3.0rc2
+c124c11a5921bf12797b08a696753a12ae82595a release-pypy3.6-v7.2.0rc3
+e7e02dccbd8c14fa2d4880f6bd4c47362a8952f5 release-pypy3.6-v7.3.0rc3
+c124c11a5921bf12797b08a696753a12ae82595a release-pypy2.7-v7.3.0rc3
+c124c11a5921bf12797b08a696753a12ae82595a release-pypy3.6-v7.2.0rc3
+0000000000000000000000000000000000000000 release-pypy3.6-v7.2.0rc3
diff --git a/lib-python/3/test/test_coroutines.py b/lib-python/3/test/test_coroutines.py
--- a/lib-python/3/test/test_coroutines.py
+++ b/lib-python/3/test/test_coroutines.py
@@ -890,11 +890,11 @@
 
     def test_corotype_1(self):
         ct = types.CoroutineType
-        self.assert_('into coroutine' in ct.send.__doc__ or
+        self.assertTrue('into coroutine' in ct.send.__doc__ or
                      'into generator/coroutine' in ct.send.__doc__)
-        self.assert_('inside coroutine' in ct.close.__doc__ or
+        self.assertTrue('inside coroutine' in ct.close.__doc__ or
                      'inside generator/coroutine' in ct.close.__doc__)
-        self.assert_('in coroutine' in ct.throw.__doc__ or
+        self.assertTrue('in coroutine' in ct.throw.__doc__ or
                      'in generator/coroutine' in ct.throw.__doc__)
         self.assertIn('of the coroutine', ct.__dict__['__name__'].__doc__)
         self.assertIn('of the coroutine', ct.__dict__['__qualname__'].__doc__)
@@ -1238,8 +1238,8 @@
 
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aenter__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             # it's important that __aexit__ wasn't called
             run_async(foo())
 
@@ -1261,8 +1261,8 @@
         except TypeError as exc:
             self.assertRegex(
                 exc.args[0],
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int")
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression")
             self.assertTrue(exc.__context__ is not None)
             self.assertTrue(isinstance(exc.__context__, ZeroDivisionError))
         else:
@@ -1286,8 +1286,8 @@
                 CNT += 1
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 1)
 
@@ -1300,8 +1300,8 @@
                     break
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 2)
 
@@ -1314,8 +1314,8 @@
                     continue
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 3)
 
@@ -1327,8 +1327,8 @@
                 return
         with self.assertRaisesRegex(
                 TypeError,
-                "'async with' received an object from __aexit__ "
-                "that does not implement __await__: int"):
+                # XXX: PyPy change
+                "object int can't be used in 'await' expression"):
             run_async(foo())
         self.assertEqual(CNT, 4)
 
diff --git a/lib_pypy/_tkinter/app.py b/lib_pypy/_tkinter/app.py
--- a/lib_pypy/_tkinter/app.py
+++ b/lib_pypy/_tkinter/app.py
@@ -35,6 +35,16 @@
 
 
 def Tcl_AppInit(app):
+    # For portable builds, try to load a local version of the libraries
+    from os.path import join, dirname, exists
+    lib_path = join(dirname(dirname(dirname(__file__))), 'lib')
+    tcl_path = join(lib_path, 'tcl')
+    tk_path = join(lib_path, 'tk')
+    if exists(tcl_path):
+        tklib.Tcl_Eval(app.interp, 'set tcl_library "{0}"'.format(tcl_path).encode('utf-8'))
+    if exists(tk_path):    
+        tklib.Tcl_Eval(app.interp, 'set tk_library "{0}"'.format(tk_path).encode('utf-8'))
+
     if tklib.Tcl_Init(app.interp) == tklib.TCL_ERROR:
         app.raiseTclError()
     skip_tk_init = tklib.Tcl_GetVar(
diff --git a/pypy/interpreter/pyframe.py b/pypy/interpreter/pyframe.py
--- a/pypy/interpreter/pyframe.py
+++ b/pypy/interpreter/pyframe.py
@@ -565,7 +565,7 @@
         # Copy values from the fastlocals to self.w_locals
         d = self.getorcreatedebug()
         if d.w_locals is None:
-            d.w_locals = self.space.newdict()
+            d.w_locals = self.space.newdict(module=True)
         varnames = self.getcode().getvarnames()
         for i in range(min(len(varnames), self.getcode().co_nlocals)):
             name = varnames[i]
diff --git a/pypy/module/cpyext/modsupport.py b/pypy/module/cpyext/modsupport.py
--- a/pypy/module/cpyext/modsupport.py
+++ b/pypy/module/cpyext/modsupport.py
@@ -232,3 +232,14 @@
         raise oefmt(space.w_SystemError, "PyModule_GetName(): not a module")
     from pypy.module.cpyext.unicodeobject import PyUnicode_AsUTF8
     return PyUnicode_AsUTF8(space, as_pyobj(space, w_mod.w_name))
+
+ at cpython_api([PyObject, lltype.Ptr(PyMethodDef)], rffi.INT_real, error=-1)
+def PyModule_AddFunctions(space, w_mod, methods):
+    if not isinstance(w_mod, Module):
+        raise oefmt(space.w_SystemError, "PyModule_AddFuntions(): not a module")
+    name = space.utf8_w(w_mod.w_name)
+    dict_w = {}
+    convert_method_defs(space, dict_w, methods, None, w_mod, name=name)
+    for key, w_value in dict_w.items():
+        space.setattr(w_mod, space.newtext(key), w_value)
+    return 0
diff --git a/pypy/module/cpyext/test/_widechar.c b/pypy/module/cpyext/test/_widechar.c
--- a/pypy/module/cpyext/test/_widechar.c
+++ b/pypy/module/cpyext/test/_widechar.c
@@ -36,11 +36,7 @@
     "_widechar",
     NULL,
     -1,
-    TestMethods,
     NULL,
-    NULL,
-    NULL,
-    NULL
 };
 
 PyMODINIT_FUNC
@@ -50,5 +46,6 @@
     m = PyModule_Create(&_testcapimodule);
     if (m == NULL)
         return NULL;
+    PyModule_AddFunctions(m, TestMethods);
     return m;
 }
diff --git a/pypy/module/pypyjit/test_pypy_c/test_call.py b/pypy/module/pypyjit/test_pypy_c/test_call.py
--- a/pypy/module/pypyjit/test_pypy_c/test_call.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_call.py
@@ -82,7 +82,6 @@
         assert entry_bridge.match_by_id('call', """
             dummy_get_utf8?
             p38 = call_r(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=<Callr . i EF=1 OS=5>)
-            p99 = getfield_gc_r(p38, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_sys_exc_operror .*>)
             p39 = getfield_gc_r(p38, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref .*>)
             i40 = force_token()
             p41 = getfield_gc_r(p38, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc .*>)
@@ -444,7 +443,6 @@
             dummy_get_utf8?
             guard_not_invalidated(descr=...)
             p29 = call_r(ConstClass(_ll_1_threadlocalref_get__Ptr_GcStruct_objectLlT_Signed), #, descr=<Callr . i EF=1 OS=5>)
-            p99 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_sys_exc_operror .*>)
             p30 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_topframeref .*>)
             p31 = force_token()
             p32 = getfield_gc_r(p29, descr=<FieldP pypy.interpreter.executioncontext.ExecutionContext.inst_w_tracefunc .*>)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_capture_locals.py b/pypy/module/pypyjit/test_pypy_c/test_capture_locals.py
new file mode 100644
--- /dev/null
+++ b/pypy/module/pypyjit/test_pypy_c/test_capture_locals.py
@@ -0,0 +1,41 @@
+from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
+
+
+class TestCaptureLocals(BaseTestPyPyC):
+    def test_capture_locals(self):
+        def main(n):
+            num = 42
+            i = 0
+            acc = 0
+            src = '''
+while i < n:
+    acc += num
+    i += 1
+'''
+            exec(src)
+            return acc
+
+        log = self.run(main, [500])
+        print (log.result)
+        assert log.result == 0
+        loop, = log.loops_by_filename("<string>")
+        print (loop)
+        assert loop.match("""
+            i41 = instance_ptr_eq(ConstPtr(ptr18), p16)
+            guard_false(i41, descr=...)
+            guard_not_invalidated(descr=...)
+            i43 = int_lt(i35, 500)
+            guard_true(i43, descr=...)
+            i45 = getfield_gc_i(ConstPtr(ptr44), descr=...)
+            i47 = int_add_ovf(i45, 42)
+            guard_no_overflow(descr=...)
+            setfield_gc(ConstPtr(ptr48), i47, descr=...)
+            i50 = getfield_gc_i(ConstPtr(ptr49), descr=...)
+            i52 = int_add_ovf(i50, 1)
+            guard_no_overflow(descr=...)
+            i54 = getfield_raw_i(..., descr=...)
+            setfield_gc(ConstPtr(ptr55), i52, descr=...)
+            i57 = int_lt(i54, 0)
+            guard_false(i57, descr=...)
+            jump(..., descr=...)
+        """)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_ffi.py b/pypy/module/pypyjit/test_pypy_c/test_ffi.py
--- a/pypy/module/pypyjit/test_pypy_c/test_ffi.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_ffi.py
@@ -428,7 +428,6 @@
         p156 = getfield_gc_r(p48, descr=...)
         i158 = getfield_raw_i(..., descr=...)
         setfield_gc(p48, p49, descr=...)
-        setfield_gc(p48, p50, descr=...)
         setfield_gc(p134, ConstPtr(null), descr=...)
         i159 = int_lt(i158, 0)
         guard_false(i159, descr=...)
diff --git a/pypy/module/pypyjit/test_pypy_c/test_string.py b/pypy/module/pypyjit/test_pypy_c/test_string.py
--- a/pypy/module/pypyjit/test_pypy_c/test_string.py
+++ b/pypy/module/pypyjit/test_pypy_c/test_string.py
@@ -1,5 +1,6 @@
 # -*- coding: utf-8 -*-
 import sys
+import pytest
 from pypy.module.pypyjit.test_pypy_c.test_00_model import BaseTestPyPyC
 
 # XXX review the <Call> descrs to replace some EF=5 with EF=4 (elidable)
@@ -66,26 +67,20 @@
             i97 = int_ge(i94, i53)
             guard_false(i97, descr=...)
             i98 = strgetitem(p52, i94)
-            p1 = force_token()
             p103 = newstr(1)
             strsetitem(p103, 0, i98)
-            setfield_gc(p0, p1, descr=<FieldP pypy.interpreter.pyframe.PyFrame.vable_token .>)
-            p296 = call_may_force_r(ConstClass(str_decode_utf8), p103, ConstPtr(null), 1, _, 0, descr=<Callr . rriii EF=7>)
-            guard_not_forced(descr=...)
+            i95 = call_i(ConstClass(_check_utf8), p103, 0, 0, -1, descr=<Calli 8 riii EF=4>)
             guard_no_exception(descr=...)
-            p116 = getfield_gc_r(p296, descr=<FieldP tuple3.item0 .+ pure>)
-            i107 = getfield_gc_i(p296, descr=<FieldS tuple3.item1 .+ pure>)
-            i109 = int_lt(i107, 0)
-            guard_false(i109, descr=...)
-            guard_not_invalidated(descr=...)
+            i98 = int_ge(i95, 0)
+            guard_true(i98, descr=...)
             i99 = int_ge(i94, i46)
             guard_false(i99, descr=...)
             i115 = int_add(i94, 1)
             i116 = int_gt(i115, i71)
             guard_false(i116, descr=...)
-            i120 = strgetitem(p45, i94)
-            i122 = call_i(ConstClass(_ll_2_str_eq_checknull_char__rpy_stringPtr_Char), p116, i120, descr=<Calli . ri EF=0 OS=30>)
-            guard_true(i122, descr=...)
+
+            i104 = call_i(ConstClass(_ll_4_str_eq_slice_char__rpy_stringPtr_Signed_Signed_Char), p65, i94, 1, i98, descr=<Calli 8 riii EF=0 OS=27>)
+            guard_true(i104, descr=...)
             i124 = int_add(i83, 1)
             --TICK--
             jump(..., descr=...)
@@ -207,6 +202,7 @@
             ''')
         assert loop.match_by_id('calltwo', '')    # nothing
 
+    @pytest.mark.xfail
     def test_move_method_call_out_of_loop(self):
         # XXX this does not work: _lower_unicode() is found to be elidable,
         # but it can raise (because of 'raise StopIteration' in
@@ -273,7 +269,6 @@
         --TICK--
         jump(..., descr=...)
         """)
-        # XXX remove the guard_nonnull above?
 
     def test_unicode_indexing_makes_no_bridges(self):
         log = self.run(r"""
diff --git a/pypy/tool/release/make_portable.py b/pypy/tool/release/make_portable.py
--- a/pypy/tool/release/make_portable.py
+++ b/pypy/tool/release/make_portable.py
@@ -1,11 +1,11 @@
 #!/usr/bin/env python
 
-bundle = ['sqlite3', 'ssl', 'crypto', 'ffi', 'expat', 'tcl', 'tk', 'gdbm',
+bundle = ['sqlite3', 'ssl', 'crypto', 'ffi', 'expat', 'tcl8', 'tk8', 'gdbm',
           'lzma', 'tinfo', 'tinfow', 'ncursesw', 'panelw', 'ncurses', 'panel', 'panelw']
 
 import os
 from os.path import dirname, relpath, join, exists, basename, realpath
-from shutil import copy2
+from shutil import copy2, copytree
 import sys
 from glob import glob
 from subprocess import check_output, check_call
@@ -62,6 +62,7 @@
     rpaths = {}
 
     for binary in binaries:
+        check_call(['chmod', 'a+w', binary])
         rpath = join('$ORIGIN', relpath('lib', dirname(binary)))
         check_call(['patchelf', '--set-rpath', rpath, binary])
 
@@ -85,6 +86,9 @@
     for path, item in copied.items():
         print('Copied {0} to {1}'.format(path, item))
 
+    copytree('/usr/share/tcl8.5', 'lib/tcl')
+    copytree('/usr/share/tk8.5', 'lib/tk')
+
     binaries.extend(copied.values())
 
     rpaths = rpath_binaries(binaries)


More information about the pypy-commit mailing list