Author serhiy.storchaka
Recipients belopolsky, bozo.kopic, ghaering, lemburg, serhiy.storchaka, xiang.zhang
Date 2017-01-12.07:28:39
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1484206120.56.0.38487171515.issue29099@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-01-12 07:28:40serhiy.storchakasetrecipients: + serhiy.storchaka, lemburg, ghaering, belopolsky, xiang.zhang, bozo.kopic
2017-01-12 07:28:40serhiy.storchakasetmessageid: <1484206120.56.0.38487171515.issue29099@psf.upfronthosting.co.za>
2017-01-12 07:28:40serhiy.storchakalinkissue29099 messages
2017-01-12 07:28:39serhiy.storchakacreate