Commit 61e2c9a4 authored by Kurt B. Kaiser's avatar Kurt B. Kaiser

Forwardport Patch from IDLEfork SF 610329

Remove deprecated tempfile usage
parent d141a8c4
...@@ -465,8 +465,10 @@ class IOBinding: ...@@ -465,8 +465,10 @@ class IOBinding:
# shell undo is reset after every prompt, looks saved, probably isn't # shell undo is reset after every prompt, looks saved, probably isn't
if not saved or filename is None: if not saved or filename is None:
# XXX KBK 08Jun03 Wouldn't it be better to ask the user to save? # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save?
filename = tempfilename = tempfile.mktemp() (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_')
if not self.writefile(filename): filename = tempfilename
os.close(tfd)
if not self.writefile(tempfilename):
os.unlink(tempfilename) os.unlink(tempfilename)
return "break" return "break"
platform=os.name platform=os.name
...@@ -494,6 +496,8 @@ class IOBinding: ...@@ -494,6 +496,8 @@ class IOBinding:
else: #no printing for this platform else: #no printing for this platform
message="Printing is not enabled for this platform: %s" % platform message="Printing is not enabled for this platform: %s" % platform
tkMessageBox.showinfo("Print status", message, master=self.text) tkMessageBox.showinfo("Print status", message, master=self.text)
if tempfilename:
os.unlink(tempfilename)
return "break" return "break"
opendialog = None opendialog = None
......
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