-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bpo-29176 Use tmpfile() in curses module #235
Conversation
There was a problem hiding this 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 :-)
Modules/_cursesmodule.c
Outdated
@@ -2330,9 +2314,6 @@ PyCurses_GetWin(PyCursesWindowObject *self, PyObject *stream) | |||
error: | |||
if (fp != NULL) |
There was a problem hiding this comment.
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
Modules/_cursesmodule.c
Outdated
@@ -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; |
There was a problem hiding this comment.
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.
7b11476
to
a16b7b5
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a16b7b5
to
22fdd41
Compare
Modules/_cursesmodule.c
Outdated
@@ -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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can be OSError.
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 :-( |
22fdd41
to
0e00de8
Compare
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>
0e00de8
to
8353365
Compare
…#188 This commit fixes an assert statement, that could fail since python#188. No functional change. (cherry picked from commit 5595eec)
…#188 This commit fixes an assert statement, that could fail since python#188. No functional change.
Bumps [cherry-picker](https://github.com/python/core-workflow) from 1.2.2 to 1.3.2. - [Release notes](https://github.com/python/core-workflow/releases) - [Commits](python/core-workflow@cherry-picker-v1.2.2...cherry-picker-v1.3.2)
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