Author: Armin Rigo <ar...@tunes.org>
Branch: py3.5
Changeset: r87315:9d7f27e06a5c
Date: 2016-09-22 12:08 +0200
http://bitbucket.org/pypy/pypy/changeset/9d7f27e06a5c/

Log:    hg merge py3k

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
@@ -64,6 +64,7 @@
                     infinite_reload = "import infinite_reload, imp; 
imp.reload(infinite_reload)",
                     del_sys_module = "import sys\ndel 
sys.modules['del_sys_module']\n",
                     _md5 = "hello_world = 42\n",
+                    _pypyjson = "hello_world = 42\n",
                     gc = "should_never_be_seen = 42\n",
                     )
     root.ensure("packagenamespace", dir=1)    # empty, no __init__.py
@@ -180,7 +181,7 @@
 
 class AppTestImport(BaseImportTest):
     spaceconfig = {
-        "usemodules": ['_md5', 'time', 'struct'],
+        "usemodules": ['_md5', 'time', 'struct', '_pypyjson'],
     }
 
     def setup_class(cls):
@@ -672,18 +673,19 @@
         del sys.modules['gc']
 
     def test_shadow_extension_1(self):
-        if self.runappdirect: skip("hard to test: module is already imported")
-        # 'import _md5' is supposed to find _md5.py if there is
+        if not self.runappdirect:
+            skip("I don't understand why it fails, but it works in -A "
+                 "on top of a translated PyPy.  Good enough...")
+        # 'import _pypyjson' is supposed to find _pypyjson.py if there is
         # one in sys.path.
         import sys
-        assert '_md5' not in sys.modules
+        assert '_pypyjson' not in sys.modules
         try:
-            import _md5
-            assert hasattr(_md5, 'hello_world')
-            assert not hasattr(_md5, 'md5')
-            assert '(built-in)' not in repr(_md5)
+            import _pypyjson
+            assert hasattr(_pypyjson, 'hello_world')
+            assert '(built-in)' not in repr(_pypyjson)
         finally:
-            sys.modules.pop('_md5', None)
+            sys.modules.pop('_pypyjson', None)
 
     def test_shadow_extension_2(self):
         if self.runappdirect: skip("hard to test: module is already imported")
diff --git a/rpython/jit/backend/test/zll_stress.py 
b/rpython/jit/backend/test/zll_stress.py
--- a/rpython/jit/backend/test/zll_stress.py
+++ b/rpython/jit/backend/test/zll_stress.py
@@ -1,7 +1,6 @@
 from rpython.jit.backend.test.test_random import check_random_function, Random
 from rpython.jit.backend.test.test_ll_random import LLtypeOperationBuilder
 from rpython.jit.backend.detect_cpu import getcpuclass
-from rpython.jit.metainterp.resoperation import rop
 import platform
 
 CPU = getcpuclass()
diff --git a/rpython/rlib/rposix_stat.py b/rpython/rlib/rposix_stat.py
--- a/rpython/rlib/rposix_stat.py
+++ b/rpython/rlib/rposix_stat.py
@@ -147,13 +147,20 @@
         # (we ignore the extra values here for simplicity and portability)
         def stat_result_reduce(st):
             return (st[0], st[1], st[2], st[3], st[4],
-                    st[5], st[6], st[7], st[8], st[9],
-                    st[-3], st[-2], st[-1])
+                    st[5], st[6], st.st_atime, st.st_mtime, st.st_ctime)
 
         def stat_result_recreate(tup):
-            return make_stat_result(tup[:10] + extra_zeroes + tup[-3:])
+            atime, mtime, ctime = tup[7:]
+            result = tup[:7]
+            result += (int(atime), int(mtime), int(ctime))
+            result += extra_zeroes
+            result += (int((atime - result[7]) * 1e9),
+                       int((mtime - result[8]) * 1e9),
+                       int((ctime - result[9]) * 1e9))
+            return make_stat_result(result)
         s_reduced = annmodel.SomeTuple([lltype_to_annotation(TYPE)
-                                       for name, TYPE in PORTABLE_STAT_FIELDS])
+                                    for name, TYPE in PORTABLE_STAT_FIELDS[:7]]
+                                 + 3 * [lltype_to_annotation(lltype.Float)])
         extra_zeroes = (0,) * (len(STAT_FIELDS) - len(PORTABLE_STAT_FIELDS) - 
3)
         return s_reduced, stat_result_reduce, stat_result_recreate
 
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to