[pypy-commit] pypy stdlib-2.7.4: merge default

bdkearns noreply at buildbot.pypy.org
Thu Apr 11 01:29:19 CEST 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: stdlib-2.7.4
Changeset: r63217:9d7094ca3859
Date: 2013-04-10 19:29 -0400
http://bitbucket.org/pypy/pypy/changeset/9d7094ca3859/

Log:	merge default

diff --git a/pypy/module/_codecs/test/test_codecs.py b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -53,26 +53,25 @@
     def test_unicodedecodeerror(self):
         assert str(UnicodeDecodeError(
             "ascii", "g\xfcrk", 1, 2, "ouch")) == "'ascii' codec can't decode byte 0xfc in position 1: ouch"
-        
+
         assert str(UnicodeDecodeError(
             "ascii", "g\xfcrk", 1, 3, "ouch")) == "'ascii' codec can't decode bytes in position 1-2: ouch"
-        
 
     def test_unicodetranslateerror(self):
         import sys
         assert str(UnicodeTranslateError(
             u"g\xfcrk", 1, 2, "ouch"))== "can't translate character u'\\xfc' in position 1: ouch"
-        
+
         assert str(UnicodeTranslateError(
             u"g\u0100rk", 1, 2, "ouch"))== "can't translate character u'\\u0100' in position 1: ouch"
-        
+
         assert str(UnicodeTranslateError(
             u"g\uffffrk", 1, 2, "ouch"))== "can't translate character u'\\uffff' in position 1: ouch"
-        
+
         if sys.maxunicode > 0xffff and len(unichr(0x10000)) == 1:
             assert str(UnicodeTranslateError(
                 u"g\U00010000rk", 1, 2, "ouch"))== "can't translate character u'\\U00010000' in position 1: ouch"
-            
+
         assert str(UnicodeTranslateError(
             u"g\xfcrk", 1, 3, "ouch"))=="can't translate characters in position 1-2: ouch"
 
@@ -80,22 +79,22 @@
         import sys
         assert str(UnicodeEncodeError(
             "ascii", u"g\xfcrk", 1, 2, "ouch"))=="'ascii' codec can't encode character u'\\xfc' in position 1: ouch"
-            
+
         assert str(UnicodeEncodeError(
             "ascii", u"g\xfcrk", 1, 4, "ouch"))== "'ascii' codec can't encode characters in position 1-3: ouch"
-            
+
         assert str(UnicodeEncodeError(
             "ascii", u"\xfcx", 0, 1, "ouch"))=="'ascii' codec can't encode character u'\\xfc' in position 0: ouch"
 
         assert str(UnicodeEncodeError(
             "ascii", u"\u0100x", 0, 1, "ouch"))=="'ascii' codec can't encode character u'\\u0100' in position 0: ouch"
-       
+
         assert str(UnicodeEncodeError(
             "ascii", u"\uffffx", 0, 1, "ouch"))=="'ascii' codec can't encode character u'\\uffff' in position 0: ouch"
         if sys.maxunicode > 0xffff and len(unichr(0x10000)) == 1:
             assert str(UnicodeEncodeError(
                 "ascii", u"\U00010000x", 0, 1, "ouch")) =="'ascii' codec can't encode character u'\\U00010000' in position 0: ouch"
-    
+
     def test_indexerror(self):
         test =   "\\"     # trailing backslash
         raises (ValueError, test.decode,'string-escape')
@@ -136,7 +135,7 @@
                 u"\x00\xff\u07ff\u0800",
                 u"\x00\xff\u07ff\u0800\uffff",
             ]
-            
+
         buffer = ''
         result = u""
         for (c, partialresult) in zip(u"\x00\xff\u07ff\u0800\uffff".encode(encoding), check_partial):
@@ -173,13 +172,12 @@
             assert result == partialresult
 
     def test_bug1098990_a(self):
-
         import codecs, StringIO
         self.encoding = 'utf-8'
         s1 = u"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy\r\n"
         s2 = u"offending line: ladfj askldfj klasdj fskla dfzaskdj fasklfj laskd fjasklfzzzzaa%whereisthis!!!\r\n"
         s3 = u"next line.\r\n"
-       
+
         s = (s1+s2+s3).encode(self.encoding)
         stream = StringIO.StringIO(s)
         reader = codecs.getreader(self.encoding)(stream)
@@ -205,8 +203,8 @@
         assert reader.readline() == s3
         assert reader.readline() == s4
         assert reader.readline() == s5
-        assert reader.readline() == u""    
-    
+        assert reader.readline() == u""
+
     def test_seek_utf16le(self):
         # all codecs should be able to encode these
         import codecs, StringIO
@@ -219,7 +217,6 @@
             line = reader.readline()
             assert s[:len(line)] == line
 
-
     def test_unicode_internal_encode(self):
         import sys
         class U(unicode):
@@ -284,6 +281,12 @@
         assert '\\0f'.decode('string_escape') == chr(0) + 'f'
         assert '\\08'.decode('string_escape') == chr(0) + '8'
 
+    def test_escape_decode_errors(self):
+        raises(ValueError, br"\x".decode, 'string_escape')
+        raises(ValueError, br"[\x]".decode, 'string_escape')
+        raises(ValueError, br"\x0".decode, 'string_escape')
+        raises(ValueError, br"[\x0]".decode, 'string_escape')
+
     def test_escape_encode(self):
         assert '"'.encode('string_escape') == '"'
         assert "'".encode('string_escape') == "\\'"
diff --git a/rpython/jit/backend/arm/opassembler.py b/rpython/jit/backend/arm/opassembler.py
--- a/rpython/jit/backend/arm/opassembler.py
+++ b/rpython/jit/backend/arm/opassembler.py
@@ -26,7 +26,7 @@
 from rpython.jit.backend.llsupport.descr import InteriorFieldDescr
 from rpython.jit.backend.llsupport.assembler import GuardToken, BaseAssembler
 from rpython.jit.metainterp.history import (Box, AbstractFailDescr,
-                                            INT, FLOAT)
+                                            INT, FLOAT, REF)
 from rpython.jit.metainterp.history import TargetToken
 from rpython.jit.metainterp.resoperation import rop
 from rpython.rlib.objectmodel import we_are_translated
@@ -325,8 +325,15 @@
         self.mc.gen_load_int(r.ip.value, fail_descr_loc.value)
         # XXX self.mov(fail_descr_loc, RawStackLoc(ofs))
         self.store_reg(self.mc, r.ip, r.fp, ofs, helper=r.lr)
-        gcmap = self.gcmap_for_finish
-        self.push_gcmap(self.mc, gcmap, store=True)
+        if op.numargs() > 0 and op.getarg(0).type == REF:
+            gcmap = self.gcmap_for_finish
+            self.push_gcmap(self.mc, gcmap, store=True)
+        else:
+            # note that the 0 here is redundant, but I would rather
+            # keep that one and kill all the others
+            ofs = self.cpu.get_ofs_of_frame_field('jf_gcmap')
+            self.mc.gen_load_int(r.ip.value, 0)
+            self.store_reg(self.mc, r.ip, r.fp, ofs)
         self.mc.MOV_rr(r.r0.value, r.fp.value)
         # exit function
         self.gen_func_epilog()


More information about the pypy-commit mailing list