diff options
author | Jack Jansen <jack.jansen@cwi.nl> | 1995-04-23 22:12:47 (GMT) |
---|---|---|
committer | Jack Jansen <jack.jansen@cwi.nl> | 1995-04-23 22:12:47 (GMT) |
commit | e08dea19c25da59e51166d7f7b334a391bc7fb0f (patch) | |
tree | 3987a36a412a0dd61337a7008fa4e80901e86fc1 /Objects/fileobject.c | |
parent | 1ff2f218cafa13b0b216006c3de5f0d15386ae82 (diff) | |
download | cpython-e08dea19c25da59e51166d7f7b334a391bc7fb0f.zip cpython-e08dea19c25da59e51166d7f7b334a391bc7fb0f.tar.gz cpython-e08dea19c25da59e51166d7f7b334a391bc7fb0f.tar.bz2 |
MW does not always set errno on failing fopen()
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index df27caf..d833527 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -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; |