Fix logic problem in quoting=csv.QUOTE_ALL, quotechar=None check, add test.

This commit is contained in:
Andrew McNamara 2005-01-12 08:16:17 +00:00
parent c89f284df8
commit 5d45a8dc22
2 changed files with 3 additions and 1 deletions

View File

@ -32,6 +32,8 @@ class Test_Csv(unittest.TestCase):
self.assertRaises(TypeError, ctor, arg, quoting=None)
self.assertRaises(TypeError, ctor, arg,
quoting=csv.QUOTE_ALL, quotechar='')
self.assertRaises(TypeError, ctor, arg,
quoting=csv.QUOTE_ALL, quotechar=None)
def test_reader_arg_valid(self):
self._test_arg_valid(csv.reader, [])

View File

@ -401,7 +401,7 @@ dialect_new(PyTypeObject *type, PyObject *args, PyObject *kwargs)
PyErr_SetString(PyExc_TypeError, "delimiter must be set");
goto err;
}
if (quotechar == Py_None && self->quoting != QUOTE_NONE)
if (quotechar == Py_None && quoting == NULL)
self->quoting = QUOTE_NONE;
if (self->quoting != QUOTE_NONE && self->quotechar == 0) {
PyErr_SetString(PyExc_TypeError,