This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients serhiy.storchaka, twouters, vstinner, xdegaye, yan12125
Date 2017-01-12.13:16:22
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484226983.22.0.935847428584.issue29176@psf.upfronthosting.co.za>
In-reply-to
Content
The putwin() function uses mkstemp() with the path template /tmp/py.curses.getwin.XXXXXX.

I would prefer to use the Python function tempfile.mkstemp(). This function has a more portable behaviour. For example, Python is able to atomatically make the file descriptor non-inherirable if the OS supports this feature.

I suggest to expect a file descriptor in the C putwin() and write a Python putwin() which expects a file and pass file.fileno() if available, or use tempfile.TemporaryFile().

tempfile.TemporaryFile is even more secure because the file is not accessible from the regular file system on most platforms. This function is able to use the secure Linux O_TMPFILE flag and the O_TEMPORARY flag on Windows.
History
Date User Action Args
2017-01-12 13:16:23vstinnersetrecipients: + vstinner, twouters, xdegaye, serhiy.storchaka, yan12125
2017-01-12 13:16:23vstinnersetmessageid: <1484226983.22.0.935847428584.issue29176@psf.upfronthosting.co.za>
2017-01-12 13:16:23vstinnerlinkissue29176 messages
2017-01-12 13:16:22vstinnercreate