From a08095ab02d72949e975e7056b1567f95de21da0 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Wed, 13 Feb 1991 23:25:27 +0000 Subject: [PATCH] Hack to open resource fork on the Mac: open(filename, '*rb'). --- Objects/fileobject.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Objects/fileobject.c b/Objects/fileobject.c index f87e22e430e..7da32a95644 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -61,9 +61,17 @@ newfileobject(name, mode) f = (fileobject *) newopenfileobject((FILE *)NULL, name, mode); if (f == NULL) return NULL; - if ((f->f_fp = fopen(name, mode)) == NULL) { +#ifdef THINK_C + if (*mode == '*') { + FILE *fopenRF(); + f->f_fp = fopenRF(name, mode+1); + } + else +#endif + f->f_fp = fopen(name, mode); + if (f->f_fp == NULL) { + err_errno(RuntimeError); DECREF(f); - err_errno(RuntimeError); /* XXX Should use another error */ return NULL; } return (object *)f;