summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2007-11-15 02:26:46 +0000
committerChristian Heimes <christian@cheimes.de>2007-11-15 02:26:46 +0000
commitb1d0a869b0c6a87549967f1aa4bec3654a68bfbb (patch)
treecd268db5cb678848b402617f694b92cc583d8843 /Modules
parente7084798d74f202cf3d2ee6646d53124b0b3fac3 (diff)
downloadcpython-b1d0a869b0c6a87549967f1aa4bec3654a68bfbb.tar.gz
Added some additional checks for sys.std?? is None, see #1440
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ctypes/callbacks.c2
-rw-r--r--Modules/_cursesmodule.c2
-rw-r--r--Modules/threadmodule.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/Modules/_ctypes/callbacks.c b/Modules/_ctypes/callbacks.c
index 9f5e5d029a..9e1aa4f8cc 100644
--- a/Modules/_ctypes/callbacks.c
+++ b/Modules/_ctypes/callbacks.c
@@ -17,7 +17,7 @@ PrintError(char *msg, ...)
va_start(marker, msg);
vsnprintf(buf, sizeof(buf), msg, marker);
va_end(marker);
- if (f)
+ if (f != NULL && f != Py_None)
PyFile_WriteString(buf, f);
PyErr_Print();
}
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index cf412d8777..3a88360b32 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -2010,7 +2010,7 @@ PyCurses_setupterm(PyObject* self, PyObject *args, PyObject* keywds)
sys_stdout = PySys_GetObject("stdout");
- if (sys_stdout == NULL) {
+ if (sys_stdout == NULL || sys_stdout == Py_None) {
PyErr_SetString(
PyCursesError,
"lost sys.stdout");
diff --git a/Modules/threadmodule.c b/Modules/threadmodule.c
index 62ea660860..876d5e2af3 100644
--- a/Modules/threadmodule.c
+++ b/Modules/threadmodule.c
@@ -429,7 +429,7 @@ t_bootstrap(void *boot_raw)
PySys_WriteStderr(
"Unhandled exception in thread started by ");
file = PySys_GetObject("stderr");
- if (file)
+ if (file != NULL && file != Py_None)
PyFile_WriteObject(boot->func, file, 0);
else
PyObject_Print(boot->func, stderr, 0);