mirror of https://github.com/python/cpython
Fix logic problem in quoting=csv.QUOTE_ALL, quotechar=None check, add test.
This commit is contained in:
parent
c89f284df8
commit
5d45a8dc22
|
@ -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, [])
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue