Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c68acb1

Browse filesBrowse files
authored
gh-118798: Remove deprecated isdst parameter from email.utils.localtime (#118799)
1 parent fa9b9cb commit c68acb1
Copy full SHA for c68acb1

File tree

5 files changed

+13
-15
lines changed
Filter options

5 files changed

+13
-15
lines changed

‎Doc/library/email.utils.rst

Copy file name to clipboardExpand all lines: Doc/library/email.utils.rst
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@ module:
1717
arguments, return current time. Otherwise *dt* argument should be a
1818
:class:`~datetime.datetime` instance, and it is converted to the local time
1919
zone according to the system time zone database. If *dt* is naive (that
20-
is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time. The
21-
*isdst* parameter is ignored.
20+
is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time.
2221

2322
.. versionadded:: 3.3
2423

‎Doc/whatsnew/3.14.rst

Copy file name to clipboardExpand all lines: Doc/whatsnew/3.14.rst
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ Deprecated
101101
Removed
102102
=======
103103

104+
email
105+
-----
106+
107+
* The *isdst* parameter has been removed from :func:`email.utils.localtime`.
108+
(Contributed by Hugo van Kemenade in :gh:`118798`.)
109+
110+
Others
111+
------
112+
104113
* Using :data:`NotImplemented` in a boolean context will now raise a :exc:`TypeError`.
105114
It had previously raised a :exc:`DeprecationWarning` since Python 3.9. (Contributed
106115
by Jelle Zijlstra in :gh:`118767`.)

‎Lib/email/utils.py

Copy file name to clipboardExpand all lines: Lib/email/utils.py
+1-9Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,23 +466,15 @@ def collapse_rfc2231_value(value, errors='replace',
466466
# better than not having it.
467467
#
468468

469-
def localtime(dt=None, isdst=None):
469+
def localtime(dt=None):
470470
"""Return local time as an aware datetime object.
471471
472472
If called without arguments, return current time. Otherwise *dt*
473473
argument should be a datetime instance, and it is converted to the
474474
local time zone according to the system time zone database. If *dt* is
475475
naive (that is, dt.tzinfo is None), it is assumed to be in local time.
476-
The isdst parameter is ignored.
477476
478477
"""
479-
if isdst is not None:
480-
import warnings
481-
warnings._deprecated(
482-
"The 'isdst' parameter to 'localtime'",
483-
message='{name} is deprecated and slated for removal in Python {remove}',
484-
remove=(3, 14),
485-
)
486478
if dt is None:
487479
dt = datetime.datetime.now()
488480
return dt.astimezone()

‎Lib/test/test_email/test_utils.py

Copy file name to clipboardExpand all lines: Lib/test/test_email/test_utils.py
-4Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -154,10 +154,6 @@ def test_variable_tzname(self):
154154
t1 = utils.localtime(t0)
155155
self.assertEqual(t1.tzname(), 'EET')
156156

157-
def test_isdst_deprecation(self):
158-
with self.assertWarns(DeprecationWarning):
159-
t0 = datetime.datetime(1990, 1, 1)
160-
t1 = utils.localtime(t0, isdst=True)
161157

162158
# Issue #24836: The timezone files are out of date (pre 2011k)
163159
# on Mac OS X Snow Leopard.
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
The *isdst* parameter has been removed from :func:`email.utils.localtime`.
2+
Patch by Hugo van Kemenade.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.