mirror of
https://github.com/python/cpython.git
synced 2025-08-11 12:29:34 +00:00
Fix logic problem in quoting=csv.QUOTE_ALL, quotechar=None check, add test.
This commit is contained in:
parent
c89f284df8
commit
5d45a8dc22
2 changed files with 3 additions and 1 deletions
|
@ -32,6 +32,8 @@ class Test_Csv(unittest.TestCase):
|
||||||
self.assertRaises(TypeError, ctor, arg, quoting=None)
|
self.assertRaises(TypeError, ctor, arg, quoting=None)
|
||||||
self.assertRaises(TypeError, ctor, arg,
|
self.assertRaises(TypeError, ctor, arg,
|
||||||
quoting=csv.QUOTE_ALL, quotechar='')
|
quoting=csv.QUOTE_ALL, quotechar='')
|
||||||
|
self.assertRaises(TypeError, ctor, arg,
|
||||||
|
quoting=csv.QUOTE_ALL, quotechar=None)
|
||||||
|
|
||||||
def test_reader_arg_valid(self):
|
def test_reader_arg_valid(self):
|
||||||
self._test_arg_valid(csv.reader, [])
|
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");
|
PyErr_SetString(PyExc_TypeError, "delimiter must be set");
|
||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
if (quotechar == Py_None && self->quoting != QUOTE_NONE)
|
if (quotechar == Py_None && quoting == NULL)
|
||||||
self->quoting = QUOTE_NONE;
|
self->quoting = QUOTE_NONE;
|
||||||
if (self->quoting != QUOTE_NONE && self->quotechar == 0) {
|
if (self->quoting != QUOTE_NONE && self->quotechar == 0) {
|
||||||
PyErr_SetString(PyExc_TypeError,
|
PyErr_SetString(PyExc_TypeError,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue