[issue14766] Non-naive time comparison throws naive time error

2012-05-14 Thread R. David Murray
R. David Murray added the comment: I reformatted the first hunk a bit, hopefully to make it even a little bit clearer. We're still punting the actual definition to the later section, but I think that's appropriate. Thanks for the patch, Greg. -- resolution: -> fixed stage: needs pa

[issue14766] Non-naive time comparison throws naive time error

2012-05-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset 28ed782949f9 by R David Murray in branch '3.2': #14766: Add correct algorithm for when a 'time' object is naive. http://hg.python.org/cpython/rev/28ed782949f9 New changeset b1e03e863386 by R David Murray in branch '3.2': #14766: Reflow the altered

[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread Greg Weller
Greg Weller added the comment: I agree that the language in the quoted paragraph makes it sound as if any object with a non-None tzinfo is aware, which isn't the case. I've changed the first couple sentences to, I think, better reflect what characterizes an object as being aware. --

[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread Chris Bergstresser
Chris Bergstresser added the comment: That patch fixes the documentation there, but the description at the top of the distinction between naive and aware time objects at the top datetime module is still wrong. Here it is: - There are two kinds of date and time objects: “naiv

[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread R. David Murray
R. David Murray added the comment: My, that's embarrassing. I somehow entirely missed the fact that we were dealing with times and not dates here. What you say makes sense to me, and the doc patch looks good. -- ___ Python tracker

[issue14766] Non-naive time comparison throws naive time error

2012-05-10 Thread Greg Weller
Greg Weller added the comment: I think this is a documentation bug. The criteria for datetime and time objects being aware are slightly different. A datetime object d is aware if d.tzinfo.utcoffset(d) does not return None, while a time object t is aware if t.tzinfo.utcoffset(None) does not

[issue14766] Non-naive time comparison throws naive time error

2012-05-09 Thread R. David Murray
R. David Murray added the comment: Ah. datetime.timezone wouldn't have that issue since it doesn't deal with DST. The 3.3 python version of datetime calls utcoffset in the same way as you describe, and it is supposed to have the same behavior as the C version, so probably 3.2/3.3 has the bug

[issue14766] Non-naive time comparison throws naive time error

2012-05-09 Thread Chris Bergstresser
Chris Bergstresser added the comment: It doesn't seem to be a bug in pytz. AFAICT, the only methods that get called during the time comparison is "utcoffset" on the UTC timezone, and "utcoffset" on the New York timezone. Looking closer at it, it seems that Python is calling d1.tzinfo.utcoff

[issue14766] Non-naive time comparison throws naive time error

2012-05-09 Thread R. David Murray
R. David Murray added the comment: An equivalent test using python 3.2's datetime.timezone works fine. Are you sure it isn't a bug in pytz? -- nosy: +belopolsky, r.david.murray ___ Python tracker ___

[issue14766] Non-naive time comparison throws naive time error

2012-05-09 Thread Chris Bergstresser
New submission from Chris Bergstresser : The datetime module says: An object d of type time or datetime may be naive or aware. d is aware if d.tzinfo is not None and d.tzinfo.utcoffset(d) does not return None. If d.tzinfo is None, or if d.tzinfo is not None but d.tzinfo.utcoffset(d) returns N