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

Skip to content

Commit c506277

Browse files
committed
Merge 3.5 heads
2 parents 52e40cd + 336b37b commit c506277

2 files changed

Lines changed: 152 additions & 27 deletions

File tree

Doc/library/collections.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,3 +1157,7 @@ attribute.
11571157
be an instance of :class:`bytes`, :class:`str`, :class:`UserString` (or a
11581158
subclass) or an arbitrary sequence which can be converted into a string using
11591159
the built-in :func:`str` function.
1160+
1161+
.. versionchanged:: 3.5
1162+
New methods ``__getnewargs__``, ``__rmod__``, ``casefold``,
1163+
``format_map``, ``isprintable``, and ``maketrans``.

Doc/whatsnew/3.5.rst

Lines changed: 148 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,13 @@ Significantly Improved Library Modules:
112112
:issue:`16991`.
113113

114114
* You may now pass bytes to the :mod:`tempfile` module's APIs and it will
115-
return the temporary pathname as bytes instead of str. It also accepts
116-
a value of ``None`` on parameters where only str was accepted in the past to
117-
do the right thing based on the types of the other inputs. Two functions,
118-
:func:`gettempdirb` and :func:`gettempprefixb`, have been added to go along
119-
with this. This behavior matches that of the :mod:`os` APIs.
115+
return the temporary pathname as :class:`bytes` instead of :class:`str`.
116+
It also accepts a value of ``None`` on parameters where only str was
117+
accepted in the past to do the right thing based on the types of the
118+
other inputs. Two functions, :func:`gettempdirb` and
119+
:func:`gettempprefixb`, have been added to go along with this.
120+
This behavior matches that of the :mod:`os` APIs.
121+
(Contributed by Gregory P. Smith in :issue:`24230`.)
120122

121123
* :mod:`ssl` module gained support for Memory BIO, which decouples SSL
122124
protocol handling from network IO. (Contributed by Geert Jansen in
@@ -127,6 +129,10 @@ Significantly Improved Library Modules:
127129
:class:`~traceback.StackSummary`, and :class:`traceback.FrameSummary`.
128130
(Contributed by Robert Collins in :issue:`17911`.)
129131

132+
* Most of :func:`functools.lru_cache` machinery is now implemented in C.
133+
(Contributed by Matt Joiner, Alexey Kachayev, and Serhiy Storchaka
134+
in :issue:`14373`.)
135+
130136
Security improvements:
131137

132138
* SSLv3 is now disabled throughout the standard library.
@@ -428,14 +434,14 @@ not raise an exception:
428434
for the rationale);
429435

430436
* :mod:`select` functions: :func:`~select.devpoll.poll`,
431-
:func:`~select.epoll.poll`, :func:`~select.kqueue.control`,
432-
:func:`~select.poll.poll`, :func:`~select.select`;
437+
:func:`~select.epoll.poll`, :func:`~select.kqueue.control`,
438+
:func:`~select.poll.poll`, :func:`~select.select`;
433439

434440
* :func:`socket.socket` methods: :meth:`~socket.socket.accept`,
435441
:meth:`~socket.socket.connect` (except for non-blocking sockets),
436-
:meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`,
437-
:meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`,
438-
:meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`,
442+
:meth:`~socket.socket.recv`, :meth:`~socket.socket.recvfrom`,
443+
:meth:`~socket.socket.recvmsg`, :meth:`~socket.socket.send`,
444+
:meth:`~socket.socket.sendall`, :meth:`~socket.socket.sendmsg`,
439445
:meth:`~socket.socket.sendto`;
440446

441447
* :func:`signal.sigtimedwait`, :func:`signal.sigwaitinfo`;
@@ -556,6 +562,9 @@ Some smaller changes made to the core Python language are:
556562
* New Tajik :ref:`codec <standard-encodings>` ``koi8_t``. (Contributed by
557563
Serhiy Storchaka in :issue:`22681`.)
558564

565+
* Circular imports involving relative imports are now supported.
566+
(Contributed by Brett Cannon and Antoine Pitrou in :issue:`17636`.)
567+
559568

560569
New Modules
561570
===========
@@ -589,6 +598,11 @@ argparse
589598
:ref:`allow_abbrev` to ``False``.
590599
(Contributed by Jonathan Paugh, Steven Bethard, paul j3 and Daniel Eriksson.)
591600

601+
* New *allow_abbrev* parameter for :class:`~argparse.ArgumentParser` to
602+
allow long options to be abbreviated if the abbreviation is unambiguous.
603+
(Contributed by Jonathan Paugh, Steven Bethard, paul j3 and
604+
Daniel Eriksson in :issue:`14910`.)
605+
592606
bz2
593607
---
594608

@@ -628,6 +642,33 @@ collections
628642

629643
(Contributed by Berker Peksag in :issue:`24064`.)
630644

645+
* :class:`~collections.deque` has new methods:
646+
:meth:`~collections.deque.index`, :meth:`~collections.deque.insert`, and
647+
:meth:`~collections.deque.copy`. This allows deques to be registered as a
648+
:class:`~collections.abc.MutableSequence` and improves their
649+
substitutablity for lists.
650+
(Contributed by Raymond Hettinger :issue:`23704`.)
651+
652+
* :class:`~collections.UserString` now supports ``__getnewargs__``,
653+
``__rmod__``, ``casefold``, ``format_map``, ``isprintable``, and
654+
``maketrans`` methods.
655+
(Contributed by Joe Jevnik in :issue:`22189`.)
656+
657+
* :class:`collections.OrderedDict` is now implemented in C, which improves
658+
its performance between 4x to 100x times.
659+
(Contributed by Eric Snow in :issue:`16991`.)
660+
661+
collections.abc
662+
---------------
663+
664+
* New :class:`~collections.abc.Generator` abstract base class.
665+
(Contributed by Stefan Behnel in :issue:`24018`.)
666+
667+
* New :class:`~collections.abc.Coroutine`,
668+
:class:`~collections.abc.AsyncIterator`, and
669+
:class:`~collections.abc.AsyncIterable` abstract base classes.
670+
(Contributed by Yury Selivanov in :issue:`24184`.)
671+
631672
compileall
632673
----------
633674

@@ -672,7 +713,8 @@ difflib
672713
(Contributed by Berker Peksag in :issue:`2052`.)
673714

674715
* It's now possible to compare lists of byte strings with
675-
:func:`difflib.diff_bytes` (fixes a regression from Python 2).
716+
:func:`difflib.diff_bytes`. This fixes a regression from Python 2.
717+
(Contributed by Terry J. Reedy and Greg Ward in :issue:`17445`.)
676718

677719
distutils
678720
---------
@@ -711,9 +753,26 @@ email
711753
:rfc:`6532` and used with an SMTP server that supports the :rfc:`6531`
712754
``SMTPUTF8`` extension. (Contributed by R. David Murray in :issue:`24211`.)
713755

756+
faulthandler
757+
------------
758+
759+
* :func:`~faulthandler.enable`, :func:`~faulthandler.register`,
760+
:func:`~faulthandler.dump_traceback` and
761+
:func:`~faulthandler.dump_traceback_later` functions now accept file
762+
descriptors. (Contributed by Wei Wu in :issue:`23566`.)
763+
764+
functools
765+
---------
766+
767+
* Most of :func:`~functools.lru_cache` machinery is now implemented in C.
768+
(Contributed by Matt Joiner, Alexey Kachayev, and Serhiy Storchaka
769+
in :issue:`14373`.)
770+
714771
glob
715772
----
716773

774+
00002-5938667
775+
717776
* :func:`~glob.iglob` and :func:`~glob.glob` now support recursive search in
718777
subdirectories using the "``**``" pattern.
719778
(Contributed by Serhiy Storchaka in :issue:`13968`.)
@@ -805,6 +864,13 @@ inspect
805864
and :func:`~inspect.getinnerframes` now return a list of named tuples.
806865
(Contributed by Daniel Shahaf in :issue:`16808`.)
807866

867+
io
868+
--
869+
870+
* New Python implementation of :class:`io.FileIO` to make dependency on
871+
``_io`` module optional.
872+
(Contributed by Serhiy Storchaka in :issue:`21859`.)
873+
808874
ipaddress
809875
---------
810876

@@ -845,22 +911,37 @@ logging
845911
for HTTP connection.
846912
(Contributed by Alex Gaynor in :issue:`22788`.)
847913

914+
* :class:`~logging.handlers.QueueListener` now takes a *respect_handler_level*
915+
keyword argument which, if set to ``True``, will pass messages to handlers
916+
taking handler levels into account. (Contributed by Vinay Sajip.)
917+
848918
lzma
849919
----
850920

851921
* New option *max_length* for :meth:`~lzma.LZMADecompressor.decompress`
852922
to limit the maximum size of decompressed data.
853923
(Contributed by Martin Panter in :issue:`15955`.)
854924

855-
856925
math
857926
----
858927

859928
* :data:`math.inf` and :data:`math.nan` constants added. (Contributed by Mark
860929
Dickinson in :issue:`23185`.)
861-
* :func:`math.isclose` function added.
930+
931+
* New :func:`~math.isclose` function.
862932
(Contributed by Chris Barker and Tal Einat in :issue:`24270`.)
863933

934+
* New :func:`~math.gcd` function. The :func:`fractions.gcd` function now is
935+
deprecated.
936+
(Contributed by Mark Dickinson and Serhiy Storchaka in :issue:`22486`.)
937+
938+
operator
939+
--------
940+
941+
* :func:`~operator.attrgetter`, :func:`~operator.itemgetter`, and
942+
:func:`~operator.methodcaller` objects now support pickling.
943+
(Contributed by Josh Rosenberg and Serhiy Storchaka in :issue:`22955`.)
944+
864945
os
865946
--
866947

@@ -877,11 +958,15 @@ os
877958
now used when available. On OpenBSD 5.6 and newer, the C ``getentropy()``
878959
function is now used. These functions avoid the usage of an internal file
879960
descriptor.
961+
(Contributed by Victor Stinner in :issue:`22181`.)
880962

881963
* New :func:`os.get_blocking` and :func:`os.set_blocking` functions to
882964
get and set the blocking mode of file descriptors.
883965
(Contributed by Victor Stinner in :issue:`22054`.)
884966

967+
* :func:`~os.truncate` and :func:`~os.ftruncate` are now supported on
968+
Windows. (Contributed by Steve Dower in :issue:`23668`.)
969+
885970
os.path
886971
-------
887972

@@ -1034,6 +1119,9 @@ ssl
10341119
list of ciphers sent at handshake.
10351120
(Contributed by Benjamin Peterson in :issue:`23186`.)
10361121

1122+
* :func:`~ssl.match_hostname` now supports matching of IP addresses.
1123+
(Contributed by Antoine Pitrou in :issue:`23239`.)
1124+
10371125
socket
10381126
------
10391127

@@ -1099,6 +1187,13 @@ time
10991187
* The :func:`time.monotonic` function is now always available. (Contributed by
11001188
Victor Stinner in :issue:`22043`.)
11011189

1190+
timeit
1191+
------
1192+
1193+
* New command line option ``-u`` or ``--unit=U`` to specify a time unit for
1194+
the timer output. Supported options are ``usec``, ``msec``, or ``sec``.
1195+
(Contributed by Julian Gindi in :issue:`18983`.)
1196+
11021197
tkinter
11031198
-------
11041199

@@ -1118,6 +1213,11 @@ traceback
11181213
:class:`~traceback.StackSummary`, and :class:`traceback.FrameSummary`.
11191214
(Contributed by Robert Collins in :issue:`17911`.)
11201215

1216+
* :func:`~traceback.print_tb` and :func:`~traceback.print_stack` now support
1217+
negative values for the *limit* argument.
1218+
(Contributed by Dmitry Kazakov in :issue:`22619`.)
1219+
1220+
11211221
types
11221222
-----
11231223

@@ -1152,6 +1252,12 @@ unicodedata
11521252
* The :mod:`unicodedata` module now uses data from `Unicode 8.0.0
11531253
<http://unicode.org/versions/Unicode8.0.0/>`_.
11541254

1255+
unittest
1256+
--------
1257+
1258+
* New command line option ``--locals`` to show local variables in
1259+
tracebacks.
1260+
(Contributed by Robert Collins in :issue:`22936`.)
11551261

11561262
wsgiref
11571263
-------
@@ -1176,14 +1282,6 @@ xml.sax
11761282
:class:`~xml.sax.xmlreader.InputSource` object.
11771283
(Contributed by Serhiy Storchaka in :issue:`2175`.)
11781284

1179-
faulthandler
1180-
------------
1181-
1182-
* :func:`~faulthandler.enable`, :func:`~faulthandler.register`,
1183-
:func:`~faulthandler.dump_traceback` and
1184-
:func:`~faulthandler.dump_traceback_later` functions now accept file
1185-
descriptors. (Contributed by Wei Wu in :issue:`23566`.)
1186-
11871285
zipfile
11881286
-------
11891287

@@ -1194,6 +1292,14 @@ zipfile
11941292
creation) mode. (Contributed by Serhiy Storchaka in :issue:`21717`.)
11951293

11961294

1295+
Other module-level changes
1296+
==========================
1297+
1298+
* Many functions in modules :mod:`mmap`, :mod:`ossaudiodev`, :mod:`socket`,
1299+
:mod:`ssl`, and :mod:`codecs`, now accept writable bytes-like objects.
1300+
(Contributed by Serhiy Storchaka in :issue:`23001`.)
1301+
1302+
11971303
Optimizations
11981304
=============
11991305

@@ -1237,6 +1343,22 @@ The following performance enhancements have been added:
12371343
as fast as with ``ensure_ascii=True``.
12381344
(Contributed by Naoki Inada in :issue:`23206`.)
12391345

1346+
* :c:func:`PyObject_IsInstance` and :c:func:`PyObject_IsSubclass` have
1347+
been sped up in the common case that the second argument has metaclass
1348+
:class:`type`.
1349+
(Contributed Georg Brandl by in :issue:`22540`.)
1350+
1351+
* Method caching was slightly improved, yielding up to 5% performance
1352+
improvement in some benchmarks.
1353+
(Contributed by Antoine Pitrou in :issue:`22847`.)
1354+
1355+
* Objects from :mod:`random` module now use 2x less memory on 64-bit
1356+
builds.
1357+
(Contributed by Serhiy Storchaka in :issue:`23488`.)
1358+
1359+
* property() getter calls are up to 25% faster.
1360+
(Contributed by Joe Jevnik in :issue:`23910`.)
1361+
12401362

12411363
Build and C API Changes
12421364
=======================
@@ -1276,6 +1398,9 @@ Deprecated Python modules, functions and methods
12761398
* The :mod:`formatter` module has now graduated to full deprecation and is still
12771399
slated for removal in Python 3.6.
12781400

1401+
* :func:`~asyncio.async` was deprecated in favour of
1402+
:func:`~asyncio.ensure_future`.
1403+
12791404
* :mod:`smtpd` has in the past always decoded the DATA portion of email
12801405
messages using the ``utf-8`` codec. This can now be controlled by the new
12811406
*decode_data* keyword to :class:`~smtpd.SMTPServer`. The default value is
@@ -1323,12 +1448,6 @@ Deprecated functions and types of the C API
13231448
* None yet.
13241449

13251450

1326-
Deprecated features
1327-
-------------------
1328-
1329-
* None yet.
1330-
1331-
13321451
Removed
13331452
=======
13341453

@@ -1486,3 +1605,5 @@ Changes in the C API
14861605
:c:type:`PyTypeObject` was replaced with a
14871606
:c:member:`tp_as_async` slot. Refer to :ref:`coro-objects` for
14881607
new types, structures and functions.
1608+
1609+
* :c:member:`PyTypeObject.tp_finalize` is now part of stable ABI.

0 commit comments

Comments
 (0)