[Python-checkins] CVS: python/dist/src/Objects fileobject.c,2.148,2.149
Neil Schemenauer
nascheme@users.sourceforge.net
Fri, 22 Mar 2002 15:50:32 -0800
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv25209
Modified Files:
fileobject.c
Log Message:
Undo last commit. It's causing the tests to file.
Index: fileobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/fileobject.c,v
retrieving revision 2.148
retrieving revision 2.149
diff -C2 -d -r2.148 -r2.149
*** fileobject.c 22 Mar 2002 20:38:57 -0000 2.148
--- fileobject.c 22 Mar 2002 23:50:30 -0000 2.149
***************
*** 57,86 ****
}
- /* 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 *
--- 57,60 ----
***************
*** 104,108 ****
return NULL;
f->f_fp = fp;
- f = dircheck(f);
return (PyObject *) f;
}
--- 78,81 ----
***************
*** 158,162 ****
f = NULL;
}
- f = dircheck(f);
return (PyObject *)f;
}
--- 131,134 ----