[pypy-svn] r79859 - in pypy/branch/fast-forward: lib-python/modified-2.7.0/test pypy/objspace/std

afa at codespeak.net afa at codespeak.net
Tue Dec 7 00:24:51 CET 2010


Author: afa
Date: Tue Dec  7 00:24:48 2010
New Revision: 79859

Added:
   pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_unicode.py
      - copied, changed from r79824, pypy/branch/fast-forward/lib-python/2.7.0/test/test_unicode.py
Modified:
   pypy/branch/fast-forward/pypy/objspace/std/unicodeobject.py
   pypy/branch/fast-forward/pypy/objspace/std/unicodetype.py
Log:
Give argument names to unicode.encode(), 
allow test_expandtabs to raise a MemoryError


Copied: pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_unicode.py (from r79824, pypy/branch/fast-forward/lib-python/2.7.0/test/test_unicode.py)
==============================================================================
--- pypy/branch/fast-forward/lib-python/2.7.0/test/test_unicode.py	(original)
+++ pypy/branch/fast-forward/lib-python/modified-2.7.0/test/test_unicode.py	Tue Dec  7 00:24:48 2010
@@ -1045,7 +1045,8 @@
         # to take a 64-bit long, this test should apply to all platforms.
         if sys.maxint > (1 << 32) or struct.calcsize('P') != 4:
             return
-        self.assertRaises(OverflowError, u't\tt\t'.expandtabs, sys.maxint)
+        self.assertRaises((OverflowError, MemoryError),
+                          u't\tt\t'.expandtabs, sys.maxint)
 
     def test__format__(self):
         def test(value, format, expected):

Modified: pypy/branch/fast-forward/pypy/objspace/std/unicodeobject.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/unicodeobject.py	(original)
+++ pypy/branch/fast-forward/pypy/objspace/std/unicodeobject.py	Tue Dec  7 00:24:48 2010
@@ -838,11 +838,11 @@
     parts = _split_with(self, u'\t')
     result = [parts[0]]
     prevsize = 0
-    totalsize = 0
     for ch in parts[0]:
         prevsize += 1
         if ch == u"\n" or ch ==  u"\r":
             prevsize = 0
+    totalsize = prevsize
             
     for i in range(1, len(parts)):
         pad = tabsize - prevsize % tabsize

Modified: pypy/branch/fast-forward/pypy/objspace/std/unicodetype.py
==============================================================================
--- pypy/branch/fast-forward/pypy/objspace/std/unicodetype.py	(original)
+++ pypy/branch/fast-forward/pypy/objspace/std/unicodetype.py	Tue Dec  7 00:24:48 2010
@@ -48,6 +48,7 @@
                              ' arguments start and end are\ninterpreted as in'
                              ' slice notation.')
 unicode_encode     = SMM('encode', 3, defaults=(None, None),
+                         argnames=['encoding', 'errors'],
                          doc='S.encode([encoding[,errors]]) -> string or'
                              ' unicode\n\nEncodes S using the codec registered'
                              ' for encoding. encoding defaults\nto the default'



More information about the Pypy-commit mailing list