summaryrefslogtreecommitdiffstats
path: root/Python/sysmodule.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/sysmodule.c')
-rw-r--r--Python/sysmodule.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index f1da9730c..9ec8ab1 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -1839,6 +1839,9 @@ sys_pyfile_write(const char *text, PyObject *file)
PyObject *unicode = NULL, *writer = NULL, *args = NULL, *result = NULL;
int err;
+ if (file == NULL)
+ return -1;
+
unicode = PyUnicode_FromString(text);
if (unicode == NULL)
goto error;