This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Intern UTC timezone
Type: resource usage Stage: commit review
Components: Extension Modules, Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: accepted
Dependencies: Superseder:
Assigned To: belopolsky Nosy List: belopolsky, fdrake, mark.dickinson
Priority: normal Keywords: easy, patch

Created on 2010-07-06 21:55 by belopolsky, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue9183.diff belopolsky, 2010-07-06 21:55 Patch for the C code review
issue9183-proto.diff belopolsky, 2010-07-07 00:06 Patch for the Python code
issue9183a.diff belopolsky, 2010-07-28 17:59 Patch for both C and Python implementations review
Messages (4)
msg109432 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-06 21:55
Attached patch makes timezone(timedelta(0)) always return the same instance as timezone.utc.  See issue9051 for pure python implementation.

With this patch, manipulation of aware datetime objects will be as efficient as that of naive datetime objects.  Note that having timezone.utc is not enough to assure that the same tzinfo object is used because aware objects can be produced by datetime.strptime().  With this patch,

>>> datetime.strptime('2010-07-06 21:39:55 +0000', "%Y-%m-%d %H:%M:%S %z").tzinfo is timezone.utc
True
msg109444 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-07 00:06
Python implementation of UTC interning can be done better than the one in issue9051.  See attached issue9183-proto.diff.
msg111834 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-07-28 17:59
Updated issue9183a.diff patch combines C and Python code changes since datetime.py is now in stdlib.   Does anyone want to review before it goes in?
msg118693 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2010-10-14 17:07
Committed in r85485.
History
Date User Action Args
2022-04-11 14:57:03adminsetgithub: 53429
2010-10-14 17:07:22belopolskysetstatus: open -> closed

messages: + msg118693
2010-07-28 18:01:38belopolskylinkissue9051 dependencies
2010-07-28 18:01:25belopolskysetnosy: + fdrake
2010-07-28 17:59:26belopolskysetfiles: + issue9183a.diff

messages: + msg111834
resolution: accepted
components: + Library (Lib)
2010-07-07 00:06:05belopolskysetfiles: + issue9183-proto.diff

messages: + msg109444
2010-07-06 21:55:52belopolskycreate