Author: Brian Kearns <bdkea...@gmail.com>
Branch: refactor-buffer-api
Changeset: r70940:5313394cecd3
Date: 2014-04-24 16:39 -0400
http://bitbucket.org/pypy/pypy/changeset/5313394cecd3/

Log:    merge default

diff --git a/lib-python/2.7/test/test_itertools.py 
b/lib-python/2.7/test/test_itertools.py
--- a/lib-python/2.7/test/test_itertools.py
+++ b/lib-python/2.7/test/test_itertools.py
@@ -139,7 +139,6 @@
 
     @test_support.impl_detail("tuple reuse is specific to CPython")
     def test_combinations_tuple_reuse(self):
-        # Test implementation detail:  tuple re-use
         self.assertEqual(len(set(map(id, combinations('abcde', 3)))), 1)
         self.assertNotEqual(len(set(map(id, list(combinations('abcde', 3))))), 
1)
 
@@ -211,7 +210,6 @@
 
     @test_support.impl_detail("tuple reuse is specific to CPython")
     def test_combinations_with_replacement_tuple_reuse(self):
-        # Test implementation detail:  tuple re-use
         cwr = combinations_with_replacement
         self.assertEqual(len(set(map(id, cwr('abcde', 3)))), 1)
         self.assertNotEqual(len(set(map(id, list(cwr('abcde', 3))))), 1)
@@ -278,7 +276,6 @@
 
     @test_support.impl_detail("tuple reuse is specific to CPython")
     def test_permutations_tuple_reuse(self):
-        # Test implementation detail:  tuple re-use
         self.assertEqual(len(set(map(id, permutations('abcde', 3)))), 1)
         self.assertNotEqual(len(set(map(id, list(permutations('abcde', 3))))), 
1)
 
diff --git a/pypy/interpreter/pyopcode.py b/pypy/interpreter/pyopcode.py
--- a/pypy/interpreter/pyopcode.py
+++ b/pypy/interpreter/pyopcode.py
@@ -881,8 +881,8 @@
 
     def LOAD_NAME(self, nameindex, next_instr):
         if self.w_locals is not self.w_globals:
-            w_varname = self.getname_w(nameindex)
-            w_value = self.space.finditem(self.w_locals, w_varname)
+            varname = self.getname_u(nameindex)
+            w_value = self.space.finditem_str(self.w_locals, varname)
             if w_value is not None:
                 self.pushvalue(w_value)
                 return
diff --git a/pypy/module/marshal/interp_marshal.py 
b/pypy/module/marshal/interp_marshal.py
--- a/pypy/module/marshal/interp_marshal.py
+++ b/pypy/module/marshal/interp_marshal.py
@@ -327,21 +327,8 @@
 
 
 def invalid_typecode(space, u, tc):
-    # %r not supported in rpython
-    #u.raise_exc('invalid typecode in unmarshal: %r' % tc)
-    c = ord(tc)
-    if c < 16:
-        s = '\\x0%x' % c
-    elif c < 32 or c > 126:
-        s = '\\x%x' % c
-    elif tc == '\\':
-        s = r'\\'
-    else:
-        s = tc
-    q = "'"
-    if s[0] == "'":
-        q = '"'
-    u.raise_exc('invalid typecode in unmarshal: ' + q + s + q)
+    u.raise_exc("bad marshal data (unknown type code)")
+
 
 def register(codes, func):
     """NOT_RPYTHON"""
diff --git a/pypy/module/marshal/test/test_marshal.py 
b/pypy/module/marshal/test/test_marshal.py
--- a/pypy/module/marshal/test/test_marshal.py
+++ b/pypy/module/marshal/test/test_marshal.py
@@ -18,11 +18,13 @@
         exc = raises(TypeError, marshal.loads, memoryview(s))
         assert str(exc.value) == "must be string or read-only buffer, not 
memoryview"
 
-        f = StringIO.StringIO()
-        marshal.dump(case, f)
-        f.seek(0)
-        x = marshal.load(f)
-        assert x == case and type(x) is type(case)
+        import sys
+        if '__pypy__' in sys.builtin_module_names:
+            f = StringIO.StringIO()
+            marshal.dump(case, f)
+            f.seek(0)
+            x = marshal.load(f)
+            assert x == case and type(x) is type(case)
         return x
 
     def test_None(self):
@@ -195,7 +197,7 @@
     def test_bad_typecode(self):
         import marshal
         exc = raises(ValueError, marshal.loads, chr(1))
-        assert r"'\x01'" in exc.value.message
+        assert str(exc.value) == "bad marshal data (unknown type code)"
 
 
 class AppTestSmallLong(AppTestMarshal):
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
https://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to