diff -r 8c5b845c14fc -r 3663a153e75f lib2to3/fixes/fix_import.py --- a/lib2to3/fixes/fix_import.py Wed Feb 24 02:21:34 2010 +0000 +++ b/lib2to3/fixes/fix_import.py Tue May 04 10:48:54 2010 +0200 @@ -76,6 +76,8 @@ return new def probably_a_local_import(self, imp_name): + if imp_name.startswith("."): + return False imp_name = imp_name.split('.', 1)[0] base_path = dirname(self.filename) base_path = join(base_path, imp_name) diff -r 8c5b845c14fc -r 3663a153e75f lib2to3/tests/test_fixers.py --- a/lib2to3/tests/test_fixers.py Wed Feb 24 02:21:34 2010 +0000 +++ b/lib2to3/tests/test_fixers.py Tue May 04 10:48:54 2010 +0200 @@ -3686,9 +3686,12 @@ from lib2to3.fixes import fix_import fix_import.exists = os.path.exists - def check_both(self, b, a): + def check_both(self, b, a, always_unchanged = False): self.always_exists = True - super(Test_import, self).check(b, a) + if always_unchanged: + super(Test_import, self).unchanged(b) + else: + super(Test_import, self).check(b, a) self.always_exists = False super(Test_import, self).unchanged(b) @@ -3818,6 +3821,11 @@ """ self.check_both(b, a) + def test_unchanged_relative_imports(self): + b = "from . import foo" + a = "from . import foo" + self.check_both(b, a, always_unchanged = True) + class Test_set_literal(FixerTestCase):