arguments, return current time. Otherwise *dt* argument should be a
:class:`~datetime.datetime` instance, and it is converted to the local time
zone according to the system time zone database. If *dt* is naive (that
- is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time. The
- *isdst* parameter is ignored.
+ is, ``dt.tzinfo`` is ``None``), it is assumed to be in local time.
.. versionadded:: 3.3
Removed
=======
+email
+-----
+
+* The *isdst* parameter has been removed from :func:`email.utils.localtime`.
+ (Contributed by Hugo van Kemenade in :gh:`118798`.)
+
+Others
+------
+
* Using :data:`NotImplemented` in a boolean context will now raise a :exc:`TypeError`.
It had previously raised a :exc:`DeprecationWarning` since Python 3.9. (Contributed
by Jelle Zijlstra in :gh:`118767`.)
# better than not having it.
#
-def localtime(dt=None, isdst=None):
+def localtime(dt=None):
"""Return local time as an aware datetime object.
If called without arguments, return current time. Otherwise *dt*
argument should be a datetime instance, and it is converted to the
local time zone according to the system time zone database. If *dt* is
naive (that is, dt.tzinfo is None), it is assumed to be in local time.
- The isdst parameter is ignored.
"""
- if isdst is not None:
- import warnings
- warnings._deprecated(
- "The 'isdst' parameter to 'localtime'",
- message='{name} is deprecated and slated for removal in Python {remove}',
- remove=(3, 14),
- )
if dt is None:
dt = datetime.datetime.now()
return dt.astimezone()
t1 = utils.localtime(t0)
self.assertEqual(t1.tzname(), 'EET')
- def test_isdst_deprecation(self):
- with self.assertWarns(DeprecationWarning):
- t0 = datetime.datetime(1990, 1, 1)
- t1 = utils.localtime(t0, isdst=True)
# Issue #24836: The timezone files are out of date (pre 2011k)
# on Mac OS X Snow Leopard.
--- /dev/null
+The *isdst* parameter has been removed from :func:`email.utils.localtime`.
+Patch by Hugo van Kemenade.