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

Skip to content

Commit 325a102

Browse files
committed
Merge.
2 parents 46c686f + c836a28 commit 325a102

116 files changed

Lines changed: 1088 additions & 552 deletions

File tree

Some content is hidden

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

Doc/distutils/index.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,16 @@ the module developer's point of view, describing how to use the Distutils to
1212
make Python modules and extensions easily available to a wider audience with
1313
very little overhead for build/release/install mechanics.
1414

15+
.. note::
16+
17+
This guide only covers the basic tools for building and distributing
18+
extensions that are provided as part of this version of Python. Third
19+
party tools offer easier to use and more secure alternatives. Refer to the
20+
`quick recommendations section
21+
<https://python-packaging-user-guide.readthedocs.org/en/latest/current.html>`__
22+
in the Python Packaging User Guide for more information.
23+
24+
1525
.. toctree::
1626
:maxdepth: 2
1727
:numbered:

Doc/extending/index.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,15 @@ Python) that give the language its wide application range.
2121
For a detailed description of the whole Python/C API, see the separate
2222
:ref:`c-api-index`.
2323

24+
.. note::
25+
26+
This guide only covers the basic tools for creating extensions provided
27+
as part of this version of CPython. Third party tools may offer simpler
28+
alternatives. Refer to the `binary extensions section
29+
<https://python-packaging-user-guide.readthedocs.org/en/latest/extensions.html>`__
30+
in the Python Packaging User Guide for more information.
31+
32+
2433
.. toctree::
2534
:maxdepth: 2
2635
:numbered:

Doc/faq/programming.rst

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,35 +1607,44 @@ Modules
16071607
How do I create a .pyc file?
16081608
----------------------------
16091609

1610-
When a module is imported for the first time (or when the source is more recent
1611-
than the current compiled file) a ``.pyc`` file containing the compiled code
1612-
should be created in the same directory as the ``.py`` file.
1613-
1614-
One reason that a ``.pyc`` file may not be created is permissions problems with
1615-
the directory. This can happen, for example, if you develop as one user but run
1616-
as another, such as if you are testing with a web server. Creation of a .pyc
1617-
file is automatic if you're importing a module and Python has the ability
1618-
(permissions, free space, etc...) to write the compiled module back to the
1619-
directory.
1610+
When a module is imported for the first time (or when the source file has
1611+
changed since the current compiled file was created) a ``.pyc`` file containing
1612+
the compiled code should be created in a ``__pycache__`` subdirectory of the
1613+
directory containing the ``.py`` file. The ``.pyc`` file will have a
1614+
filename that starts with the same name as the ``.py`` file, and ends with
1615+
``.pyc``, with a middle component that depends on the particular ``python``
1616+
binary that created it. (See :pep:`3147` for details.)
1617+
1618+
One reason that a ``.pyc`` file may not be created is a permissions problem
1619+
with the directory containing the source file, meaning that the ``__pycache__``
1620+
subdirectory cannot be created. This can happen, for example, if you develop as
1621+
one user but run as another, such as if you are testing with a web server.
1622+
1623+
Unless the :envvar:`PYTHONDONTWRITEBYTECODE` environment variable is set,
1624+
creation of a .pyc file is automatic if you're importing a module and Python
1625+
has the ability (permissions, free space, etc...) to create a ``__pycache__``
1626+
subdirectory and write the compiled module to that subdirectory.
16201627

16211628
Running Python on a top level script is not considered an import and no
16221629
``.pyc`` will be created. For example, if you have a top-level module
1623-
``foo.py`` that imports another module ``xyz.py``, when you run ``foo``,
1624-
``xyz.pyc`` will be created since ``xyz`` is imported, but no ``foo.pyc`` file
1625-
will be created since ``foo.py`` isn't being imported.
1630+
``foo.py`` that imports another module ``xyz.py``, when you run ``foo`` (by
1631+
typing ``python foo.py`` as a shell command), a ``.pyc`` will be created for
1632+
``xyz`` because ``xyz`` is imported, but no ``.pyc`` file will be created for
1633+
``foo`` since ``foo.py`` isn't being imported.
16261634

1627-
If you need to create ``foo.pyc`` -- that is, to create a ``.pyc`` file for a module
1628-
that is not imported -- you can, using the :mod:`py_compile` and
1629-
:mod:`compileall` modules.
1635+
If you need to create a ``.pyc`` file for ``foo`` -- that is, to create a
1636+
``.pyc`` file for a module that is not imported -- you can, using the
1637+
:mod:`py_compile` and :mod:`compileall` modules.
16301638

16311639
The :mod:`py_compile` module can manually compile any module. One way is to use
16321640
the ``compile()`` function in that module interactively::
16331641

16341642
>>> import py_compile
16351643
>>> py_compile.compile('foo.py') # doctest: +SKIP
16361644

1637-
This will write the ``.pyc`` to the same location as ``foo.py`` (or you can
1638-
override that with the optional parameter ``cfile``).
1645+
This will write the ``.pyc`` to a ``__pycache__`` subdirectory in the same
1646+
location as ``foo.py`` (or you can override that with the optional parameter
1647+
``cfile``).
16391648

16401649
You can also automatically compile all files in a directory or directories using
16411650
the :mod:`compileall` module. You can do it from the shell prompt by running

Doc/install/index.rst

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,20 @@
2020
Finally, it might be useful to include all the material from my "Care
2121
and Feeding of a Python Installation" talk in here somewhere. Yow!
2222
23-
.. topic:: Abstract
23+
This document describes the Python Distribution Utilities ("Distutils") from the
24+
end-user's point-of-view, describing how to extend the capabilities of a
25+
standard Python installation by building and installing third-party Python
26+
modules and extensions.
2427

25-
This document describes the Python Distribution Utilities ("Distutils") from the
26-
end-user's point-of-view, describing how to extend the capabilities of a
27-
standard Python installation by building and installing third-party Python
28-
modules and extensions.
28+
29+
.. note::
30+
31+
This guide only covers the basic tools for installing extensions that are
32+
provided as part of this version of Python. Third party tools offer easier
33+
to use and more secure alternatives. Refer to the
34+
`quick recommendations section
35+
<https://python-packaging-user-guide.readthedocs.org/en/latest/current.html>`__
36+
in the Python Packaging User Guide for more information.
2937

3038

3139
.. _inst-intro:

Doc/library/bz2.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,11 @@ All of the classes in this module may safely be accessed from multiple threads.
9191
byte of data will be returned (unless at EOF). The exact number of bytes
9292
returned is unspecified.
9393

94+
.. note:: While calling :meth:`peek` does not change the file position of
95+
the :class:`BZ2File`, it may change the position of the underlying file
96+
object (e.g. if the :class:`BZ2File` was constructed by passing a file
97+
object for *filename*).
98+
9499
.. versionadded:: 3.3
95100

96101
.. versionchanged:: 3.1

Doc/library/gzip.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,11 @@ The module defines the following items:
113113
the call. The number of bytes returned may be more or less than
114114
requested.
115115

116+
.. note:: While calling :meth:`peek` does not change the file position of
117+
the :class:`GzipFile`, it may change the position of the underlying
118+
file object (e.g. if the :class:`GzipFile` was constructed with the
119+
*fileobj* parameter).
120+
116121
.. versionadded:: 3.2
117122

118123
.. versionchanged:: 3.1

Doc/library/importlib.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,13 @@ Functions
8282
derived from :func:`importlib.__import__`, including requiring the package
8383
from which an import is occurring to have been previously imported
8484
(i.e., *package* must already be imported). The most important difference
85-
is that :func:`import_module` returns the most nested package or module
86-
that was imported (e.g. ``pkg.mod``), while :func:`__import__` returns the
85+
is that :func:`import_module` returns the specified package or module
86+
(e.g. ``pkg.mod``), while :func:`__import__` returns the
8787
top-level package or module (e.g. ``pkg``).
8888

89+
.. versionchanged:: 3.3
90+
Parent packages are automatically imported.
91+
8992
.. function:: find_loader(name, path=None)
9093

9194
Find the loader for a module, optionally within the specified *path*. If the

Doc/library/lzma.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,11 @@ Reading and writing compressed files
9898
byte of data will be returned, unless EOF has been reached. The exact
9999
number of bytes returned is unspecified (the *size* argument is ignored).
100100

101+
.. note:: While calling :meth:`peek` does not change the file position of
102+
the :class:`LZMAFile`, it may change the position of the underlying
103+
file object (e.g. if the :class:`LZMAFile` was constructed by passing a
104+
file object for *filename*).
105+
101106

102107
Compressing and decompressing data in memory
103108
--------------------------------------------

Doc/library/mailbox.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@ programs, mail loss due to interruption of the program, or premature termination
15501550
due to malformed messages in the mailbox::
15511551

15521552
import mailbox
1553-
import email.Errors
1553+
import email.errors
15541554

15551555
list_names = ('python-list', 'python-dev', 'python-bugs')
15561556

@@ -1560,7 +1560,7 @@ due to malformed messages in the mailbox::
15601560
for key in inbox.iterkeys():
15611561
try:
15621562
message = inbox[key]
1563-
except email.Errors.MessageParseError:
1563+
except email.errors.MessageParseError:
15641564
continue # The message is malformed. Just leave it.
15651565

15661566
for name in list_names:

Doc/license.rst

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -845,3 +845,36 @@ used for the build::
845845
Jean-loup Gailly Mark Adler
846846
847847

848+
849+
libmpdec
850+
--------
851+
852+
The :mod:`_decimal` Module is built using an included copy of the libmpdec
853+
library unless the build is configured ``--with-system-libmpdec``::
854+
855+
Copyright (c) 2008-2016 Stefan Krah. All rights reserved.
856+
857+
Redistribution and use in source and binary forms, with or without
858+
modification, are permitted provided that the following conditions
859+
are met:
860+
861+
1. Redistributions of source code must retain the above copyright
862+
notice, this list of conditions and the following disclaimer.
863+
864+
2. Redistributions in binary form must reproduce the above copyright
865+
notice, this list of conditions and the following disclaimer in the
866+
documentation and/or other materials provided with the distribution.
867+
868+
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS "AS IS" AND
869+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
870+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
871+
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
872+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
873+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
874+
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
875+
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
876+
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
877+
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
878+
SUCH DAMAGE.
879+
880+

0 commit comments

Comments
 (0)