[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky
Change by Alexander Belopolsky : -- resolution: -> fixed stage: patch review -> resolved status: open -> closed ___ Python tracker ___

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: New changeset 1d4089b5d208ae6f0bd256304fd77f04c0b4fd41 by Alexander Belopolsky (Miss Islington (bot)) in branch '3.6': bpo-33812: Corrected astimezone for naive datetimes. (GH-7578) (GH-7601) https://github.com/python/cpython/commit/1d4089b5d208ae6f0bd2

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: New changeset 037e9125527d4a55af566f161c96a61b3c3fd998 by Alexander Belopolsky (Miss Islington (bot)) in branch '3.7': bpo-33812: Corrected astimezone for naive datetimes. (GH-7578) (GH-7600) https://github.com/python/cpython/commit/037e9125527d4a55af56

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread miss-islington
Change by miss-islington : -- pull_requests: +7223 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://ma

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread miss-islington
Change by miss-islington : -- pull_requests: +7222 stage: commit review -> patch review ___ Python tracker ___ ___ Python-bugs-list

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: New changeset 877b23202b7e7d4f57b58504fd0eb886e8c0b377 by Alexander Belopolsky in branch 'master': bpo-33812: Corrected astimezone for naive datetimes. (GH-7578) https://github.com/python/cpython/commit/877b23202b7e7d4f57b58504fd0eb886e8c0b377 ---

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-10 Thread Alexander Belopolsky
Change by Alexander Belopolsky : -- stage: patch review -> commit review versions: +Python 3.6 ___ Python tracker ___ ___ Python-bug

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-09 Thread Tim Peters
Tim Peters added the comment: I'd call it a bug fix, but I'm really not anal about what people call things ;-) -- ___ Python tracker ___ __

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-09 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: Tim, given that I've updated the documentation, should we treat this as a bug fix or a feature? Note that the type check is definitely a bug-fix (if not a security issue), but I clearly had a wrong definition of "naive" in mind when I was modifying as

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-09 Thread Alexander Belopolsky
Change by Alexander Belopolsky : -- keywords: +patch pull_requests: +7202 stage: needs patch -> patch review ___ Python tracker ___

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Tim Peters
Tim Peters added the comment: I copy/pasted the definitions of "aware" and "naive" from the docs. Your TZ's .utcoffset() returns None, so, yes, any datetime using an instance of that for its tzinfo is naive. In print(datetime(2000,1,1).astimezone(timezone.utc)) the docs for astimezone say

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Alexander Belopolsky
Change by Alexander Belopolsky : -- assignee: -> belopolsky components: +Extension Modules, Library (Lib) stage: -> needs patch type: -> behavior versions: +Python 3.7, Python 3.8 ___ Python tracker __

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Alexander Belopolsky
Alexander Belopolsky added the comment: So you are suggesting that my datetime(2000,1,1,tzinfo=TZ()) should behave as a naive instance, right? Well, this would be a third behavior different from both current C and Python implementations: >>> print(datetime(2000,1,1).astimezone(timezone.utc)

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Tim Peters
Tim Peters added the comment: The message isn't confusing - the definition of "aware" is confusing ;-) """ A datetime object 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 No

[issue33812] Different behavior between datetime.py and its C accelerator

2018-06-08 Thread Alexander Belopolsky
New submission from Alexander Belopolsky : Consider the following code: $ cat bug.py import sys if len(sys.argv) > 1: sys.modules['_datetime'] = None from datetime import tzinfo, datetime, timezone class TZ(tzinfo): def utcoffset(self, t): pass print(datetime(2000,1,1,tzinfo=T