Skip to content

bpo-29176 Use tmpfile() in curses module - #235

Merged
vstinner merged 1 commit into
python:masterfrom
tiran:bpo29176_curses_tmpfile
Mar 2, 2017
Merged

vstinner merged 1 commit into
python:masterfrom
tiran:bpo29176_curses_tmpfile

Conversation

@tiran

@tiran tiran commented Feb 22, 2017

Copy link
Copy Markdown
Member

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 requested a review from vstinner February 22, 2017 10:37
@tiran tiran changed the title Issue #29176: Use tmpfile() in curses module Feb 22, 2017

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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

Comment thread Modules/_cursesmodule.c Outdated

Copy link
Copy Markdown
Member

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

Comment thread Modules/_cursesmodule.c Outdated

Copy link
Copy Markdown
Member

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.

@tiran
tiran force-pushed the bpo29176_curses_tmpfile branch 2 times, most recently from 7b11476 to a16b7b5 Compare February 22, 2017 11:12

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

Comment thread Modules/_cursesmodule.c Outdated

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

I think an entry in Misc/NEWS is required.

@vstinner

Copy link
Copy Markdown
Member

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 :-(

@tiran
tiran force-pushed the bpo29176_curses_tmpfile branch from 22fdd41 to 0e00de8 Compare February 22, 2017 12:56
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
vstinner merged commit 2b221b7 into python:master Mar 2, 2017
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

5 participants