Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
vstinner merged 1 commit intopython:masterfromtiran:bpo29176_curses_tmpfile
Mar 2, 2017

Conversation

tiran
Copy link
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 Heimeschristian@python.org

@tirantiran requested a review fromvstinnerFebruary 22, 2017 10:37
@tirantiran changed the titleIssue #29176: Use tmpfile() in curses modulebpo-29176 Use tmpfile() in curses moduleFeb 22, 2017
Copy link
Member

@vstinnervstinner left a comment

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

@@ -2330,9 +2314,6 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
error:
if (fp != NULL)
Copy link
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

@@ -2278,8 +2267,6 @@ PyCurses_UngetMouse(PyObject *self, PyObject *args)
static PyObject *
PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
{
char fn[100];
int fd = -1;
FILE *fp = NULL;
Copy link
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.

@tirantiranforce-pushed thebpo29176_curses_tmpfile branch 2 times, most recently from7b11476 toa16b7b5CompareFebruary 22, 2017 11:12
Copy link
Member

@vstinnervstinner left a comment

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.

@@ -2314,7 +2296,7 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream)
datalen = PyBytes_GET_SIZE(data);
if (fwrite(PyBytes_AS_STRING(data), 1, datalen, fp) != datalen) {
Py_DECREF(data);
PyErr_SetFromErrnoWithFilename(PyExc_IOError, fn);
PyErr_SetFromErrno(PyExc_IOError);

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
Member

I think an entry in Misc/NEWS is required.

@vstinner
Copy link
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 :-(

@tirantiranforce-pushed thebpo29176_curses_tmpfile branch from22fdd41 to0e00de8CompareFebruary 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 acorrect 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>
@vstinnervstinner merged commit2b221b7 intopython:masterMar 2, 2017
yan12125 added a commit to yan12125/python3-android that referenced this pull requestMar 2, 2017
akruis pushed a commit to akruis/cpython that referenced this pull requestApr 20, 2021
…#188This commit fixes an assert statement, that could fail sincepython#188.No functional change.(cherry picked from commit5595eec)
akruis pushed a commit to akruis/cpython that referenced this pull requestMay 27, 2021
…#188This commit fixes an assert statement, that could fail sincepython#188.No functional change.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@vstinnervstinnervstinner approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

5 participants
@tiran@serhiy-storchaka@vstinner@Mariatta@the-knights-who-say-ni

[8]ページ先頭

©2009-2025 Movatter.jp