diff options
author | Andrew McNamara <andrewm@object-craft.com.au> | 2005-01-10 23:17:35 (GMT) |
---|---|---|
committer | Andrew McNamara <andrewm@object-craft.com.au> | 2005-01-10 23:17:35 (GMT) |
commit | dbce2618b1c6dcd76a5ae68ee0bc4464b8faecb3 (patch) | |
tree | d1bdfdad3f6deaea64d2e4fd0c0197f1589b376e /Modules | |
parent | b497c106d54f12fee97a362af748c70e0c66ef4a (diff) | |
download | cpython-dbce2618b1c6dcd76a5ae68ee0bc4464b8faecb3.zip cpython-dbce2618b1c6dcd76a5ae68ee0bc4464b8faecb3.tar.gz cpython-dbce2618b1c6dcd76a5ae68ee0bc4464b8faecb3.tar.bz2 |
Only set error string when dict lookup found no matching key (was setting
it for all failures, potentially masking other exceptions).
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/_csv.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Modules/_csv.c b/Modules/_csv.c index 7eb1e22..9f715e4 100644 --- a/Modules/_csv.c +++ b/Modules/_csv.c @@ -127,9 +127,12 @@ get_dialect_from_registry(PyObject * name_obj) PyObject *dialect_obj; dialect_obj = PyDict_GetItem(dialects, name_obj); - if (dialect_obj == NULL) - return PyErr_Format(error_obj, "unknown dialect"); - Py_INCREF(dialect_obj); + if (dialect_obj == NULL) { + if (!PyErr_Occurred()) + PyErr_Format(error_obj, "unknown dialect"); + } + else + Py_INCREF(dialect_obj); return dialect_obj; } |