Subject: bug#15647: closed (Re: bug#15647: 24.3.50; python.el does not clean up temp file)

From: [email-masked] (GNU bug Tracking System)
Date: Sat, 23 Nov 2013 03:14:02 +0000

Your bug report

#15647: 24.3.50; python.el does not clean up temp file

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
15647: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15647
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#15647: 24.3.50; python.el does not clean up temp file
From: Glenn Morris <[email-masked]>
To: [email-masked]
Date: Fri, 22 Nov 2013 22:13:17 -0500
List-Id: <debbugs-submit.debbugs.gnu.org>

Version: 24.4

Thanks; applied.

Subject: 24.3.50; python.el does not clean up temp file
From: Jorgen Schaefer <[email-masked]>
To: [email-masked]
Date: Fri, 18 Oct 2013 20:51:04 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

python.el will use temporary files to communicate with the inferior
python process. These temporary files are never cleaned up.

To reproduce, simply run M-x run-python and check the temp dir. It has a
"py?????" file in it. Kill the buffer and repeat, such files will
accumulate.

The following simple patch will delete the file after loading it.

--- lisp/progmodes/python.el	2013-10-07 18:51:26 +0000
+++ lisp/progmodes/python.el	2013-10-18 18:47:02 +0000
@@ -2048,6 +2048,8 @@
                (file-name (or (buffer-file-name) temp-file-name)))
           (with-temp-file temp-file-name
             (insert string)
+            (insert (format "\n\nimport os ; os.remove('''%s''')\n"
+                            temp-file-name))
             (delete-trailing-whitespace))
           (python-shell-send-file file-name process temp-file-name))
       (comint-send-string process string)