Serhiy Storchaka <[email protected]> added the comment:
I agree, that raising UnicodeEncodeError instead of ValueError is acceptable,
since the former is a subclass of the latter. But since the default
implementation raises more specialized subclass, it is probably that the user
code will catch more narrow exception type. Seems, it is not hard to make the
same exception be raised in all cases. For example, in date_fromisoformat():
if (!dt_ptr || len != 10
|| parse_isoformat_date(dt_ptr, &year, &month, &day) < 0)
{
PyErr_Format(PyExc_ValueError, "Invalid isoformat string: %R", dstr);
return NULL;
}
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue34454>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com