Kevin Duffy <[email protected]> added the comment:

Right, they should pass on both interpreters. When I consulted the CPython 
2.7.6 implementation in 
Modules/datetimemodule.c, astimezone() does do a pointer comparison so I can 
remove my patch for astimezone(). If you look 
at time_richcompare() and datetime_subtract() in CPython it does not have the 
equivalent of the PyPy tzinfo comparison (if 
my.tzinfo is other.tzinfo) -  it always calls utcoffset(). I still believe 
changing the 'is' to a '==' is more correct in 
these cases. One reason is if you look at datetime.__cmp__ and time.__sub__ in 
PyPy, they use a '==' not an 'is'.

Since CPython doesn't do the exact equivalent code (tzinfo comparison), I'm not 
sure how to get the tests to fail on PyPy 
without the patch AND succeed on CPython without doing an interpreter check. 
The difference between the interpreters is one 
should call utcoffset and one shouldn't.

Attaching an updated patch that removes changes to astimezone and updated tests 
that at least pass on both interpreters.

________________________________________
PyPy bug tracker <[email protected]>
<https://bugs.pypy.org/issue1662>
________________________________________
_______________________________________________
pypy-issue mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-issue

Reply via email to