Massive changes from SF 589982 (tempfile.py rewrite, by Zack

Weinberg).  This changes all uses of deprecated tempfile functions to
the recommended ones.
This commit is contained in:
Guido van Rossum 2002-08-09 16:38:32 +00:00
parent 830a5151c1
commit 3b0a3293c3
31 changed files with 134 additions and 149 deletions

View file

@ -102,17 +102,13 @@ def diff(x, copts, fn):
flags = flags + ' ' + o + a
flags = flags[1:]
data = x.get(fn)
tfn = tempfile.mktemp()
try:
tf = open(tfn, 'w')
tf.write(data)
tf.close()
print 'diff %s -r%s %s' % (flags, x.head(fn), fn)
sts = os.system('diff %s %s %s' % (flags, tfn, fn))
if sts:
print '='*70
finally:
remove(tfn)
tf = tempfile.NamedTemporaryFile()
tf.write(data)
tf.flush()
print 'diff %s -r%s %s' % (flags, x.head(fn), fn)
sts = os.system('diff %s %s %s' % (flags, tf.name, fn))
if sts:
print '='*70
def same(x, copts, fn, data = None):
if data is None: