@@ -1328,7 +1328,24 @@ standard Content Transfer Encodings.
13281328Other API Changes
13291329~~~~~~~~~~~~~~~~~
13301330
1331- Added :class: `email.parser.BytesHeaderParser `.
1331+ New :class: `~email.parser.BytesHeaderParser `, added to the :mod: `~email.parser `
1332+ module to complement :class: `~email.parser.HeaderParser ` and complete the Bytes
1333+ API.
1334+
1335+ New utility functions:
1336+
1337+ * :func: `~email.utils.format_datetime `: given a :class: `~datetime.datetime `,
1338+ produce a string formatted for use in an email header.
1339+
1340+ * :func: `~email.utils.parsedate_to_datetime `: given a date string from
1341+ an email header, convert it into an aware :class: `~datetime.datetime `,
1342+ or a naive :class: `~datetime.datetime ` if the offset is ``-0000 ``.
1343+
1344+ * :func: `~email.utils.localtime `: With no argument, returns the
1345+ current local time as an aware :class: `~datetime.datetime ` using the local
1346+ :class: `~datetime.timezone `. Given an aware :class: `~datetime.datetime `,
1347+ converts it into an aware :class: `~datetime.datetime ` using the
1348+ local :class: `~datetime.timezone `.
13321349
13331350
13341351ftplib
@@ -1453,8 +1470,14 @@ providing a user-supplied binary function.
14531470logging
14541471-------
14551472
1456- :func: `~logging.basicConfig ` now supports an optional ``handlers `` argument
1457- taking an iterable of handlers to be added to the root logger.
1473+ The :func: `~logging.basicConfig ` function now supports an optional ``handlers ``
1474+ argument taking an iterable of handlers to be added to the root logger.
1475+
1476+ A class level attribute :attr: `~logging.handlers.SysLogHandler.append_nul ` has
1477+ been added to :class: `~logging.handlers.SysLogHandler ` to allow control of the
1478+ appending of the ``NUL `` (``\000 ``) byte to syslog records, since for some
1479+ deamons it is required while for others it is passed through to the log.
1480+
14581481
14591482
14601483math
@@ -1466,6 +1489,15 @@ the base-2 logarithm of *x*.
14661489(Written by Mark Dickinson in :issue: `11888 `).
14671490
14681491
1492+ mmap
1493+ ----
1494+
1495+ The :meth: `~mmap.mmap.read ` method is now more compatible with other file-like
1496+ objects: if the argument is omitted or specified as ``None ``, it returns the
1497+ bytes from the current file position to the end of the mapping. (Contributed
1498+ by Petri Lehtinen in :issue: `12021 `.)
1499+
1500+
14691501multiprocessing
14701502---------------
14711503
@@ -1752,14 +1784,6 @@ signal
17521784 instead of a RuntimeError: OSError has an errno attribute.
17531785
17541786
1755- smtp
1756- ----
1757-
1758- :class: `~smtplib.SMTP ` now supports the context manager protocol, allowing an
1759- ``SMTP `` instance to be used in a ``with `` statement. (Contributed
1760- by Giampaolo Rodolà in :issue: `11289 `.)
1761-
1762-
17631787smtpd
17641788-----
17651789
@@ -1775,11 +1799,13 @@ Orrù and Dan Boswell. :issue:`8739`)
17751799smtplib
17761800-------
17771801
1802+ :class: `~smtplib.SMTP ` now supports the context manager protocol, allowing an
1803+ ``SMTP `` instance to be used in a ``with `` statement. (Contributed
1804+ by Giampaolo Rodolà in :issue: `11289 `.)
1805+
17781806The :class: `~smtplib.SMTP_SSL ` constructor and the :meth: `~smtplib.SMTP.starttls `
17791807method now accept an SSLContext parameter to control parameters of the secure
1780- channel.
1781-
1782- (Contributed by Kasun Herath in :issue: `8809 `)
1808+ channel. (Contributed by Kasun Herath in :issue: `8809 `)
17831809
17841810
17851811socket
@@ -1942,6 +1968,10 @@ Other new functions:
19421968 :func: `~time.clock_settime ` functions with ``CLOCK_xxx `` constants.
19431969 (Contributed by Victor Stinner in :issue: `10278 `)
19441970
1971+ To improve cross platform consistency, :func: `~time.sleep ` now raises a
1972+ :exc: `ValueError ` when passed a negative sleep value. Previously this was an
1973+ error on posix, but produced an infinite sleep on Windows.
1974+
19451975
19461976types
19471977-----
@@ -2283,9 +2313,16 @@ Porting Python code
22832313
22842314* The deprecated variable ``time.accept2dyear `` has been removed.
22852315
2286- * The undocumented internal helper class ``SSLFakeFile `` has been
2287- removed from :mod: `smtplib `, since its functionality has long been
2288- provided directly by :meth: `socket.socket.makefile `.
2316+ * The undocumented internal helper class ``SSLFakeFile `` has been removed
2317+ from :mod: `smtplib `, since its functionality has long been provided directly
2318+ by :meth: `socket.socket.makefile `.
2319+
2320+ * Passing a negative value to :func: `time.sleep ` on Windows now raises an
2321+ error instead of sleeping forever. It has always raised an error on posix.
2322+
2323+ * The ``ast.__version__ `` constant has been removed. If you need to
2324+ make decisions affected by the AST version, use :attr: `sys.version_info `
2325+ to make the decision.
22892326
22902327
22912328Porting C code
0 commit comments