[issue29176] /tmp does not exist on Android and is used by curses.window.putwin()

STINNER Victor report at bugs.python.org
Thu Jan 12 08:16:23 EST 2017


STINNER Victor added the comment:

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.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29176>
_______________________________________


More information about the Python-bugs-list mailing list