summaryrefslogtreecommitdiff
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index c6c7d8e200..c4feed1304 100644
--- a/Objects/fileobject.c
+++ b/Objects/fileobject.c
@@ -352,8 +352,8 @@ PyFile_NewStdPrinter(int fd)
{
PyStdPrinter_Object *self;
- if (fd != fileno(stdout) && fd != fileno(stderr)) {
- PyErr_BadInternalCall();
+ if ((fd != fileno(stdout) && fd != fileno(stderr)) || fd < 0) {
+ /* not enough infrastructure for PyErr_BadInternalCall() */
return NULL;
}