diff options
author | Kurt B. Kaiser <kbk@shore.net> | 2003-06-14 17:56:25 (GMT) |
---|---|---|
committer | Kurt B. Kaiser <kbk@shore.net> | 2003-06-14 17:56:25 (GMT) |
commit | 61e2c9a402106664142fa1e26ac5d938b2f95d1b (patch) | |
tree | 2a8f8014fb4cb9d55c0c88eca6d9929d51e4eae8 /Lib/idlelib | |
parent | d141a8c472789b55a7cc4e3585d4de63d44eedff (diff) | |
download | cpython-61e2c9a402106664142fa1e26ac5d938b2f95d1b.zip cpython-61e2c9a402106664142fa1e26ac5d938b2f95d1b.tar.gz cpython-61e2c9a402106664142fa1e26ac5d938b2f95d1b.tar.bz2 |
Forwardport Patch from IDLEfork SF 610329
Remove deprecated tempfile usage
Diffstat (limited to 'Lib/idlelib')
-rw-r--r-- | Lib/idlelib/IOBinding.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Lib/idlelib/IOBinding.py b/Lib/idlelib/IOBinding.py index 0cc9a5f..3e1f87d 100644 --- a/Lib/idlelib/IOBinding.py +++ b/Lib/idlelib/IOBinding.py @@ -465,8 +465,10 @@ class IOBinding: # shell undo is reset after every prompt, looks saved, probably isn't if not saved or filename is None: # XXX KBK 08Jun03 Wouldn't it be better to ask the user to save? - filename = tempfilename = tempfile.mktemp() - if not self.writefile(filename): + (tfd, tempfilename) = tempfile.mkstemp(prefix='IDLE_tmp_') + filename = tempfilename + os.close(tfd) + if not self.writefile(tempfilename): os.unlink(tempfilename) return "break" platform=os.name @@ -494,6 +496,8 @@ class IOBinding: else: #no printing for this platform message="Printing is not enabled for this platform: %s" % platform tkMessageBox.showinfo("Print status", message, master=self.text) + if tempfilename: + os.unlink(tempfilename) return "break" opendialog = None |