diff options
author | Skip Montanaro <skip@pobox.com> | 2004-06-11 04:49:03 (GMT) |
---|---|---|
committer | Skip Montanaro <skip@pobox.com> | 2004-06-11 04:49:03 (GMT) |
commit | 51ffac6db7a97efa4e1593583fa66a98b5a9f904 (patch) | |
tree | bae8113344855b8c7f5c5c2fc55585c1210966cf /Objects | |
parent | a5616d225550ceab1385dda3f40c401e40918006 (diff) | |
download | cpython-51ffac6db7a97efa4e1593583fa66a98b5a9f904.zip cpython-51ffac6db7a97efa4e1593583fa66a98b5a9f904.tar.gz cpython-51ffac6db7a97efa4e1593583fa66a98b5a9f904.tar.bz2 |
dump HAVE_FOPENRF stuff - obsolete
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/fileobject.c | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 3ff3cca..34f28e3 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -151,37 +151,30 @@ open_the_file(PyFileObject *f, char *name, char *mode) return NULL; } errno = 0; -#ifdef HAVE_FOPENRF - if (*mode == '*') { - FILE *fopenRF(); - f->f_fp = fopenRF(name, mode+1); - } - else -#endif - { - if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0) - mode = "rb"; + + if (strcmp(mode, "U") == 0 || strcmp(mode, "rU") == 0) + mode = "rb"; #ifdef MS_WINDOWS - if (PyUnicode_Check(f->f_name)) { - PyObject *wmode; - wmode = PyUnicode_DecodeASCII(mode, strlen(mode), NULL); - if (f->f_name && wmode) { - Py_BEGIN_ALLOW_THREADS - /* PyUnicode_AS_UNICODE OK without thread - lock as it is a simple dereference. */ - f->f_fp = _wfopen(PyUnicode_AS_UNICODE(f->f_name), - PyUnicode_AS_UNICODE(wmode)); - Py_END_ALLOW_THREADS - } - Py_XDECREF(wmode); - } -#endif - if (NULL == f->f_fp && NULL != name) { + if (PyUnicode_Check(f->f_name)) { + PyObject *wmode; + wmode = PyUnicode_DecodeASCII(mode, strlen(mode), NULL); + if (f->f_name && wmode) { Py_BEGIN_ALLOW_THREADS - f->f_fp = fopen(name, mode); + /* PyUnicode_AS_UNICODE OK without thread + lock as it is a simple dereference. */ + f->f_fp = _wfopen(PyUnicode_AS_UNICODE(f->f_name), + PyUnicode_AS_UNICODE(wmode)); Py_END_ALLOW_THREADS } + Py_XDECREF(wmode); } +#endif + if (NULL == f->f_fp && NULL != name) { + Py_BEGIN_ALLOW_THREADS + f->f_fp = fopen(name, mode); + Py_END_ALLOW_THREADS + } + if (f->f_fp == NULL) { #ifdef _MSC_VER /* MSVC 6 (Microsoft) leaves errno at 0 for bad mode strings, |