Title: _csv.Dialect() does not check type for delimiter, escapechar and quotechar fields
Type: Stage:
Components: Versions: Python 3.4
Status: closed Resolution: duplicate
Dependencies: Superseder: csv produces confusing error message when passed a non-string delimiter
View: 18829
Assigned To: Nosy List: serhiy.storchaka, vajrasky, vstinner
Priority: normal Keywords: patch

Created on 2013-12-19 10:05 by vstinner, last changed 2013-12-19 15:46 by vstinner. This issue is now closed.

File name Uploaded Description Edit
csv.patch vstinner, 2013-12-19 10:05 review
Messages (3)
msg206593 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2013-12-19 10:05

$ ./python -c "import _csv; _csv.Dialect(escapechar=b'x')"
python: Python/ceval.c:4262: call_function: Assertion `(x != ((void *)0) && !PyErr_Occurred()) || (x == ((void *)0) && PyErr_Occurred())' failed.
Abandon (core dumped)

Attached patch should fix this issue and adds a unit test.

Note: I found this issue using Fusil the fuzzer.
msg206597 - (view) Author: Vajrasky Kok (vajrasky) * Date: 2013-12-19 10:55
Bear in the mind, the bug is only reproducible with debug flag (--with-pydebug).

Victor, we have a more complete solution for this problem in #18829.
msg206598 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2013-12-19 10:58
This is a duplicate of issue18829.
Date User Action Args
2013-12-19 15:46:01vstinnersetstatus: open -> closed
2013-12-19 10:58:44serhiy.storchakasetsuperseder: csv produces confusing error message when passed a non-string delimiter
resolution: duplicate
messages: + msg206598
2013-12-19 10:55:41vajraskysetnosy: + vajrasky
messages: + msg206597
2013-12-19 10:05:52vstinnercreate