Skip to content

Deprecate isdst argument in email.utils.localtime #72346

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
abalkin opened this issue Sep 14, 2016 · 9 comments · Fixed by #91450
Closed

Deprecate isdst argument in email.utils.localtime #72346

abalkin opened this issue Sep 14, 2016 · 9 comments · Fixed by #91450
Labels
3.12 only security fixes easy stdlib Python modules in the Lib dir topic-email

Comments

@abalkin
Copy link
Member

abalkin commented Sep 14, 2016

BPO 28159
Nosy @abalkin, @bitdancer, @aw1231, @Mariatta

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = None
closed_at = None
created_at = <Date 2016-09-14.21:55:13.766>
labels = ['easy', 'library', '3.11']
title = 'Deprecate isdst argument in email.utils.localtime'
updated_at = <Date 2022-02-08.16:46:38.005>
user = 'https://github.com/abalkin'

bugs.python.org fields:

activity = <Date 2022-02-08.16:46:38.005>
actor = 'Alan.Williams'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2016-09-14.21:55:13.766>
creator = 'belopolsky'
dependencies = []
files = []
hgrepos = []
issue_num = 28159
keywords = ['easy']
message_count = 7.0
messages = ['276492', '281078', '281125', '281127', '281139', '281161', '412846']
nosy_count = 4.0
nosy_names = ['belopolsky', 'r.david.murray', 'Alan.Williams', 'Mariatta']
pr_nums = []
priority = 'normal'
resolution = None
stage = None
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue28159'
versions = ['Python 3.11']

@abalkin
Copy link
Member Author

abalkin commented Sep 14, 2016

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.

@abalkin abalkin added 3.7 (EOL) end of life stdlib Python modules in the Lib dir labels Sep 14, 2016
@Mariatta
Copy link
Member

Hi Alexander,

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

Thanks :)

@bitdancer
Copy link
Member

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.

@Mariatta
Copy link
Member

Thanks David :)
So, I found that isdst was never added as method signature in the docs, but it is mentioned in the paragraph.
https://docs.python.org/3.7/library/email.util.html?#email.utils.localtime

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?

@bitdancer
Copy link
Member

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 datetime.now().astimezone().

@abalkin
Copy link
Member Author

abalkin commented Nov 18, 2016

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.

@iritkatriel iritkatriel added easy 3.11 only security fixes and removed 3.7 (EOL) end of life labels Jan 11, 2022
@aw1231
Copy link
Mannequin

aw1231 mannequin commented Feb 8, 2022

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?

@ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue May 24, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Aug 30, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Sep 7, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Sep 8, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Sep 8, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Sep 8, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Sep 8, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Oct 7, 2022
alanfwilliams added a commit to alanfwilliams/cpython that referenced this issue Oct 21, 2022
@zware zware added 3.12 only security fixes and removed 3.11 only security fixes labels Mar 20, 2023
@terryjreedy
Copy link
Member

terryjreedy commented Mar 20, 2023

@aw1231 Thank you for sticking with the review process for a year to get this old issue to completion. Next time, please do not put gh-###### in the branch title as it triggers an unneeded duplicate report of every commit here on the issue. I believe anything else without gh- or a literal # prefix would not do this.

@alanfwilliams
Copy link
Contributor

Thanks to you both! I forgot about this! I'll be sure to format the branch properly next time. Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 only security fixes easy stdlib Python modules in the Lib dir topic-email
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants