]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
MW does not always set errno on failing fopen()
authorJack Jansen <jack.jansen@cwi.nl>
Sun, 23 Apr 1995 22:12:47 +0000 (22:12 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sun, 23 Apr 1995 22:12:47 +0000 (22:12 +0000)
Objects/fileobject.c

index df27caf41fba4a7944113a2d5310ecd4bad1525d..d8335275801425244845ca1499b83cb321a78370 100644 (file)
@@ -32,6 +32,10 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 #ifdef THINK_C
 #define HAVE_FOPENRF
 #endif
+#ifdef __MWERKS__
+/* Mwerks fopen() doesn't always set errno */
+#define NO_FOPEN_ERRNO
+#endif
 
 #define BUF(v) GETSTRINGVALUE((stringobject *)v)
 
@@ -111,6 +115,13 @@ newfileobject(name, mode)
                END_SAVE
        }
        if (f->f_fp == NULL) {
+#ifdef NO_FOPEN_ERRNO
+               if ( errno == 0 ) {
+                       err_setstr(IOError, "Cannot open file");
+                       DECREF(f);
+                       return NULL;
+               }
+#endif
                err_errno(IOError);
                DECREF(f);
                return NULL;