[Python-3000-checkins] r65142 - in python/branches/py3k: Lib/lib2to3 Lib/lib2to3/fixes/fix_import.py Lib/lib2to3/tests/test_fixers.py

benjamin.peterson python-3000-checkins at python.org
Sat Jul 19 16:19:28 CEST 2008


Author: benjamin.peterson
Date: Sat Jul 19 16:19:28 2008
New Revision: 65142

Log:
Merged revisions 65141 via svnmerge from 
svn+ssh://pythondev@svn.python.org/python/trunk

................
  r65141 | benjamin.peterson | 2008-07-19 09:14:06 -0500 (Sat, 19 Jul 2008) | 9 lines
  
  Merged revisions 65137 via svnmerge from 
  svn+ssh://pythondev@svn.python.org/sandbox/trunk/2to3/lib2to3
  
  ........
    r65137 | georg.brandl | 2008-07-19 08:32:57 -0500 (Sat, 19 Jul 2008) | 2 lines
    
    #3334: correctly set prefix of imports.
  ........
................


Modified:
   python/branches/py3k/   (props changed)
   python/branches/py3k/Lib/lib2to3/   (props changed)
   python/branches/py3k/Lib/lib2to3/fixes/fix_import.py
   python/branches/py3k/Lib/lib2to3/tests/test_fixers.py

Modified: python/branches/py3k/Lib/lib2to3/fixes/fix_import.py
==============================================================================
--- python/branches/py3k/Lib/lib2to3/fixes/fix_import.py	(original)
+++ python/branches/py3k/Lib/lib2to3/fixes/fix_import.py	Sat Jul 19 16:19:28 2008
@@ -45,7 +45,7 @@
             node.changed()
         else:
             new = FromImport('.', getattr(imp, 'content', None) or [imp])
-            new.prefix = node.get_prefix()
+            new.set_prefix(node.get_prefix())
             node = new
         return node
 

Modified: python/branches/py3k/Lib/lib2to3/tests/test_fixers.py
==============================================================================
--- python/branches/py3k/Lib/lib2to3/tests/test_fixers.py	(original)
+++ python/branches/py3k/Lib/lib2to3/tests/test_fixers.py	Sat Jul 19 16:19:28 2008
@@ -3319,6 +3319,17 @@
         a = "from . import foo.bar as bang"
         self.check_both(b, a)
 
+    def test_prefix(self):
+        b = """
+        # prefix
+        import foo.bar
+        """
+        a = """
+        # prefix
+        from . import foo.bar
+        """
+        self.check_both(b, a)
+
 
 if __name__ == "__main__":
     import __main__


More information about the Python-3000-checkins mailing list