> * Arfrever Frehtes Taifersar Arahesis <[email protected]> [28-oct.-2011 > 17:15]: > logilab.common.date.ustrftime() is incompatible with Python 3: > > $ python2.7 -c 'import datetime, logilab.common.date; > print(repr(logilab.common.date.ustrftime(datetime.date(2011, 10, 28))))' > u'2011-10-28' > $ python3.2 -c 'import datetime, logilab.common.date; > print(repr(logilab.common.date.ustrftime(datetime.date(2011, 10, 28))))' > Traceback (most recent call last): > File "<string>", line 1, in <module> > File "/usr/lib64/python3.2/site-packages/logilab/common/date.py", line 288, > in ustrftime > return str(somedate.strftime(str(fmt)), encoding) > TypeError: decoding str is not supported > > datetime.date.strftime() already returns str instead of bytes in Python 3, so > decoding is not needed. > > logilab.common.date.ustrftime() tries to support dates before year 1900. > datetime.date.strftime() supports dates since year 1000 in Python 3.2 and > dates since year 1 in Python 3.3:
Interesting and good to know !
> I'm attaching the patch, which fixes logilab.common.date.ustrftime().
> This patch fixes errors in test_ticks2datetime_before_1900() and
> test_ustrftime_before_1900() in
> unittest_date.py with Python 3.2. (There are no other errors in
> unittest_date.py with Python 3.2.)
Yep, I can reproduce that but I haven't tested your patch yet.
I add a ticket to fix that in the next release:
http://www.logilab.org/ticket/82161
Thank you very much for your help for the python3 transition.
P.S. no need to test with python3.1. we'll never support it
--
Julien JEHANNET LOGILAB, Paris (France)
http://www.cubicweb.org CubicWeb, le cadriciel du web sémantique
http://www.logilab.org Dépôt des logiciels libres conçus par Logilab
http://www.logilab.fr Informatique scientifique & Gestion de connaissances
signature.asc
Description: Digital signature
_______________________________________________ Python-Projects mailing list [email protected] http://lists.logilab.org/mailman/listinfo/python-projects
