mirror of
https://github.com/python/cpython.git
synced 2025-12-11 19:40:17 +00:00
Only set error string when dict lookup found no matching key (was setting
it for all failures, potentially masking other exceptions).
This commit is contained in:
parent
b497c106d5
commit
dbce2618b1
1 changed files with 6 additions and 3 deletions
|
|
@ -127,8 +127,11 @@ get_dialect_from_registry(PyObject * name_obj)
|
||||||
PyObject *dialect_obj;
|
PyObject *dialect_obj;
|
||||||
|
|
||||||
dialect_obj = PyDict_GetItem(dialects, name_obj);
|
dialect_obj = PyDict_GetItem(dialects, name_obj);
|
||||||
if (dialect_obj == NULL)
|
if (dialect_obj == NULL) {
|
||||||
return PyErr_Format(error_obj, "unknown dialect");
|
if (!PyErr_Occurred())
|
||||||
|
PyErr_Format(error_obj, "unknown dialect");
|
||||||
|
}
|
||||||
|
else
|
||||||
Py_INCREF(dialect_obj);
|
Py_INCREF(dialect_obj);
|
||||||
return dialect_obj;
|
return dialect_obj;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue