[Python-checkins] python/dist/src/Modules cStringIO.c,2.40,2.41

rhettinger at users.sourceforge.net rhettinger at users.sourceforge.net
Fri Aug 8 06:20:05 EDT 2003


Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv12432/Modules

Modified Files:
	cStringIO.c 
Log Message:
SF bug #770485: cStringIO does not set closed attr



Index: cStringIO.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cStringIO.c,v
retrieving revision 2.40
retrieving revision 2.41
diff -C2 -d -r2.40 -r2.41
*** cStringIO.c	24 Apr 2003 15:50:11 -0000	2.40
--- cStringIO.c	8 Aug 2003 12:20:03 -0000	2.41
***************
*** 89,92 ****
--- 89,108 ----
  
  static PyObject *
+ IO_get_closed(IOobject *self, void *closure)
+ {
+ 	PyObject *result = Py_False;
+ 
+ 	if (self->buf == NULL)
+ 		result = Py_True;
+ 	Py_INCREF(result);
+ 	return result;
+ }
+ 
+ static PyGetSetDef file_getsetlist[] = {
+ 	{"closed", (getter)IO_get_closed, NULL, "True if the file is closed"},
+ 	{0},
+ };
+ 
+ static PyObject *
  IO_flush(IOobject *self, PyObject *unused) {
  
***************
*** 456,459 ****
--- 472,476 ----
  	{"softspace",	T_INT,	offsetof(Oobject, softspace),	0,
  	 "flag indicating that a space needs to be printed; used by print"},
+ 	 /* getattr(f, "closed") is implemented without this table */
  	{NULL} /* Sentinel */
  };
***************
*** 499,503 ****
    (iternextfunc)IO_iternext,	/*tp_iternext */
    O_methods,			/*tp_methods */
!   O_memberlist			/*tp_members */
  };
  
--- 516,521 ----
    (iternextfunc)IO_iternext,	/*tp_iternext */
    O_methods,			/*tp_methods */
!   O_memberlist,			/*tp_members */
!   file_getsetlist,		/*tp_getset */
  };
  
***************
*** 615,619 ****
    PyObject_SelfIter,			/* tp_iter */
    (iternextfunc)IO_iternext,		/* tp_iternext */
!   I_methods				/* tp_methods */
  };
  
--- 633,639 ----
    PyObject_SelfIter,			/* tp_iter */
    (iternextfunc)IO_iternext,		/* tp_iternext */
!   I_methods,				/* tp_methods */
!   0,					/* tp_members */
!   file_getsetlist,			/* tp_getset */
  };
  





More information about the Python-checkins mailing list