Skip to content
This repository was archived by the owner on Feb 13, 2025. It is now read-only.

Commit 643681c

Browse files
author
Anselm Kruis
committed
merge branch 3.5 just after tagging v3.5.1
2 parents 6961b07 + 0c398eb commit 643681c

File tree

117 files changed

+1743
-13542
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+1743
-13542
lines changed

.hgtags

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,3 +178,5 @@ cc15d736d860303b9da90d43cd32db39bab048df v3.5.0rc2
178178
66ed52375df802f9d0a34480daaa8ce79fc41313 v3.5.0rc3
179179
2d033fedfa7f1e325fd14ccdaa9cb42155da206f v3.5.0rc4
180180
374f501f4567b7595f2ad7798aa09afa2456bb28 v3.5.0
181+
948ef16a69513ba1ff15c9d7d0b012b949df4c80 v3.5.1rc1
182+
37a07cee5969e6d3672583187a73cf636ff28e1b v3.5.1

Doc/howto/clinic.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1249,18 +1249,18 @@ Here's the simplest example of a custom converter, from ``Modules/zlibmodule.c``
12491249

12501250
/*[python input]
12511251

1252-
class uint_converter(CConverter):
1252+
class capped_uint_converter(CConverter):
12531253
type = 'unsigned int'
1254-
converter = 'uint_converter'
1254+
converter = 'capped_uint_converter'
12551255

12561256
[python start generated code]*/
1257-
/*[python end generated code: checksum=da39a3ee5e6b4b0d3255bfef95601890afd80709]*/
1257+
/*[python end generated code: output=da39a3ee5e6b4b0d input=35521e4e733823c7]*/
12581258

1259-
This block adds a converter to Argument Clinic named ``uint``. Parameters
1260-
declared as ``uint`` will be declared as type ``unsigned int``, and will
1261-
be parsed by the ``'O&'`` format unit, which will call the ``uint_converter``
1262-
converter function.
1263-
``uint`` variables automatically support default values.
1259+
This block adds a converter to Argument Clinic named ``capped_uint``. Parameters
1260+
declared as ``capped_uint`` will be declared as type ``unsigned int``, and will
1261+
be parsed by the ``'O&'`` format unit, which will call the
1262+
``capped_uint_converter`` converter function. ``capped_uint`` variables
1263+
automatically support default values.
12641264

12651265
More sophisticated custom converters can insert custom C code to
12661266
handle initialization and cleanup.

Doc/library/ast.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ The abstract grammar is currently defined as follows:
104104
:mod:`ast` Helpers
105105
------------------
106106

107-
Apart from the node classes, :mod:`ast` module defines these utility functions
107+
Apart from the node classes, the :mod:`ast` module defines these utility functions
108108
and classes for traversing abstract syntax trees:
109109

110110
.. function:: parse(source, filename='<unknown>', mode='exec')

Doc/library/asyncio-eventloop.rst

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,16 @@ Run an event loop
2929

3030
.. method:: BaseEventLoop.run_forever()
3131

32-
Run until :meth:`stop` is called.
32+
Run until :meth:`stop` is called. If :meth:`stop` is called before
33+
:meth:`run_forever()` is called, this polls the I/O selector once
34+
with a timeout of zero, runs all callbacks scheduled in response to
35+
I/O events (and those that were already scheduled), and then exits.
36+
If :meth:`stop` is called while :meth:`run_forever` is running,
37+
this will run the current batch of callbacks and then exit. Note
38+
that callbacks scheduled by callbacks will not run in that case;
39+
they will run the next time :meth:`run_forever` is called.
40+
41+
.. versionchanged:: 3.5.1
3342

3443
.. method:: BaseEventLoop.run_until_complete(future)
3544

@@ -48,10 +57,10 @@ Run an event loop
4857

4958
Stop running the event loop.
5059

51-
Every callback scheduled before :meth:`stop` is called will run.
52-
Callbacks scheduled after :meth:`stop` is called will not run.
53-
However, those callbacks will run if :meth:`run_forever` is called
54-
again later.
60+
This causes :meth:`run_forever` to exit at the next suitable
61+
opportunity (see there for more details).
62+
63+
.. versionchanged:: 3.5.1
5564

5665
.. method:: BaseEventLoop.is_closed()
5766

@@ -61,7 +70,8 @@ Run an event loop
6170

6271
.. method:: BaseEventLoop.close()
6372

64-
Close the event loop. The loop must not be running.
73+
Close the event loop. The loop must not be running. Pending
74+
callbacks will be lost.
6575

6676
This clears the queues and shuts down the executor, but does not wait for
6777
the executor to finish.

Doc/library/asyncio-protocol.rst

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ BaseTransport
4141
protocol's :meth:`connection_lost` method will be called with
4242
:const:`None` as its argument.
4343

44+
.. method:: is_closing(self)
45+
46+
Return ``True`` if the transport is closing or is closed.
47+
48+
.. versionadded:: 3.5.1
4449

4550
.. method:: get_extra_info(name, default=None)
4651

@@ -489,7 +494,7 @@ data and wait until the connection is closed::
489494

490495
def connection_lost(self, exc):
491496
print('The server closed the connection')
492-
print('Stop the event lop')
497+
print('Stop the event loop')
493498
self.loop.stop()
494499

495500
loop = asyncio.get_event_loop()

Doc/library/asyncio-task.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -721,4 +721,4 @@ Task functions
721721
Unlike the functions above, :func:`run_coroutine_threadsafe` requires the
722722
*loop* argument to be passed explicitely.
723723

724-
.. versionadded:: 3.4.4
724+
.. versionadded:: 3.4.4, 3.5.1

Doc/library/collections.rst

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -905,15 +905,15 @@ functionality with a subclass. Here is how to add a calculated field and
905905
a fixed-width print format:
906906

907907
>>> class Point(namedtuple('Point', 'x y')):
908-
__slots__ = ()
909-
@property
910-
def hypot(self):
911-
return (self.x ** 2 + self.y ** 2) ** 0.5
912-
def __str__(self):
913-
return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)
908+
__slots__ = ()
909+
@property
910+
def hypot(self):
911+
return (self.x ** 2 + self.y ** 2) ** 0.5
912+
def __str__(self):
913+
return 'Point: x=%6.3f y=%6.3f hypot=%6.3f' % (self.x, self.y, self.hypot)
914914

915915
>>> for p in Point(3, 4), Point(14, 5/7):
916-
print(p)
916+
print(p)
917917
Point: x= 3.000 y= 4.000 hypot= 5.000
918918
Point: x=14.000 y= 0.714 hypot=14.018
919919

@@ -929,10 +929,10 @@ Docstrings can be customized by making direct assignments to the ``__doc__``
929929
fields:
930930

931931
>>> Book = namedtuple('Book', ['id', 'title', 'authors'])
932-
>>> Book.__doc__ = 'Hardcover book in active collection'
932+
>>> Book.__doc__ += ': Hardcover book in active collection'
933933
>>> Book.id.__doc__ = '13-digit ISBN'
934934
>>> Book.title.__doc__ = 'Title of first printing'
935-
>>> Book.author.__doc__ = 'List of authors sorted by last name'
935+
>>> Book.authors.__doc__ = 'List of authors sorted by last name'
936936

937937
Default values can be implemented by using :meth:`_replace` to
938938
customize a prototype instance:
@@ -942,16 +942,6 @@ customize a prototype instance:
942942
>>> johns_account = default_account._replace(owner='John')
943943
>>> janes_account = default_account._replace(owner='Jane')
944944

945-
Enumerated constants can be implemented with named tuples, but it is simpler
946-
and more efficient to use a simple :class:`~enum.Enum`:
947-
948-
>>> Status = namedtuple('Status', 'open pending closed')._make(range(3))
949-
>>> Status.open, Status.pending, Status.closed
950-
(0, 1, 2)
951-
>>> from enum import Enum
952-
>>> class Status(Enum):
953-
... open, pending, closed = range(3)
954-
955945

956946
.. seealso::
957947

Doc/library/copy.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ of lists by assigning a slice of the entire list, for example,
6767

6868
Classes can use the same interfaces to control copying that they use to control
6969
pickling. See the description of module :mod:`pickle` for information on these
70-
methods. In fact, :mod:`copy` module uses the registered pickle functions from
71-
:mod:`copyreg` module.
70+
methods. In fact, the :mod:`copy` module uses the registered
71+
pickle functions from the :mod:`copyreg` module.
7272

7373
.. index::
7474
single: __copy__() (copy protocol)

Doc/library/enum.rst

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -730,18 +730,24 @@ member instances.
730730
Finer Points
731731
^^^^^^^^^^^^
732732

733-
Enum members are instances of an Enum class, and even though they are
734-
accessible as `EnumClass.member`, they are not accessible directly from
735-
the member::
736-
737-
>>> Color.red
738-
<Color.red: 1>
739-
>>> Color.red.blue
740-
Traceback (most recent call last):
733+
:class:`Enum` members are instances of an :class:`Enum` class, and even
734+
though they are accessible as `EnumClass.member`, they should not be accessed
735+
directly from the member as that lookup may fail or, worse, return something
736+
besides the :class:`Enum` member you looking for::
737+
738+
>>> class FieldTypes(Enum):
739+
... name = 0
740+
... value = 1
741+
... size = 2
741742
...
742-
AttributeError: 'Color' object has no attribute 'blue'
743+
>>> FieldTypes.value.size
744+
<FieldTypes.size: 2>
745+
>>> FieldTypes.size.value
746+
2
747+
748+
.. versionchanged:: 3.5
743749

744-
Likewise, the :attr:`__members__` is only available on the class.
750+
The :attr:`__members__` attribute is only available on the class.
745751

746752
If you give your :class:`Enum` subclass extra methods, like the `Planet`_
747753
class above, those methods will show up in a :func:`dir` of the member,

Doc/library/fcntl.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ The module defines the following functions:
8383
buffer 1024 bytes long which is then passed to :func:`ioctl` and copied back
8484
into the supplied buffer.
8585

86+
If the :c:func:`ioctl` fails, an :exc:`IOError` exception is raised.
87+
8688
An example::
8789

8890
>>> import array, fcntl, struct, termios, os
@@ -104,6 +106,8 @@ The module defines the following functions:
104106
:manpage:`flock(2)` for details. (On some systems, this function is emulated
105107
using :c:func:`fcntl`.)
106108

109+
If the :c:func:`flock` fails, an :exc:`IOError` exception is raised.
110+
107111

108112
.. function:: lockf(fd, cmd, len=0, start=0, whence=0)
109113

0 commit comments

Comments
 (0)