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.

Title: Deprecate isdst argument in email.utils.localtime
Type: Stage:
Components: Library (Lib) Versions: Python 3.11
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Alan.Williams, Mariatta, belopolsky, r.david.murray
Priority: normal Keywords: easy

Created on 2016-09-14 21:55 by belopolsky, last changed 2022-04-11 14:58 by admin.

Messages (7)
msg276492 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2016-09-14 21:55
With the implementation of PEP 495, email.utils.localtime() does not need the isdst argument to disambiguate naive time.  In fact the utility method itself is redundant given that astimezone() now works for naive instances.
msg281078 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2016-11-18 06:20
Hi Alexander,

Is the idea here to raise deprecation warning starting in 3.6 and remove it by 3.8?

Thanks :)
msg281125 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-11-18 14:31
At this point I think the deprecation warning will go into 3.7, but we should be able to remove it in 3.8.  I think I'll probably keep the 'localtime' method and have it delegate it to astimezone, because frankly I would never be able to remember that that was the datetime method I needed to get localtime.
msg281127 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2016-11-18 15:18
Thanks David :)
So, I found that isdst was never added as method signature in the docs, but it is mentioned in the paragraph.

The intention is still just to deprecate isdst argument, right? not the localtime().

I can add a sentence in the docs indicating that we favor datetime.astimezone() instead of email.utils.localtime(), if that works for you. What do you think about this?
msg281139 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2016-11-18 16:23
No, localtime does something subtly different, in that it will accept a naive datetime add the local timezone to it.  Calling localtime() is also more convenient/readable than calling
msg281161 - (view) Author: Alexander Belopolsky (belopolsky) * (Python committer) Date: 2016-11-18 19:46
Keeping localtime as a convenience function in email.util is fine, but isdst argument should be eliminated at some point.  There is a fundamental problem with disambiguating fold times with isdst: some folds do not involve the change in dst or happen in the regions that do not have a dst regime at all.  PEP 495 covers this in all the gory details.
msg412846 - (view) Author: Alan WiIliams (Alan.Williams) * Date: 2022-02-08 16:46
Hi, I'd like to work on this issue. Based on the discussion, the main thing to do here is to raise a deprecation warning when isdst is used?
Date User Action Args
2022-04-11 14:58:36adminsetgithub: 72346
2022-02-08 16:46:38Alan.Williamssetnosy: + Alan.Williams
messages: + msg412846
2022-01-11 14:00:50iritkatrielsetkeywords: + easy
versions: + Python 3.11, - Python 3.6, Python 3.7
2016-11-18 19:46:51belopolskysetmessages: + msg281161
2016-11-18 16:23:27r.david.murraysetmessages: + msg281139
2016-11-18 15:18:29Mariattasetmessages: + msg281127
2016-11-18 14:31:23r.david.murraysetmessages: + msg281125
2016-11-18 06:20:58Mariattasetnosy: + Mariatta
messages: + msg281078
2016-09-14 21:55:13belopolskycreate