Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 46a8b40

Browse files
committed
whatsnew/3.5: Edits
Patch by Elvis Pranskevichus
1 parent d7f65e5 commit 46a8b40

1 file changed

Lines changed: 129 additions & 10 deletions

File tree

Doc/whatsnew/3.5.rst

Lines changed: 129 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ CPython implementation improvements:
114114
* Builtin and extension modules are now initialized in a multi-phase process,
115115
which is similar to how Python modules are loaded. (:pep:`489`).
116116

117-
Significantly Improved Library Modules:
117+
Significantly improved library modules:
118118

119119
* :class:`collections.OrderedDict` is now implemented in C, which makes it
120120
4 to 100 times faster. (Contributed by Eric Snow in :issue:`16991`.)
@@ -432,7 +432,7 @@ PEP 475: Retry system calls failing with EINTR
432432

433433
:pep:`475` adds support for automatic retry of system calls failing with
434434
:py:data:`~errno.EINTR`: this means that user code doesn't have to deal with
435-
EINTR or :exc:`InterruptedError` manually, and should make it more robust
435+
``EINTR`` or :exc:`InterruptedError` manually, and should make it more robust
436436
against asynchronous signal reception.
437437

438438
Examples of functions which are now retried when interrupted by a signal
@@ -656,6 +656,13 @@ The :class:`~cgi.FieldStorage` class now supports the context management
656656
protocol. (Contributed by Berker Peksag in :issue:`20289`.)
657657

658658

659+
csv
660+
---
661+
662+
:meth:`Writer.writerow <csv.Writer.writerow>` now supports arbitrary iterables,
663+
not just sequences. (Contributed by Serhiy Storchaka in :issue:`23171`.)
664+
665+
659666
cmath
660667
-----
661668

@@ -709,10 +716,15 @@ methods to match corresponding methods of :class:`str`.
709716
collections.abc
710717
---------------
711718

719+
The :meth:`Sequence.index <collections.abc.Sequence.index>` method now
720+
accepts *start* and *stop* arguments to match the corresponding methods
721+
of :class:`tuple`, :class:`list`, etc.
722+
(Contributed by Devin Jeanpierre in :issue:`23086`.)
723+
712724
A new :class:`~collections.abc.Generator` abstract base class. (Contributed
713725
by Stefan Behnel in :issue:`24018`.)
714726

715-
New :class:`~collections.abc.Coroutine`,
727+
New :class:`~collections.abc.Awaitable` :class:`~collections.abc.Coroutine`,
716728
:class:`~collections.abc.AsyncIterator`, and
717729
:class:`~collections.abc.AsyncIterable` abstract base classes.
718730
(Contributed by Yury Selivanov in :issue:`24184`.)
@@ -726,6 +738,9 @@ sumultaneously to perform parallel bytecode compilation.
726738
The :func:`~compileall.compile_dir` function has a corresponding ``workers``
727739
parameter. (Contributed by Claudiu Popa in :issue:`16104`.)
728740

741+
Another new option, ``-r``, allows to control the maximum recursion
742+
level for subdirectories. (Contributed by Claudiu Popa in :issue:`19628`.)
743+
729744
The ``-q`` command line option can now be specified more than once, in
730745
which case all output, including errors, will be suppressed. The corresponding
731746
``quiet`` parameter in :func:`~compileall.compile_dir`,
@@ -742,6 +757,19 @@ The :meth:`Executor.map <concurrent.futures.Executor.map>` method now accepts a
742757
:meth:`~concurrent.futures.ProcessPoolExecutor` is used.
743758
(Contributed by Dan O'Reilly in :issue:`11271`.)
744759

760+
A number of workers in :class:`~concurrent.futures.ThreadPoolExecutor` is
761+
optional now. The default value equals to 5 times the number of CPUs.
762+
(Contributed by Claudiu Popa in :issue:`21527`.)
763+
764+
765+
configparser
766+
------------
767+
768+
Config parsers can be customized by providing a dictionary of converters in the
769+
constructor. All converters defined in config parser (either by subclassing or
770+
by providing in a constructor) will be available on all section proxies.
771+
(Contributed by Łukasz Langa in :issue:`18159`.)
772+
745773

746774
contextlib
747775
----------
@@ -761,6 +789,13 @@ and :envvar:`COLS` environment variables. This is useful for detecting
761789
manual screen resize. (Contributed by Arnon Yaari in :issue:`4254`.)
762790

763791

792+
dbm
793+
---
794+
795+
:func:`dumb.open <dbm.dumb.open>` always creates a new database when the flag
796+
has the value ``'n'``. (Contributed by Claudiu Popa in :issue:`18039`.)
797+
798+
764799
difflib
765800
-------
766801

@@ -818,6 +853,10 @@ of using encoded words. This allows ``Messages`` to be formatted according to
818853
``SMTPUTF8`` extension. (Contributed by R. David Murray in
819854
:issue:`24211`.)
820855

856+
:class:`email.mime.text.MIMEText` constructor now accepts a
857+
:class:`~email.charset.Charset` instance.
858+
(Contributed by Claude Paroz and Berker Peksag in :issue:`16324`.)
859+
821860

822861
enum
823862
----
@@ -860,12 +899,20 @@ search in subdirectories using the ``"**"`` pattern.
860899
(Contributed by Serhiy Storchaka in :issue:`13968`.)
861900

862901

902+
gzip
903+
----
904+
905+
The *mode* argument of :class:`~gzip.GzipFile` constructor now
906+
accepts ``"x"`` to request exclusive creation.
907+
(Contributed by Tim Heaney in :issue:`19222`.)
908+
909+
863910
heapq
864911
-----
865912

866913
Element comparison in :func:`~heapq.merge` can now be customized by
867-
passing a :term:`key function` in a new optional ``key`` keyword argument.
868-
A new optional ``reverse`` keyword argument can be used to reverse element
914+
passing a :term:`key function` in a new optional *key* keyword argument.
915+
A new optional *reverse* keyword argument can be used to reverse element
869916
comparison. (Contributed by Raymond Hettinger in :issue:`13742`.)
870917

871918

@@ -877,6 +924,18 @@ HTTP status codes, reason phrases and long descriptions written in English.
877924
(Contributed by Demian Brecht in :issue:`21793`.)
878925

879926

927+
http.client
928+
-----------
929+
930+
:meth:`HTTPConnection.getresponse() <http.client.HTTPConnection.getresponse>`
931+
now raises a :exc:`~http.client.RemoteDisconnected` exception when a
932+
remote server connection is closed unexpectedly. Additionally, if a
933+
:exc:`ConnectionError` (of which ``RemoteDisconnected``
934+
is a subclass) is raised, the client socket is now closed automatically,
935+
and will reconnect on the next request.
936+
(Contributed by Martin Panter in :issue:`3566`.)
937+
938+
880939
idlelib and IDLE
881940
----------------
882941

@@ -1006,7 +1065,18 @@ to sort the keys alphabetically. (Contributed by Berker Peksag
10061065
in :issue:`21650`.)
10071066

10081067
JSON decoder now raises :exc:`json.JSONDecodeError` instead of
1009-
:exc:`ValueError`. (Contributed by Serhiy Storchaka in :issue:`19361`.)
1068+
:exc:`ValueError` to provide better context information about the error.
1069+
(Contributed by Serhiy Storchaka in :issue:`19361`.)
1070+
1071+
1072+
linecache
1073+
---------
1074+
1075+
A new :func:`~linecache.lazycache` function can be used to capture information
1076+
about a non-file based module to permit getting its lines later via
1077+
:func:`~linecache.getline`. This avoids doing I/O until a line is actually
1078+
needed, without having to carry the module globals around indefinitely.
1079+
(Contributed by Robert Collins in :issue:`17911`.)
10101080

10111081

10121082
locale
@@ -1060,6 +1130,14 @@ function is now deprecated. (Contributed by Mark Dickinson and Serhiy
10601130
Storchaka in :issue:`22486`.)
10611131

10621132

1133+
multiprocessing
1134+
---------------
1135+
1136+
:func:`~multiprocessing.synchronized` objects now support the
1137+
:term:`context manager` protocol. (Contributed by Charles-François Natali in
1138+
:issue:`21565`.)
1139+
1140+
10631141
operator
10641142
--------
10651143

@@ -1155,6 +1233,10 @@ A new :meth:`POP3.utf8 <poplib.POP3.utf8>` command enables :rfc:`6856`
11551233
re
11561234
--
11571235

1236+
References and conditional references to groups with fixed length are now
1237+
allowed in lookbehind assertions.
1238+
(Contributed by Serhiy Storchaka in :issue:`9179`.)
1239+
11581240
The number of capturing groups in regular expression is no longer limited by
11591241
100. (Contributed by Serhiy Storchaka in :issue:`22437`.)
11601242

@@ -1400,8 +1482,9 @@ A new :func:`~sys.set_coroutine_wrapper` function allows setting a global
14001482
hook that will be called whenever a :term:`coroutine object <coroutine>`
14011483
is created by an :keyword:`async def` function. A corresponding
14021484
:func:`~sys.get_coroutine_wrapper` can be used to obtain a currently set
1403-
wrapper. Both functions are provisional, and are intended for debugging
1404-
purposes only. (Contributed by Yury Selivanov in :issue:`24017`.)
1485+
wrapper. Both functions are :term:`provisional <provisional package>`,
1486+
and are intended for debugging purposes only. (Contributed by Yury Selivanov
1487+
in :issue:`24017`.)
14051488

14061489
A new :func:`~sys.is_finalizing` function can be used to check if the Python
14071490
interpreter is :term:`shutting down <interpreter shutdown>`.
@@ -1430,6 +1513,11 @@ If set to ``False`` (the default, and the behavior in versions prior to 3.5),
14301513
they will be owned by the named user and group in the tarfile.
14311514
(Contributed by Michael Vogt and Eric Smith in :issue:`23193`.)
14321515

1516+
The :meth:`TarFile.list <tarfile.TarFile.list>` now accepts an optional
1517+
*members* keyword argument that can be set to a subset of the list returned
1518+
by :meth:`TarFile.getmembers <tarfile.TarFile.getmembers>`.
1519+
(Contributed by Serhiy Storchaka in :issue:`21549`.)
1520+
14331521

14341522
threading
14351523
---------
@@ -1535,6 +1623,18 @@ The :mod:`unicodedata` module now uses data from `Unicode 8.0.0
15351623
unittest
15361624
--------
15371625

1626+
The :meth:`TestLoader.loadTestsFromModule <unittest.TestLoader.loadTestsFromModule>`
1627+
method now accepts a keyword-only argument *pattern* which is passed to
1628+
``load_tests`` as the third argument. Found packages are now checked for
1629+
``load_tests`` regardless of whether their path matches *pattern*, because it
1630+
is impossible for a package name to match the default pattern.
1631+
(Contributed by Robert Collins and Barry A. Warsaw in :issue:`16662`.)
1632+
1633+
Unittest discovery errors now are exposed in
1634+
:data:`TestLoader.errors <unittest.TestLoader.errors>` attribute of the
1635+
:class:`~unittest.TestLoader` instance.
1636+
(Contributed by Robert Collins in :issue:`19746`.)
1637+
15381638
A new command line option ``--locals`` to show local variables in
15391639
tracebacks. (Contributed by Robert Collins in :issue:`22936`.)
15401640

@@ -1558,6 +1658,10 @@ The :class:`~unittest.mock.MagicMock` class now supports :meth:`__truediv__`,
15581658
(Contributed by Johannes Baiter in :issue:`20968`, and Håkan Lövdahl
15591659
in :issue:`23581` and :issue:`23568`.)
15601660

1661+
It is no longer necessary to explicitly pass ``create=True`` to the
1662+
:func:`~unittest.mock.patch` function when patching builtin names.
1663+
(Contributed by Kushal Das in :issue:`17660`.)
1664+
15611665

15621666
wsgiref
15631667
-------
@@ -1586,6 +1690,9 @@ SAX parsers now support a character stream of the
15861690
:class:`xmlreader.InputSource <xml.sax.xmlreader.InputSource>` object.
15871691
(Contributed by Serhiy Storchaka in :issue:`2175`.)
15881692

1693+
:func:`~xml.sax.parseString` now accepts a :class:`str` instance.
1694+
(Contributed by Serhiy Storchaka in :issue:`10590`.)
1695+
15891696

15901697
zipfile
15911698
-------
@@ -1808,6 +1915,7 @@ instead. In addition, the undocumented *LegalChars* parameter of
18081915
Passing a format string as keyword argument *format_string* to the
18091916
:meth:`~string.Formatter.format` method of the :class:`string.Formatter`
18101917
class has been deprecated.
1918+
(Contributed by Serhiy Storchaka in :issue:`23671`.)
18111919

18121920
The :func:`platform.dist` and :func:`platform.linux_distribution` functions
18131921
are now deprecated and will be removed in Python 3.7. Linux distributions use
@@ -1833,6 +1941,16 @@ The :mod:`inspect` :func:`~inspect.getfullargspec`,
18331941
Use of ``re.LOCALE`` flag with str patterns or ``re.ASCII`` is now
18341942
deprecated. (Contributed by Serhiy Storchaka in :issue:`22407`.)
18351943

1944+
Use of unrecognized special sequences consisting of ``'\'`` and an ASCII letter
1945+
in regular expression patterns and replacement patterns now raises a
1946+
deprecation warning and will be forbidden in Python 3.6.
1947+
(Contributed by Serhiy Storchaka in :issue:`23622`.)
1948+
1949+
The undocumented and unofficial *use_load_tests* default argument of the
1950+
:meth:`unittest.TestLoader.loadTestsFromModule` method now is
1951+
deprecated and ignored.
1952+
(Contributed by Robert Collins and Barry A. Warsaw in :issue:`16662`.)
1953+
18361954

18371955
Removed
18381956
=======
@@ -1853,8 +1971,8 @@ removed:
18531971

18541972
* The concept of ``.pyo`` files has been removed.
18551973

1856-
* The JoinableQueue class in the provisional asyncio module was deprecated
1857-
in 3.4.4 and is now removed.
1974+
* The JoinableQueue class in the provisional :mod:`asyncio` module was
1975+
deprecated in 3.4.4 and is now removed.
18581976
(Contributed by A. Jesse Jiryu Davis in :issue:`23464`.)
18591977

18601978

@@ -1925,6 +2043,7 @@ Changes in the Python API
19252043
an empty string. For compatibility use patterns that never match an empty
19262044
string (e.g. ``"x+"`` instead of ``"x*"``). Patterns that could only match
19272045
an empty string (such as ``"\b"``) now raise an error.
2046+
(Contributed by Serhiy Storchaka in :issue:`22818`.)
19282047

19292048
* The :class:`~http.cookies.Morsel` dict-like interface has been made self
19302049
consistent: morsel comparison now takes the :attr:`~http.cookies.Morsel.key`

0 commit comments

Comments
 (0)