Commit 79bcc422 authored by Tres Seaver's avatar Tres Seaver

Add distinctive prefixes to tempfiles to aid finding resource leaks.

parent bd50a59f
......@@ -1247,7 +1247,7 @@ class TmpStore:
):
setattr(self, method, getattr(storage, method))
self._file = tempfile.TemporaryFile()
self._file = tempfile.TemporaryFile(prefix='TmpStore')
# position: current file position
# _tpos: file position at last commit point
self.position = 0
......
......@@ -34,7 +34,7 @@ class ExportImport:
def exportFile(self, oid, f=None):
if f is None:
f = TemporaryFile()
f = TemporaryFile(prefix="EXP")
elif isinstance(f, six.string_types):
f = open(f,'w+b')
f.write(b'ZEXP')
......
......@@ -251,9 +251,9 @@ def get_pickle_metadata(data):
classname = ''
return modname, classname
def mktemp(dir=None):
def mktemp(dir=None, prefix='tmp'):
"""Create a temp file, known by name, in a semi-secure manner."""
handle, filename = mkstemp(dir=dir)
handle, filename = mkstemp(dir=dir, prefix=prefix)
os.close(handle)
return filename
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment