diff --git a/Objects/fileobject.c b/Objects/fileobject.c index b4f9e9b5c68..de1a93c44e2 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -106,6 +106,7 @@ open_the_file(PyFileObject *f, char *name, char *mode) "file() constructor not accessible in restricted mode"); return NULL; } + errno = 0; #ifdef HAVE_FOPENRF if (*mode == '*') { FILE *fopenRF();