Index: Lib/tempfile.py =================================================================== --- Lib/tempfile.py (revisão 86582) +++ Lib/tempfile.py (cópia de trabalho) @@ -294,10 +294,12 @@ for seq in range(TMP_MAX): name = next(names) - file = _os.path.join(dir, prefix + name + suffix) + temp_dir_abspath = _os.path.join(dir, prefix + name + suffix) try: - _os.mkdir(file, 0o700) - return file + _os.mkdir(temp_dir_abspath, 0o700) + if temp_dir_abspath.startswith('./'): + temp_dir_abspath = _os.path.abspath(temp_dir_abspath) + return temp_dir_abspath except OSError as e: if e.errno == _errno.EEXIST: continue # try again Index: Lib/test/test_tempfile.py =================================================================== --- Lib/test/test_tempfile.py (revisão 86582) +++ Lib/test/test_tempfile.py (cópia de trabalho) @@ -110,6 +110,7 @@ # _RandomNameSequence returns a six-character string s = next(self.r) self.nameCheck(s, '', '', '') + def test_many(self): # _RandomNameSequence returns no duplicate strings (stochastic) @@ -496,6 +497,17 @@ finally: os.rmdir(dir) + def test_is_abspath(self): + temp_dir1 = self.do_create() + temp_dir2 = self.do_create(dir='.') + + # check if is absolute paths! + self.assertTrue(os.path.isabs(temp_dir1), + "path '%s' is not an absolute path" % (temp_dir1)) + self.assertTrue(os.path.isabs(temp_dir2), + "path '%s' is not an absolute path" % (temp_dir2)) + + test_classes.append(test_mkdtemp)