Author: Armin Rigo <ar...@tunes.org>
Branch: py3k
Changeset: r87267:0ac14db93823
Date: 2016-09-21 14:28 +0200
http://bitbucket.org/pypy/pypy/changeset/0ac14db93823/

Log:    fixes

diff --git a/pypy/module/posix/interp_posix.py 
b/pypy/module/posix/interp_posix.py
--- a/pypy/module/posix/interp_posix.py
+++ b/pypy/module/posix/interp_posix.py
@@ -373,7 +373,14 @@
             w_value = space.wrap(st[i])
             lst[i] = w_value
         else:
-            w_value = space.wrap(getattr(st, name))
+            try:
+                value = getattr(st, name)
+            except AttributeError:
+                # untranslated, there is no nsec_Xtime attribute
+                assert name.startswith('nsec_')
+                value = rposix_stat.get_stat_ns_as_bigint(st, name[5:])
+                value = value.tolong() % 1000000000
+            w_value = space.wrap(value)
             space.setitem(w_keywords, space.wrap(name), w_value)
 
     # Note: 'w_keywords' contains the three attributes 'nsec_Xtime'.
diff --git a/pypy/objspace/std/typeobject.py b/pypy/objspace/std/typeobject.py
--- a/pypy/objspace/std/typeobject.py
+++ b/pypy/objspace/std/typeobject.py
@@ -1099,11 +1099,7 @@
         raise oefmt(space.w_TypeError, "__slots__ must be identifiers")
     # create member
     slot_name = mangle(slot_name, w_self.name)
-    if slot_name in w_self.dict_w:
-        raise oefmt(space.w_ValueError,
-                    "'%8' in __slots__ conflicts with class variable",
-                    slot_name)
-    else:
+    if slot_name not in w_self.dict_w:
         # Force interning of slot names.
         slot_name = space.str_w(space.new_interned_str(slot_name))
         # in cpython it is ignored less, but we probably don't care
@@ -1111,7 +1107,10 @@
         w_self.dict_w[slot_name] = space.wrap(member)
         return True
     else:
-        return False
+        # never returns False, but that's to minimize the diff with pypy2
+        raise oefmt(space.w_ValueError,
+                    "'%8' in __slots__ conflicts with class variable",
+                    slot_name)
 
 def create_dict_slot(w_self):
     if not w_self.hasdict:
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to