]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix logic problem in quoting=csv.QUOTE_ALL, quotechar=None check, add test.
authorAndrew McNamara <andrewm@object-craft.com.au>
Wed, 12 Jan 2005 08:16:17 +0000 (08:16 +0000)
committerAndrew McNamara <andrewm@object-craft.com.au>
Wed, 12 Jan 2005 08:16:17 +0000 (08:16 +0000)
Lib/test/test_csv.py
Modules/_csv.c

index a3c084306b7ea03c30d0f141401dd7e75924e6cb..ed10ed79a47614d496d40f971941ca3d8e3d8f4e 100644 (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, [])
index 30b7eca40901db97af2574b19b517c28169e3b29..c592933cb45e1edf48d749525e23dd5769467bde 100644 (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,