summaryrefslogtreecommitdiffstats
path: root/Objects/fileobject.c
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1991-02-13 23:25:27 (GMT)
committerGuido van Rossum <guido@python.org>1991-02-13 23:25:27 (GMT)
commita08095ab02d72949e975e7056b1567f95de21da0 (patch)
tree47933f87e31b2da8c2606f9bece2a77ba64a1be3 /Objects/fileobject.c
parent33f1770ed8f7d1febc7814e087ca7ba8ddce26df (diff)
downloadcpython-a08095ab02d72949e975e7056b1567f95de21da0.zip
cpython-a08095ab02d72949e975e7056b1567f95de21da0.tar.gz
cpython-a08095ab02d72949e975e7056b1567f95de21da0.tar.bz2
Hack to open resource fork on the Mac: open(filename, '*rb').
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r--Objects/fileobject.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c
index f87e22e..7da32a9 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;