Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.1k
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
Uh oh!
There was an error while loading.Please reload this page.
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
toa16b7b5
CompareThere 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
to22fdd41
CompareModules/_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
to0e00de8
CompareThe 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>
0e00de8
to8353365
Compare…#188This commit fixes an assert statement, that could fail sincepython#188.No functional change.(cherry picked from commit5595eec)
…#188This commit fixes an assert statement, that could fail sincepython#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 Heimeschristian@python.org