◐ Shell
clean mode source ↗

bpo-29176 Use tmpfile() in curses module by tiran · Pull Request #235 · python/cpython

Conversation

@tiran

The curses module used mkstemp() + fopen() to create a temporary file in
/tmp. The /tmp directory does not exist on Android. The tmpfile()
function simplifies the task a lot. It creates a temporary file in a
correct directory, takes care of cleanup and returns FILE*.

tmpfile is supported on all platforms (C89, POSIX 2001, Android,
Windows).

https://bugs.python.org/issue29176

Signed-off-by: Christian Heimes christian@python.org

@tiran tiran changed the title Issue #29176: Use tmpfile() in curses module bpo-29176 Use tmpfile() in curses module

Feb 22, 2017

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed your PR and wrote exactly the same :-)

#237

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the if can now be removed

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

= NULL can be removed

Same remarks for the other function.

vstinner

vstinner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed "Issue #29176: Use tmpfile() in curses module " in the commit message.

Please replace "Issue #29176" with "bpo-29176".

Moreover, I don't think that the bugs.python.org URL is needed in the commit message.

serhiy-storchaka

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be OSError.

@serhiy-storchaka

I think an entry in Misc/NEWS is required.

@vstinner

I think an entry in Misc/NEWS is required.

From an user point of view, there is no change, except of Android support.

Last days, I'm trying to avoid touching Misc/NEWS, because it's even more a mess because of how pull requests work :-(

The curses module used mkstemp() + fopen() to create a temporary file in
/tmp. The /tmp directory does not exist on Android. The tmpfile()
function simplifies the task a lot. It creates a temporary file in a
correct directory, takes care of cleanup and returns FILE*.

tmpfile is supported on all platforms (C89, POSIX 2001, Android,
Windows).

Signed-off-by: Christian Heimes <christian@python.org>

vstinner

yan12125 pushed a commit to yan12125/python3-android that referenced this pull request

Mar 2, 2017

akruis added a commit to akruis/cpython that referenced this pull request

Apr 20, 2021
…#188

This commit fixes an assert statement, that could fail since python#188.
No functional change.

(cherry picked from commit 5595eec)

akruis added a commit to akruis/cpython that referenced this pull request

May 27, 2021
…#188

This commit fixes an assert statement, that could fail since python#188.
No functional change.

jaraco pushed a commit that referenced this pull request

Dec 2, 2022