[Python-checkins] r73179 - in sandbox/trunk/2to3/lib2to3: fixes/fix_buffer.py tests/test_fixers.py

benjamin.peterson python-checkins at python.org
Wed Jun 3 20:09:53 CEST 2009


Author: benjamin.peterson
Date: Wed Jun  3 20:09:53 2009
New Revision: 73179

Log:
handle the case where there's multiple trailers #6185

Modified:
   sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py
   sandbox/trunk/2to3/lib2to3/tests/test_fixers.py

Modified: sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py	(original)
+++ sandbox/trunk/2to3/lib2to3/fixes/fix_buffer.py	Wed Jun  3 20:09:53 2009
@@ -13,7 +13,7 @@
     explicit = True # The user must ask for this fixer
 
     PATTERN = """
-              power< name='buffer' trailer< '(' [any] ')' > >
+              power< name='buffer' trailer< '(' [any] ')' > any* >
               """
 
     def transform(self, node, results):

Modified: sandbox/trunk/2to3/lib2to3/tests/test_fixers.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/tests/test_fixers.py	(original)
+++ sandbox/trunk/2to3/lib2to3/tests/test_fixers.py	Wed Jun  3 20:09:53 2009
@@ -3325,6 +3325,11 @@
         a = """x = memoryview(y)"""
         self.check(b, a)
 
+    def test_slicing(self):
+        b = """buffer(y)[4:5]"""
+        a = """memoryview(y)[4:5]"""
+        self.check(b, a)
+
 class Test_future(FixerTestCase):
     fixer = "future"
 


More information about the Python-checkins mailing list