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

Skip to content

Commit 4d9a729

Browse files
committed
merge
2 parents 9017ec1 + 0d5048c commit 4d9a729

40 files changed

Lines changed: 579 additions & 128 deletions

Doc/library/collections.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,7 @@ Named tuples assign meaning to each position in a tuple and allow for more reada
763763
self-documenting code. They can be used wherever regular tuples are used, and
764764
they add the ability to access fields by name instead of position index.
765765

766-
.. function:: namedtuple(typename, field_names, *, verbose=False, rename=False)
766+
.. function:: namedtuple(typename, field_names, *, verbose=False, rename=False, module=None)
767767

768768
Returns a new tuple subclass named *typename*. The new subclass is used to
769769
create tuple-like objects that have fields accessible by attribute lookup as
@@ -790,6 +790,9 @@ they add the ability to access fields by name instead of position index.
790790
built. This option is outdated; instead, it is simpler to print the
791791
:attr:`_source` attribute.
792792

793+
If *module* is defined, the ``__module__`` attribute of the named tuple is
794+
set to that value.
795+
793796
Named tuple instances do not have per-instance dictionaries, so they are
794797
lightweight and require no more memory than regular tuples.
795798

@@ -800,6 +803,8 @@ they add the ability to access fields by name instead of position index.
800803
The *verbose* and *rename* parameters became
801804
:ref:`keyword-only arguments <keyword-only_parameter>`.
802805

806+
.. versionchanged:: 3.6
807+
Added the *module* parameter.
803808

804809
.. doctest::
805810
:options: +NORMALIZE_WHITESPACE

Doc/library/dis.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,8 @@ iterations of the loop.
614614
or module body contains :term:`variable annotations <variable annotation>`
615615
statically.
616616

617+
.. versionadded:: 3.6
618+
617619
.. opcode:: IMPORT_STAR
618620

619621
Loads all symbols not starting with ``'_'`` directly from the module TOS to
@@ -900,6 +902,8 @@ All of the following opcodes use their arguments.
900902

901903
Stores TOS as ``locals()['__annotations__'][co_names[namei]] = TOS``.
902904

905+
.. versionadded:: 3.6
906+
903907

904908
.. opcode:: LOAD_CLOSURE (i)
905909

Doc/library/idle.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,9 @@ View Last Restart
226226
Restart Shell
227227
Restart the shell to clean the environment.
228228

229+
Interrupt Execution
230+
Stop a running program.
231+
229232
Debug menu (Shell window only)
230233
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
231234

Doc/library/time.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ An explanation of some terminology and conventions is in order.
8383
and :attr:`tm_zone` attributes when platform supports corresponding
8484
``struct tm`` members.
8585

86+
.. versionchanged:: 3.6
87+
The :class:`struct_time` attributes :attr:`tm_gmtoff` and :attr:`tm_zone`
88+
are now available on all platforms.
89+
8690
* Use the following functions to convert between time representations:
8791

8892
+-------------------------+-------------------------+-------------------------+
@@ -566,10 +570,6 @@ The module defines the following functions and data items:
566570
:class:`struct_time`, or having elements of the wrong type, a
567571
:exc:`TypeError` is raised.
568572

569-
.. versionchanged:: 3.3
570-
:attr:`tm_gmtoff` and :attr:`tm_zone` attributes are available on platforms
571-
with C library supporting the corresponding fields in ``struct tm``.
572-
573573
.. function:: time()
574574

575575
Return the time in seconds since the epoch as a floating point number.

Doc/reference/expressions.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,8 +1315,9 @@ Identity comparisons
13151315
--------------------
13161316

13171317
The operators :keyword:`is` and :keyword:`is not` test for object identity: ``x
1318-
is y`` is true if and only if *x* and *y* are the same object. ``x is not y``
1319-
yields the inverse truth value. [#]_
1318+
is y`` is true if and only if *x* and *y* are the same object. Object identity
1319+
is determined using the :meth:`id` function. ``x is not y`` yields the inverse
1320+
truth value. [#]_
13201321

13211322

13221323
.. _booleans:

Lib/asyncio/base_subprocess.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,12 @@ def __repr__(self):
8787
def _start(self, args, shell, stdin, stdout, stderr, bufsize, **kwargs):
8888
raise NotImplementedError
8989

90+
def set_protocol(self, protocol):
91+
self._protocol = protocol
92+
93+
def get_protocol(self):
94+
return self._protocol
95+
9096
def is_closing(self):
9197
return self._closed
9298

Lib/asyncio/proactor_events.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,12 @@ def __repr__(self):
6666
def _set_extra(self, sock):
6767
self._extra['pipe'] = sock
6868

69+
def set_protocol(self, protocol):
70+
self._protocol = protocol
71+
72+
def get_protocol(self):
73+
return self._protocol
74+
6975
def is_closing(self):
7076
return self._closing
7177

Lib/asyncio/selector_events.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ def _test_selector_event(selector, fd, event):
3939
return bool(key.events & event)
4040

4141

42+
if hasattr(socket, 'TCP_NODELAY'):
43+
def _set_nodelay(sock):
44+
if (sock.family in {socket.AF_INET, socket.AF_INET6} and
45+
sock.type == socket.SOCK_STREAM and
46+
sock.proto == socket.IPPROTO_TCP):
47+
sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
48+
else:
49+
def _set_nodelay(sock):
50+
pass
51+
52+
4253
class BaseSelectorEventLoop(base_events.BaseEventLoop):
4354
"""Selector event loop.
4455
@@ -560,6 +571,12 @@ def __repr__(self):
560571
def abort(self):
561572
self._force_close(None)
562573

574+
def set_protocol(self, protocol):
575+
self._protocol = protocol
576+
577+
def get_protocol(self):
578+
return self._protocol
579+
563580
def is_closing(self):
564581
return self._closing
565582

@@ -635,6 +652,11 @@ def __init__(self, loop, sock, protocol, waiter=None,
635652
self._eof = False
636653
self._paused = False
637654

655+
# Disable the Nagle algorithm -- small writes will be
656+
# sent without waiting for the TCP ACK. This generally
657+
# decreases the latency (in some cases significantly.)
658+
_set_nodelay(self._sock)
659+
638660
self._loop.call_soon(self._protocol.connection_made, self)
639661
# only start reading when connection_made() has been called
640662
self._loop.call_soon(self._loop.add_reader,

Lib/asyncio/sslproto.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ def get_extra_info(self, name, default=None):
305305
"""Get optional transport information."""
306306
return self._ssl_protocol._get_extra_info(name, default)
307307

308+
def set_protocol(self, protocol):
309+
self._app_protocol = protocol
310+
311+
def get_protocol(self):
312+
return self._app_protocol
313+
308314
def is_closing(self):
309315
return self._closed
310316

Lib/asyncio/transports.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@ def close(self):
3333
"""
3434
raise NotImplementedError
3535

36+
def set_protocol(self, protocol):
37+
"""Set a new protocol."""
38+
raise NotImplementedError
39+
40+
def get_protocol(self):
41+
"""Return the current protocol."""
42+
raise NotImplementedError
43+
3644

3745
class ReadTransport(BaseTransport):
3846
"""Interface for read-only transports."""

0 commit comments

Comments
 (0)