From 2e82ca5fde750d4eec172b6d4c313b2526ceac69 Mon Sep 17 00:00:00 2001 From: Ronny Pfannschmidt Date: Thu, 3 Jun 2010 10:59:24 +0200 Subject: [PATCH] use tempdir.mkdtmp instead of mktmp + repeated tries for making tmpdirs --HG-- branch : trunk --- py/_path/local.py | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/py/_path/local.py b/py/_path/local.py index 5b8ba7310..2687d060f 100644 --- a/py/_path/local.py +++ b/py/_path/local.py @@ -633,16 +633,7 @@ class LocalPath(FSBase): (which we created ourself). """ import tempfile - tries = 10 - for i in range(tries): - dname = tempfile.mktemp() - dpath = cls(tempfile.mktemp()) - try: - dpath.mkdir() - except (py.error.EEXIST, py.error.EPERM, py.error.EACCES): - continue - return dpath - raise py.error.ENOENT(dpath, "could not create tempdir, %d tries" % tries) + return cls(py.error.checked_call(tempfile.mkdtemp)) mkdtemp = classmethod(mkdtemp) def make_numbered_dir(cls, prefix='session-', rootdir=None, keep=3,