[Python-checkins] python/dist/src/Modules _csv.c,1.6,1.7

montanaro@users.sourceforge.net montanaro@users.sourceforge.net
Sat, 12 Apr 2003 11:57:55 -0700


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

Modified Files:
	_csv.c 
Log Message:
add writerows docstring
conditionally exclude Unicode functions


Index: _csv.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_csv.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** _csv.c	11 Apr 2003 23:10:13 -0000	1.6
--- _csv.c	12 Apr 2003 18:57:52 -0000	1.7
***************
*** 152,156 ****
          if (check_delattr(v) < 0)
                  return -1;
!         if (!PyString_Check(v) && !PyUnicode_Check(v)) {
                  PyErr_BadArgument();
                  return -1;
--- 152,160 ----
          if (check_delattr(v) < 0)
                  return -1;
!         if (!PyString_Check(v)
! #ifdef Py_USING_UNICODE
! && !PyUnicode_Check(v)
! #endif
! ) {
                  PyErr_BadArgument();
                  return -1;
***************
*** 312,316 ****
  
                  /* If dialect is a string, look it up in our registry */
!                 if (PyString_Check(dialect) || PyUnicode_Check(dialect)) {
                          PyObject * new_dia;
                          new_dia = get_dialect_from_registry(dialect);
--- 316,324 ----
  
                  /* If dialect is a string, look it up in our registry */
!                 if (PyString_Check(dialect)
! #ifdef Py_USING_UNICODE
! || PyUnicode_Check(dialect)
! #endif
! ) {
                          PyObject * new_dia;
                          new_dia = get_dialect_from_registry(dialect);
***************
*** 1011,1017 ****
  
  PyDoc_STRVAR(csv_writerow_doc,
! "join(sequence) -> string\n"
  "\n"
! "Construct a CSV record from a sequence of fields.  Non-string\n"
  "elements will be converted to string.");
  
--- 1019,1025 ----
  
  PyDoc_STRVAR(csv_writerow_doc,
! "writerow(sequence)\n"
  "\n"
! "Construct and write a CSV record from a sequence of fields.  Non-string\n"
  "elements will be converted to string.");
  
***************
*** 1089,1092 ****
--- 1097,1106 ----
  }
  
+ PyDoc_STRVAR(csv_writerows_doc,
+ "writerows(sequence of sequences)\n"
+ "\n"
+ "Construct and write a series of sequences to a csv file.  Non-string\n"
+ "elements will be converted to string.");
+ 
  static PyObject *
  csv_writerows(WriterObj *self, PyObject *seqseq)
***************
*** 1119,1123 ****
  static struct PyMethodDef Writer_methods[] = {
          { "writerow", (PyCFunction)csv_writerow, METH_O, csv_writerow_doc},
!         { "writerows", (PyCFunction)csv_writerows, METH_O},
  	{ NULL, NULL }
  };
--- 1133,1137 ----
  static struct PyMethodDef Writer_methods[] = {
          { "writerow", (PyCFunction)csv_writerow, METH_O, csv_writerow_doc},
!         { "writerows", (PyCFunction)csv_writerows, METH_O, csv_writerows_doc},
  	{ NULL, NULL }
  };
***************
*** 1239,1243 ****
          if (!PyArg_ParseTuple(args, "OO", &name_obj, &dialect_obj))
                  return NULL;
!         if (!PyString_Check(name_obj) && !PyUnicode_Check(name_obj)) {
                  PyErr_SetString(PyExc_TypeError, 
                                  "dialect name must be a string or unicode");
--- 1253,1261 ----
          if (!PyArg_ParseTuple(args, "OO", &name_obj, &dialect_obj))
                  return NULL;
!         if (!PyString_Check(name_obj)
! #ifdef Py_USING_UNICODE
! && !PyUnicode_Check(name_obj)
! #endif
! ) {
                  PyErr_SetString(PyExc_TypeError, 
                                  "dialect name must be a string or unicode");