Index: Lib/tempfile.py =================================================================== --- Lib/tempfile.py (revision 77754) +++ Lib/tempfile.py (working copy) @@ -308,7 +308,7 @@ file = _os.path.join(dir, prefix + name + suffix) try: _os.mkdir(file, 0o700) - return file + return _os.path.abspath(file) except OSError as e: if e.errno == _errno.EEXIST: continue # try again Index: Lib/test/test_tempfile.py =================================================================== --- Lib/test/test_tempfile.py (revision 77754) +++ Lib/test/test_tempfile.py (working copy) @@ -51,6 +51,8 @@ nsuf = nbase[len(nbase)-len(suf):] # check for equality of the absolute paths! + self.assertEqual(ndir, os.path.abspath(dir), + "path '%s' does not match path '%s'" % (ndir, os.path.abspath(dir))) self.assertEqual(os.path.abspath(ndir), os.path.abspath(dir), "file '%s' not in directory '%s'" % (name, dir)) self.assertEqual(npre, pre, @@ -103,7 +105,7 @@ def test_get_six_char_str(self): # _RandomNameSequence returns a six-character string s = next(self.r) - self.nameCheck(s, '', '', '') + self.nameCheck(os.path.join(os.path.abspath(''), s), '', '', '') def test_many(self): # _RandomNameSequence returns no duplicate strings (stochastic) @@ -112,7 +114,7 @@ r = self.r for i in range(TEST_FILES): s = next(r) - self.nameCheck(s, '', '', '') + self.nameCheck(os.path.join(os.path.abspath(''), s), '', '', '') self.assertFalse(s in dict) dict[s] = 1 @@ -491,6 +493,14 @@ finally: os.rmdir(dir) + def test_abs_path(self): + #mkdtemp verifies existence of absolute paths with relative dir + try: + name = self.do_create(dir=".") + finally: + pass + #os.rmdir(name) + test_classes.append(test_mkdtemp)