[Python-checkins] r67836 - sandbox/trunk/io-c/_textio.c

amaury.forgeotdarc python-checkins at python.org
Thu Dec 18 00:36:43 CET 2008


Author: amaury.forgeotdarc
Date: Thu Dec 18 00:36:43 2008
New Revision: 67836

Log:
One more test passes


Modified:
   sandbox/trunk/io-c/_textio.c

Modified: sandbox/trunk/io-c/_textio.c
==============================================================================
--- sandbox/trunk/io-c/_textio.c	(original)
+++ sandbox/trunk/io-c/_textio.c	Thu Dec 18 00:36:43 2008
@@ -910,11 +910,22 @@
     return NULL;
 }
 
+static PyObject *
+TextIOWrapper_fileno(PyTextIOWrapperObject *self, PyObject *args)
+{
+    return PyObject_CallMethod(self->buffer, "fileno", NULL);
+}
+
+static PyObject *
+TextIOWrapper_name_get(PyTextIOWrapperObject *self, void *context)
+{
+    return PyObject_GetAttrString(self->buffer, "name");
+}
+
 static PyMethodDef TextIOWrapper_methods[] = {
 /*    {"seekable", (PyCFunction)TextIOWrapper_seekable, METH_NOARGS},
     {"readable", (PyCFunction)TextIOWrapper_readable, METH_NOARGS},
     {"writable", (PyCFunction)TextIOWrapper_writable, METH_NOARGS},
-    {"fileno", (PyCFunction)TextIOWrapper_fileno, METH_NOARGS},
     {"isatty", (PyCFunction)TextIOWrapper_isatty, METH_NOARGS},
     {"flush", (PyCFunction)BufferedWriter_flush, METH_NOARGS},
 */
@@ -922,6 +933,7 @@
     {"write", (PyCFunction)TextIOWrapper_write, METH_VARARGS},
     {"read", (PyCFunction)TextIOWrapper_read, METH_VARARGS},
     {"readline", (PyCFunction)TextIOWrapper_readline, METH_VARARGS},
+    {"fileno", (PyCFunction)TextIOWrapper_fileno, METH_NOARGS},
 /*    {"seek", (PyCFunction)TextIOWrapper_seek, METH_VARARGS},
     {"tell", (PyCFunction)TextIOWrapper_tell, METH_NOARGS},
     {"truncate", (PyCFunction)TextIOWrapper_truncate, METH_VARARGS},
@@ -934,12 +946,13 @@
 
 static PyMemberDef TextIOWrapper_members[] = {
     {"encoding", T_OBJECT, offsetof(PyTextIOWrapperObject, encoding), READONLY},
+    {"buffer", T_OBJECT, offsetof(PyTextIOWrapperObject, buffer), READONLY},
     {NULL}
 };
 
 static PyGetSetDef TextIOWrapper_getset[] = {
-/*    {"closed", (getter)TextIOWrapper_closed_get, NULL, NULL},
     {"name", (getter)TextIOWrapper_name_get, NULL, NULL},
+/*    {"closed", (getter)TextIOWrapper_closed_get, NULL, NULL},
     {"mode", (getter)TextIOWrapper_mode_get, NULL, NULL},
 */
     {0}


More information about the Python-checkins mailing list