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

Skip to content

Commit e21a531

Browse files
committed
merge with 3.4
2 parents fe98180 + a4c8c47 commit e21a531

24 files changed

Lines changed: 140 additions & 117 deletions

Doc/c-api/arg.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -429,10 +429,11 @@ API Functions
429429
430430
Function used to deconstruct the argument lists of "old-style" functions ---
431431
these are functions which use the :const:`METH_OLDARGS` parameter parsing
432-
method. This is not recommended for use in parameter parsing in new code, and
433-
most code in the standard interpreter has been modified to no longer use this
434-
for that purpose. It does remain a convenient way to decompose other tuples,
435-
however, and may continue to be used for that purpose.
432+
method, which has been removed in Python 3. This is not recommended for use
433+
in parameter parsing in new code, and most code in the standard interpreter
434+
has been modified to no longer use this for that purpose. It does remain a
435+
convenient way to decompose other tuples, however, and may continue to be
436+
used for that purpose.
436437
437438
438439
.. c:function:: int PyArg_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, ...)

Doc/extending/extending.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -867,11 +867,8 @@ reclaim the memory belonging to any objects in a reference cycle, or referenced
867867
from the objects in the cycle, even though there are no further references to
868868
the cycle itself.
869869

870-
The cycle detector is able to detect garbage cycles and can reclaim them so long
871-
as there are no finalizers implemented in Python (:meth:`__del__` methods).
872-
When there are such finalizers, the detector exposes the cycles through the
873-
:mod:`gc` module (specifically, the :attr:`~gc.garbage` variable in that module).
874-
The :mod:`gc` module also exposes a way to run the detector (the
870+
The cycle detector is able to detect garbage cycles and can reclaim them.
871+
The :mod:`gc` module exposes a way to run the detector (the
875872
:func:`~gc.collect` function), as well as configuration
876873
interfaces and the ability to disable the detector at runtime. The cycle
877874
detector is considered an optional component; though it is included by default,

Doc/library/cmd.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,8 +148,8 @@ A :class:`Cmd` instance has the following methods:
148148
Hook method executed once when :meth:`cmdloop` is about to return. This method
149149
is a stub in :class:`Cmd`; it exists to be overridden by subclasses.
150150

151-
Instances of :class:`Cmd` subclasses have some public instance variables:
152151

152+
Instances of :class:`Cmd` subclasses have some public instance variables:
153153

154154
.. attribute:: Cmd.prompt
155155

@@ -166,6 +166,13 @@ Instances of :class:`Cmd` subclasses have some public instance variables:
166166
The last nonempty command prefix seen.
167167

168168

169+
.. attribute:: Cmd.cmdqueue
170+
171+
A list of queued input lines. The cmdqueue list is checked in
172+
:meth:`cmdloop` when new input is needed; if it is nonempty, its elements
173+
will be processed in order, as if entered at the prompt.
174+
175+
169176
.. attribute:: Cmd.intro
170177

171178
A string to issue as an intro or banner. May be overridden by giving the

Doc/library/collections.abc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ particular functionality, for example::
134134

135135
Several of the ABCs are also useful as mixins that make it easier to develop
136136
classes supporting container APIs. For example, to write a class supporting
137-
the full :class:`Set` API, it only necessary to supply the three underlying
137+
the full :class:`Set` API, it is only necessary to supply the three underlying
138138
abstract methods: :meth:`__contains__`, :meth:`__iter__`, and :meth:`__len__`.
139139
The ABC supplies the remaining methods such as :meth:`__and__` and
140140
:meth:`isdisjoint`::

Doc/library/collections.rst

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -908,7 +908,7 @@ customize a prototype instance:
908908
>>> janes_account = default_account._replace(owner='Jane')
909909

910910
Enumerated constants can be implemented with named tuples, but it is simpler
911-
and more efficient to use a simple :class:`~enum.Enum` :
911+
and more efficient to use a simple :class:`~enum.Enum`:
912912

913913
>>> Status = namedtuple('Status', 'open pending closed')._make(range(3))
914914
>>> Status.open, Status.pending, Status.closed
@@ -917,6 +917,9 @@ and more efficient to use a simple :class:`~enum.Enum` :
917917
>>> class Status(Enum):
918918
... open, pending, closed = range(3)
919919

920+
921+
.. seealso::
922+
920923
* `Recipe for named tuple abstract base class with a metaclass mix-in
921924
<http://code.activestate.com/recipes/577629-namedtupleabc-abstract-base-class-mix-in-for-named/>`_
922925
by Jan Kaliszewski. Besides providing an :term:`abstract base class` for

Doc/library/ctypes.rst

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1833,7 +1833,7 @@ Utility functions
18331833
.. function:: find_msvcrt()
18341834
:module: ctypes.util
18351835

1836-
Windows only: return the filename of the VC runtype library used by Python,
1836+
Windows only: return the filename of the VC runtime library used by Python,
18371837
and by the extension modules. If the name of the library cannot be
18381838
determined, ``None`` is returned.
18391839

@@ -2335,11 +2335,6 @@ other data types containing pointer type fields.
23352335
and so on). Later assignments to the :attr:`_fields_` class variable will
23362336
raise an AttributeError.
23372337

2338-
Structure and union subclass constructors accept both positional and named
2339-
arguments. Positional arguments are used to initialize the fields in the
2340-
same order as they appear in the :attr:`_fields_` definition, named
2341-
arguments are used to initialize the fields with the corresponding name.
2342-
23432338
It is possible to defined sub-subclasses of structure types, they inherit
23442339
the fields of the base class plus the :attr:`_fields_` defined in the
23452340
sub-subclass, if any.

Doc/library/exceptions.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,8 @@ class or one of its subclasses, and not from :exc:`BaseException`. More
3434
information on defining exceptions is available in the Python Tutorial under
3535
:ref:`tut-userexceptions`.
3636

37-
When raising (or re-raising) an exception in an :keyword:`except` clause
37+
When raising (or re-raising) an exception in an :keyword:`except` or
38+
:keyword:`finally` clause
3839
:attr:`__context__` is automatically set to the last exception caught; if the
3940
new exception is not handled the traceback that is eventually displayed will
4041
include the originating exception(s) and the final exception.

Doc/library/functions.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ are always available. They are listed here in alphabetical order.
211211
The optional arguments *flags* and *dont_inherit* control which future
212212
statements (see :pep:`236`) affect the compilation of *source*. If neither
213213
is present (or both are zero) the code is compiled with those future
214-
statements that are in effect in the code that is calling compile. If the
214+
statements that are in effect in the code that is calling :func:`compile`. If the
215215
*flags* argument is given and *dont_inherit* is not (or is zero) then the
216216
future statements specified by the *flags* argument are used in addition to
217217
those that would be used anyway. If *dont_inherit* is a non-zero integer then
@@ -232,6 +232,9 @@ are always available. They are listed here in alphabetical order.
232232
This function raises :exc:`SyntaxError` if the compiled source is invalid,
233233
and :exc:`TypeError` if the source contains null bytes.
234234

235+
If you want to parse Python code into its AST representation, see
236+
:func:`ast.parse`.
237+
235238
.. note::
236239

237240
When compiling a string with multi-line code in ``'single'`` or
@@ -540,7 +543,7 @@ are always available. They are listed here in alphabetical order.
540543
effect as calling :func:`str(value) <str>`.
541544

542545
A call to ``format(value, format_spec)`` is translated to
543-
``type(value).__format__(format_spec)`` which bypasses the instance
546+
``type(value).__format__(value, format_spec)`` which bypasses the instance
544547
dictionary when searching for the value's :meth:`__format__` method. A
545548
:exc:`TypeError` exception is raised if the method search reaches
546549
:mod:`object` and the *format_spec* is non-empty, or if either the

Doc/library/inspect.rst

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -786,17 +786,20 @@ Classes and functions
786786
:func:`getargspec` or :func:`getfullargspec`.
787787

788788
The first seven arguments are (``args``, ``varargs``, ``varkw``,
789-
``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``). The
790-
other five arguments are the corresponding optional formatting functions
791-
that are called to turn names and values into strings. The last argument
792-
is an optional function to format the sequence of arguments. For example::
789+
``defaults``, ``kwonlyargs``, ``kwonlydefaults``, ``annotations``).
793790

794-
>>> from inspect import formatargspec, getfullargspec
795-
>>> def f(a: int, b: float):
796-
... pass
797-
...
798-
>>> formatargspec(*getfullargspec(f))
799-
'(a: int, b: float)'
791+
The other six arguments are functions that are called to turn argument names,
792+
``*`` argument name, ``**`` argument name, default values, return annotation
793+
and individual annotations into strings, respectively.
794+
795+
For example:
796+
797+
>>> from inspect import formatargspec, getfullargspec
798+
>>> def f(a: int, b: float):
799+
... pass
800+
...
801+
>>> formatargspec(*getfullargspec(f))
802+
'(a: int, b: float)'
800803

801804

802805
.. function:: formatargvalues(args[, varargs, varkw, locals, formatarg, formatvarargs, formatvarkw, formatvalue])

Doc/library/pydoc.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ The :mod:`pydoc` module automatically generates documentation from Python
2020
modules. The documentation can be presented as pages of text on the console,
2121
served to a Web browser, or saved to HTML files.
2222

23+
For modules, classes, functions and methods, the displayed documentation is
24+
derived from the docstring (i.e. the :attr:`__doc__` attribute) of the object,
25+
and recursively of its documentable members. If there is no docstring,
26+
:mod:`pydoc` tries to obtain a description from the block of comment lines just
27+
above the definition of the class, function or method in the source file, or at
28+
the top of the module (see :func:`inspect.getcomments`).
29+
2330
The built-in function :func:`help` invokes the online help system in the
2431
interactive interpreter, which uses :mod:`pydoc` to generate its documentation
2532
as text on the console. The same text documentation can also be viewed from

0 commit comments

Comments
 (0)