[Python-checkins] r73960 - in sandbox/trunk/2to3/lib2to3: refactor.py tests/test_refactor.py

benjamin.peterson python-checkins at python.org
Sat Jul 11 23:44:32 CEST 2009


Author: benjamin.peterson
Date: Sat Jul 11 23:44:32 2009
New Revision: 73960

Log:
don't parse files just because they end with 'py' (no dot)

Modified:
   sandbox/trunk/2to3/lib2to3/refactor.py
   sandbox/trunk/2to3/lib2to3/tests/test_refactor.py

Modified: sandbox/trunk/2to3/lib2to3/refactor.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/refactor.py	(original)
+++ sandbox/trunk/2to3/lib2to3/refactor.py	Sat Jul 11 23:44:32 2009
@@ -220,7 +220,8 @@
             dirnames.sort()
             filenames.sort()
             for name in filenames:
-                if not name.startswith(".") and name.endswith("py"):
+                if not name.startswith(".") and \
+                        os.path.splitext(name)[1].endswith("py"):
                     fullname = os.path.join(dirpath, name)
                     self.refactor_file(fullname, write, doctests_only)
             # Modify dirnames in-place to remove subdirs with leading dots

Modified: sandbox/trunk/2to3/lib2to3/tests/test_refactor.py
==============================================================================
--- sandbox/trunk/2to3/lib2to3/tests/test_refactor.py	(original)
+++ sandbox/trunk/2to3/lib2to3/tests/test_refactor.py	Sat Jul 11 23:44:32 2009
@@ -167,7 +167,8 @@
         tree = ["nothing",
                 "hi.py",
                 ".dumb",
-                ".after.py"]
+                ".after.py",
+                "sappy"]
         expected = ["hi.py"]
         check(tree, expected)
         tree = ["hi.py",


More information about the Python-checkins mailing list