Rip out the file object's implementation.
Fixed test_import.py while I was at it.

However, there's still a problem in import.c -- get_file() can leak a
FILE struct (not a file descriptor though).  I'm not sure how to fix
this; closing the FILE* closes the file descriptor, and that's the
wrong thing to do when there's still a Python file object keeping the
file descriptor open.  I also would rather not mess with dup(), as it
won't port to Windows.
diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
index 918e22d..2680320 100644
--- a/Modules/_cursesmodule.c
+++ b/Modules/_cursesmodule.c
@@ -1287,12 +1287,13 @@
   
   if (!PyArg_ParseTuple(args, "O;fileobj", &temp))
     return NULL;
-  if (!PyFile_Check(temp)) {
-    PyErr_SetString(PyExc_TypeError, "argument must be a file object");
-    return NULL;
-  }
+  PyErr_SetString(PyExc_TypeError, "argument must be a file object");
+  return NULL;
+
+#if 0
   return PyCursesCheckERR(putwin(self->win, PyFile_AsFile(temp)), 
 			  "putwin");
+#endif
 }
 
 static PyObject *
@@ -1748,11 +1749,10 @@
 
   PyCursesInitialised
 
-  if (!PyFile_Check(temp)) {
-    PyErr_SetString(PyExc_TypeError, "argument must be a file object");
-    return NULL;
-  }
+  PyErr_SetString(PyExc_TypeError, "argument must be a file object");
+  return NULL;
 
+#if 0
   win = getwin(PyFile_AsFile(temp));
 
   if (win == NULL) {
@@ -1761,6 +1761,7 @@
   }
 
   return PyCursesWindow_New(win);
+#endif
 }
 
 static PyObject *
diff --git a/Modules/bz2module.c b/Modules/bz2module.c
index d4f2743..029232c 100644
--- a/Modules/bz2module.c
+++ b/Modules/bz2module.c
@@ -1075,6 +1075,7 @@
 		offset -= self->pos;
 	} else {
 		/* we cannot move back, so rewind the stream */
+		FILE *fp = NULL; /* XXX temporary!!! */
 		BZ2_bzReadClose(&bzerror, self->fp);
 		if (bzerror != BZ_OK) {
 			Util_CatchBZ2Error(bzerror);
@@ -1086,7 +1087,7 @@
 		Py_DECREF(ret);
 		ret = NULL;
 		self->pos = 0;
-		self->fp = BZ2_bzReadOpen(&bzerror, PyFile_AsFile(self->file),
+		self->fp = BZ2_bzReadOpen(&bzerror, fp,
 					  0, 0, NULL, 0);
 		if (bzerror != BZ_OK) {
 			Util_CatchBZ2Error(bzerror);
@@ -1286,6 +1287,7 @@
 {
 	static char *kwlist[] = {"filename", "mode", "buffering",
                                        "compresslevel", 0};
+	FILE *fp = NULL; /* XXX temporary!!! */
 	PyObject *name;
 	char *mode = "r";
 	int buffering = -1;
@@ -1347,8 +1349,8 @@
 
 	mode = (mode_char == 'r') ? "rb" : "wb";
 
-	self->file = PyObject_CallFunction((PyObject*)&PyFile_Type, "(Osi)",
-					   name, mode, buffering);
+	self->file = NULL; /* XXX io.open(name, mode, buffering); */
+	PyErr_SetString(PyExc_RuntimeError, "can't open bz2 files yet");
 	if (self->file == NULL)
 		return -1;
 
@@ -1365,11 +1367,11 @@
 
 	if (mode_char == 'r')
 		self->fp = BZ2_bzReadOpen(&bzerror,
-					  PyFile_AsFile(self->file),
+					  fp,
 					  0, 0, NULL, 0);
 	else
 		self->fp = BZ2_bzWriteOpen(&bzerror,
-					   PyFile_AsFile(self->file),
+					   fp,
 					   compresslevel, 0, 0);
 
 	if (bzerror != BZ_OK) {
diff --git a/Modules/cPickle.c b/Modules/cPickle.c
index a4dff7b..f0b3c8a 100644
--- a/Modules/cPickle.c
+++ b/Modules/cPickle.c
@@ -418,31 +418,6 @@
 }
 
 static int
-write_file(Picklerobject *self, const char *s, Py_ssize_t  n)
-{
-	size_t nbyteswritten;
-
-	if (s == NULL) {
-		return 0;
-	}
-
-	if (n > INT_MAX) {
-		/* String too large */
-		return -1;
-	}
-
-	Py_BEGIN_ALLOW_THREADS
-	nbyteswritten = fwrite(s, sizeof(char), n, self->fp);
-	Py_END_ALLOW_THREADS
-	if (nbyteswritten != (size_t)n) {
-		PyErr_SetFromErrno(PyExc_IOError);
-		return -1;
-	}
-
-	return (int)n;
-}
-
-static int
 write_cStringIO(Picklerobject *self, const char *s, Py_ssize_t  n)
 {
 	if (s == NULL) {
@@ -517,92 +492,6 @@
 
 
 static Py_ssize_t
-read_file(Unpicklerobject *self, char **s, Py_ssize_t n)
-{
-	size_t nbytesread;
-
-	if (self->buf_size == 0) {
-		int size;
-
-		size = ((n < 32) ? 32 : n);
-		if (!( self->buf = (char *)malloc(size))) {
-			PyErr_NoMemory();
-			return -1;
-		}
-
-		self->buf_size = size;
-	}
-	else if (n > self->buf_size) {
-		char *newbuf = (char *)realloc(self->buf, n);
-		if (!newbuf)  {
-			PyErr_NoMemory();
-			return -1;
-		}
-		self->buf = newbuf;
-		self->buf_size = n;
-	}
-
-	Py_BEGIN_ALLOW_THREADS
-	nbytesread = fread(self->buf, sizeof(char), n, self->fp);
-	Py_END_ALLOW_THREADS
-	if (nbytesread != (size_t)n) {
-		if (feof(self->fp)) {
-			PyErr_SetNone(PyExc_EOFError);
-			return -1;
-		}
-
-		PyErr_SetFromErrno(PyExc_IOError);
-		return -1;
-	}
-
-	*s = self->buf;
-
-	return n;
-}
-
-
-static Py_ssize_t
-readline_file(Unpicklerobject *self, char **s)
-{
-	int i;
-
-	if (self->buf_size == 0) {
-		if (!( self->buf = (char *)malloc(40))) {
-			PyErr_NoMemory();
-			return -1;
-		}
-		self->buf_size = 40;
-	}
-
-	i = 0;
-	while (1) {
-		int bigger;
-		char *newbuf;
-		for (; i < (self->buf_size - 1); i++) {
-			if (feof(self->fp) ||
-			    (self->buf[i] = getc(self->fp)) == '\n') {
-				self->buf[i + 1] = '\0';
-				*s = self->buf;
-				return i + 1;
-			}
-		}
-		bigger = self->buf_size << 1;
-		if (bigger <= 0) {	/* overflow */
-			PyErr_NoMemory();
-			return -1;
-		}
-		newbuf = (char *)realloc(self->buf, bigger);
-		if (!newbuf)  {
-			PyErr_NoMemory();
-			return -1;
-		}
-		self->buf = newbuf;
-		self->buf_size = bigger;
-	}
-}
-
-
-static Py_ssize_t
 read_cStringIO(Unpicklerobject *self, char **s, Py_ssize_t  n)
 {
 	char *ptr;
@@ -2665,16 +2554,7 @@
 	if (!( self->memo = PyDict_New()))
 		goto err;
 
-	if (PyFile_Check(file)) {
-		self->fp = PyFile_AsFile(file);
-		if (self->fp == NULL) {
-			PyErr_SetString(PyExc_ValueError,
-					"I/O operation on closed file");
-			goto err;
-		}
-		self->write_func = write_file;
-	}
-	else if (PycStringIO_OutputCheck(file)) {
+        if (PycStringIO_OutputCheck(file)) {
 		self->write_func = write_cStringIO;
 	}
 	else if (file == Py_None) {
@@ -4988,17 +4868,7 @@
 	self->file = f;
 
 	/* Set read, readline based on type of f */
-	if (PyFile_Check(f)) {
-		self->fp = PyFile_AsFile(f);
-		if (self->fp == NULL) {
-			PyErr_SetString(PyExc_ValueError,
-					"I/O operation on closed file");
-			goto err;
-		}
-		self->read_func = read_file;
-		self->readline_func = readline_file;
-	}
-	else if (PycStringIO_InputCheck(f)) {
+	if (PycStringIO_InputCheck(f)) {
 		self->fp = NULL;
 		self->read_func = read_cStringIO;
 		self->readline_func = readline_cStringIO;
diff --git a/Modules/pyexpat.c b/Modules/pyexpat.c
index aebae1c..c583edf 100644
--- a/Modules/pyexpat.c
+++ b/Modules/pyexpat.c
@@ -956,10 +956,7 @@
     FILE *fp;
     PyObject *readmethod = NULL;
 
-    if (PyFile_Check(f)) {
-        fp = PyFile_AsFile(f);
-    }
-    else {
+    {
         fp = NULL;
         readmethod = PyObject_GetAttrString(f, "read");
         if (readmethod == NULL) {