mirror of
https://github.com/python/cpython.git
synced 2025-08-03 08:34:29 +00:00
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:
parent
830a5151c1
commit
3b0a3293c3
31 changed files with 134 additions and 149 deletions
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue