diff options
author | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-22 23:50:30 (GMT) |
---|---|---|
committer | Neil Schemenauer <nascheme@enme.ucalgary.ca> | 2002-03-22 23:50:30 (GMT) |
commit | 12a6d942d8138b4dd1a32d4d9a40ca312708aeee (patch) | |
tree | 59117992b5f3a8c7357ddc8ed27c9c58763f407d /Objects/fileobject.c | |
parent | c155dd4ca91403469a4bd46528b592d940f43fb3 (diff) | |
download | cpython-12a6d942d8138b4dd1a32d4d9a40ca312708aeee.zip cpython-12a6d942d8138b4dd1a32d4d9a40ca312708aeee.tar.gz cpython-12a6d942d8138b4dd1a32d4d9a40ca312708aeee.tar.bz2 |
Undo last commit. It's causing the tests to file.
Diffstat (limited to 'Objects/fileobject.c')
-rw-r--r-- | Objects/fileobject.c | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/Objects/fileobject.c b/Objects/fileobject.c index 924ddcf..c8fb214 100644 --- a/Objects/fileobject.c +++ b/Objects/fileobject.c @@ -56,32 +56,6 @@ PyFile_Name(PyObject *f) return ((PyFileObject *)f)->f_name; } -/* On Unix, fopen will succeed for directories. - In Python, there should be no file objects referring to - directories, so we need a check. */ - -static PyFileObject* -dircheck(PyFileObject* f) -{ -#if defined(HAVE_FSTAT) && defined(S_IFDIR) && defined(EISDIR) - struct stat buf; - if (f->f_fp == NULL) - return f; - if (fstat(fileno(f->f_fp), &buf) == 0 && - S_ISDIR(buf.st_mode)) { -#ifdef HAVE_STRERROR - char *msg = strerror(EISDIR); -#else - char *msg = "Is a directory"; -#endif - PyObject *exc = PyObject_CallFunction(PyExc_IOError, "(is)", EISDIR, msg); - PyErr_SetObject(PyExc_IOError, exc); - return NULL; - } -#endif - return f; -} - static PyObject * fill_file_fields(PyFileObject *f, FILE *fp, char *name, char *mode, @@ -103,7 +77,6 @@ fill_file_fields(PyFileObject *f, FILE *fp, char *name, char *mode, if (f->f_name == NULL || f->f_mode == NULL) return NULL; f->f_fp = fp; - f = dircheck(f); return (PyObject *) f; } @@ -157,7 +130,6 @@ open_the_file(PyFileObject *f, char *name, char *mode) PyErr_SetFromErrnoWithFilename(PyExc_IOError, name); f = NULL; } - f = dircheck(f); return (PyObject *)f; } |