Index: Lib/test/test_os.py =================================================================== --- Lib/test/test_os.py (revision 66306) +++ Lib/test/test_os.py (working copy) @@ -530,6 +530,14 @@ class Win32ErrorTests(unittest.TestCase): pass +class LeakTests(unittest.TestCase): + def test_rename(self): + path = unicode(test_support.TESTFN) + old = sys.getrefcount(path) + self.assertRaises(TypeError, os.rename, path, 0) + new = sys.getrefcount(path) + self.assertEqual(old, new) + def test_main(): test_support.run_unittest( FileTests, @@ -540,7 +548,8 @@ MakedirTests, DevNullTests, URandomTests, - Win32ErrorTests + Win32ErrorTests, + LeakTests ) if __name__ == "__main__":