Serhiy Storchaka added the comment:

Naive and aware objects should not be mixed. Their actually are different 
types. The converter doesn't return str or bytes when can't parse an input as a 
datetime, and it shouldn't return a naive datetime if can't find a timezone.

SQLite date and time functions imply UTC if timezone is omitted. This is a 
reason for returning aware UTC datetime objects. On other side, Python is more 
powerful programming language, it distinguish naive and aware datetime objects, 
and it is unlikely that these two types are mixed in one database column. It is 
better to raise an error that silently return possible wrong result. It 
exceptional case user can write special converter or just call SQLite 
datetime() for unifying data format.

I think the old code unlikely will be broken if preserve an exception type and 
don't change conditions for raising an error. New error message can contain 
full input string and suggest to use the timestamptz converter if it looks as a 
datetime with timezone.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue29099>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to