mirror of https://github.com/python/cpython
Branch merge
This commit is contained in:
commit
cf534817ad
|
@ -14,6 +14,7 @@ platform
|
|||
pybuilddir.txt
|
||||
pyconfig.h
|
||||
libpython*.a
|
||||
libpython*.so*
|
||||
python.exe
|
||||
python-gdb.py
|
||||
reflog.txt
|
||||
|
|
|
@ -37,6 +37,7 @@ build/
|
|||
config.log
|
||||
config.status
|
||||
libpython*.a
|
||||
libpython*.so*
|
||||
pybuilddir.txt
|
||||
pyconfig.h
|
||||
python
|
||||
|
|
|
@ -39,14 +39,13 @@ Parser/pgen.stamp$
|
|||
|
||||
syntax: glob
|
||||
libpython*.a
|
||||
libpython*.so*
|
||||
*.swp
|
||||
*.o
|
||||
*.pyc
|
||||
*.pyo
|
||||
*.pyd
|
||||
*.cover
|
||||
*.orig
|
||||
*.rej
|
||||
*~
|
||||
Lib/lib2to3/*.pickle
|
||||
Lib/test/data/*
|
||||
|
|
|
@ -203,6 +203,7 @@ docs@python.org), and we'll be glad to correct the problem.
|
|||
* Kalle Svensson
|
||||
* Jim Tittsler
|
||||
* David Turner
|
||||
* Sandro Tosi
|
||||
* Ville Vainio
|
||||
* Martijn Vries
|
||||
* Charles G. Waldman
|
||||
|
|
|
@ -72,8 +72,8 @@ setup script). Indirectly provides the :class:`distutils.dist.Distribution` and
|
|||
| | be built | :class:`distutils.core.Extension` |
|
||||
+--------------------+--------------------------------+-------------------------------------------------------------+
|
||||
| *classifiers* | A list of categories for the | The list of available |
|
||||
| | package | categorizations is at |
|
||||
| | | http://pypi.python.org/pypi?:action=list_classifiers. |
|
||||
| | package | categorizations is available on `PyPI |
|
||||
| | | <http://pypi.python.org/pypi?:action=list_classifiers>`_. |
|
||||
+--------------------+--------------------------------+-------------------------------------------------------------+
|
||||
| *distclass* | the :class:`Distribution` | A subclass of |
|
||||
| | class to use | :class:`distutils.core.Distribution` |
|
||||
|
|
|
@ -39,7 +39,7 @@ The Python standard library provides two different profilers:
|
|||
2. :mod:`profile`, a pure Python module whose interface is imitated by
|
||||
:mod:`cProfile`. Adds significant overhead to profiled programs. If you're
|
||||
trying to extend the profiler in some way, the task might be easier with this
|
||||
module. Copyright © 1994, by InfoSeek Corporation.
|
||||
module.
|
||||
|
||||
The :mod:`profile` and :mod:`cProfile` modules export the same interface, so
|
||||
they are mostly interchangeable; :mod:`cProfile` has a much lower overhead but
|
||||
|
@ -592,27 +592,3 @@ The resulting profiler will then call :func:`your_time_func`.
|
|||
functions should be used with care and should be as fast as possible. For the
|
||||
best results with a custom timer, it might be necessary to hard-code it in the C
|
||||
source of the internal :mod:`_lsprof` module.
|
||||
|
||||
|
||||
Copyright and License Notices
|
||||
=============================
|
||||
|
||||
Copyright © 1994, by InfoSeek Corporation, all rights reserved.
|
||||
|
||||
Permission to use, copy, modify, and distribute this Python software and its
|
||||
associated documentation for any purpose (subject to the restriction in the
|
||||
following sentence) without fee is hereby granted, provided that the above
|
||||
copyright notice appears in all copies, and that both that copyright notice and
|
||||
this permission notice appear in supporting documentation, and that the name of
|
||||
InfoSeek not be used in advertising or publicity pertaining to distribution of
|
||||
the software without specific, written prior permission. This permission is
|
||||
explicitly restricted to the copying and modification of the software to remain
|
||||
in Python, compiled Python, or other languages (such as C) wherein the modified
|
||||
or derived code is exclusively imported into a Python module.
|
||||
|
||||
INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT
|
||||
SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL
|
||||
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
|
||||
WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
|
||||
OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
|
|
@ -159,19 +159,25 @@ Directory and files operations
|
|||
|
||||
.. function:: move(src, dst)
|
||||
|
||||
Recursively move a file or directory to another location.
|
||||
Recursively move a file or directory (*src*) to another location (*dst*).
|
||||
|
||||
Uses :func:`os.rename` to perform the move. If it fails, for reasons such as
|
||||
when *src* and *dst* are on different filesystems or in case of windows where
|
||||
rename is not supported when *dst* exists, fallback to copying *src* (with
|
||||
:func:`copy2`) to the *dst* and then remove *src*.
|
||||
If the destination is a directory or a symlink to a directory, then *src* is
|
||||
moved inside that directory.
|
||||
|
||||
The destination directory must not already exist. If the destination already
|
||||
exists but is not a directory, it may be overwritten depending on
|
||||
:func:`os.rename` semantics.
|
||||
|
||||
If the destination is on the current filesystem, then :func:`os.rename` is
|
||||
used. Otherwise, *src* is copied (using :func:`copy2`) to *dst* and then
|
||||
removed.
|
||||
|
||||
|
||||
.. exception:: Error
|
||||
|
||||
This exception collects exceptions that raised during a multi-file operation. For
|
||||
:func:`copytree`, the exception argument is a list of 3-tuples (*srcname*,
|
||||
*dstname*, *exception*).
|
||||
This exception collects exceptions that are raised during a multi-file
|
||||
operation. For :func:`copytree`, the exception argument is a list of 3-tuples
|
||||
(*srcname*, *dstname*, *exception*).
|
||||
|
||||
|
||||
.. _shutil-example:
|
||||
|
@ -269,7 +275,7 @@ Archiving operations
|
|||
|
||||
.. function:: get_archive_formats()
|
||||
|
||||
Returns a list of supported formats for archiving.
|
||||
Return a list of supported formats for archiving.
|
||||
Each element of the returned sequence is a tuple ``(name, description)``
|
||||
|
||||
By default :mod:`shutil` provides these formats:
|
||||
|
@ -287,7 +293,7 @@ Archiving operations
|
|||
|
||||
.. function:: register_archive_format(name, function, [extra_args, [description]])
|
||||
|
||||
Registers an archiver for the format *name*. *function* is a callable that
|
||||
Register an archiver for the format *name*. *function* is a callable that
|
||||
will be used to invoke the archiver.
|
||||
|
||||
If given, *extra_args* is a sequence of ``(name, value)`` pairs that will be
|
||||
|
|
|
@ -492,36 +492,6 @@ The :mod:`http.cookies` module contains the following notice::
|
|||
PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
Profiling
|
||||
---------
|
||||
|
||||
The :mod:`profile` and :mod:`pstats` modules contain the following notice::
|
||||
|
||||
Copyright 1994, by InfoSeek Corporation, all rights reserved.
|
||||
Written by James Roskind
|
||||
|
||||
Permission to use, copy, modify, and distribute this Python software
|
||||
and its associated documentation for any purpose (subject to the
|
||||
restriction in the following sentence) without fee is hereby granted,
|
||||
provided that the above copyright notice appears in all copies, and
|
||||
that both that copyright notice and this permission notice appear in
|
||||
supporting documentation, and that the name of InfoSeek not be used in
|
||||
advertising or publicity pertaining to distribution of the software
|
||||
without specific, written prior permission. This permission is
|
||||
explicitly restricted to the copying and modification of the software
|
||||
to remain in Python, compiled Python, or other languages (such as C)
|
||||
wherein the modified or derived code is exclusively imported into a
|
||||
Python module.
|
||||
|
||||
INFOSEEK CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS. IN NO EVENT SHALL INFOSEEK CORPORATION BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
|
||||
CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
Execution tracing
|
||||
-----------------
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ c-api/sequence,,:i2,o[i1:i2]
|
|||
c-api/sequence,,:i2,o[i1:i2] = v
|
||||
c-api/sequence,,:i2,del o[i1:i2]
|
||||
c-api/unicode,,:end,str[start:end]
|
||||
distutils/apiref,,:action,http://pypi.python.org/pypi?:action=list_classifiers
|
||||
distutils/setupscript,,::,
|
||||
extending/embedding,,:numargs,"if(!PyArg_ParseTuple(args, "":numargs""))"
|
||||
extending/extending,,:set,"if (PyArg_ParseTuple(args, ""O:set_callback"", &temp)) {"
|
||||
|
|
|
|
@ -232,7 +232,7 @@ class IOBinding:
|
|||
# before being able to execute the code
|
||||
self.set_saved(False)
|
||||
self.text.mark_set("insert", "1.0")
|
||||
self.text.see("insert")
|
||||
self.text.yview("insert")
|
||||
self.updaterecentfileslist(filename)
|
||||
return True
|
||||
|
||||
|
|
|
@ -1,13 +1,9 @@
|
|||
"""Class for printing reports on profiled python code."""
|
||||
|
||||
# Class for printing reports on profiled python code. rev 1.0 4/1/94
|
||||
#
|
||||
# Written by James Roskind
|
||||
# Based on prior profile module by Sjoerd Mullender...
|
||||
# which was hacked somewhat by: Guido van Rossum
|
||||
|
||||
"""Class for profiling Python code."""
|
||||
|
||||
# Copyright Disney Enterprises, Inc. All Rights Reserved.
|
||||
# Licensed to PSF under a Contributor Agreement
|
||||
#
|
||||
|
|
|
@ -1219,6 +1219,14 @@ class Popen(object):
|
|||
os.close(errread)
|
||||
os.close(errpipe_read)
|
||||
|
||||
# When duping fds, if there arises a situation
|
||||
# where one of the fds is either 0, 1 or 2, it
|
||||
# is possible that it is overwritten (#12607).
|
||||
if c2pwrite == 0:
|
||||
c2pwrite = os.dup(c2pwrite)
|
||||
if errwrite == 0 or errwrite == 1:
|
||||
errwrite = os.dup(errwrite)
|
||||
|
||||
# Dup fds for child
|
||||
def _dup2(a, b):
|
||||
# dup2() removes the CLOEXEC flag but
|
||||
|
|
|
@ -1234,7 +1234,7 @@ class CodecsModuleTest(unittest.TestCase):
|
|||
def test_lookup_issue1813(self):
|
||||
# Issue #1813: under Turkish locales, lookup of some codecs failed
|
||||
# because 'I' is lowercased as "ı" (dotless i)
|
||||
oldlocale = locale.getlocale(locale.LC_CTYPE)
|
||||
oldlocale = locale.setlocale(locale.LC_CTYPE)
|
||||
self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
|
||||
try:
|
||||
locale.setlocale(locale.LC_CTYPE, 'tr_TR')
|
||||
|
|
|
@ -393,16 +393,16 @@ class TestMiscellaneous(unittest.TestCase):
|
|||
|
||||
def test_getsetlocale_issue1813(self):
|
||||
# Issue #1813: setting and getting the locale under a Turkish locale
|
||||
oldlocale = locale.getlocale()
|
||||
oldlocale = locale.setlocale(locale.LC_CTYPE)
|
||||
self.addCleanup(locale.setlocale, locale.LC_CTYPE, oldlocale)
|
||||
try:
|
||||
locale.setlocale(locale.LC_CTYPE, 'tr_TR')
|
||||
except locale.Error:
|
||||
# Unsupported locale on this system
|
||||
self.skipTest('test needs Turkish locale')
|
||||
loc = locale.getlocale()
|
||||
loc = locale.getlocale(locale.LC_CTYPE)
|
||||
locale.setlocale(locale.LC_CTYPE, loc)
|
||||
self.assertEqual(loc, locale.getlocale())
|
||||
self.assertEqual(loc, locale.getlocale(locale.LC_CTYPE))
|
||||
|
||||
|
||||
def test_main():
|
||||
|
|
|
@ -12,10 +12,12 @@ import os
|
|||
import pwd
|
||||
import shutil
|
||||
import stat
|
||||
import tempfile
|
||||
import unittest
|
||||
import warnings
|
||||
|
||||
_DUMMY_SYMLINK = '%s/dummy-symlink' % os.getenv('TMPDIR', '/tmp')
|
||||
_DUMMY_SYMLINK = os.path.join(tempfile.gettempdir(),
|
||||
support.TESTFN + '-dummy-symlink')
|
||||
|
||||
class PosixTester(unittest.TestCase):
|
||||
|
||||
|
|
|
@ -1106,6 +1106,64 @@ class POSIXProcessTestCase(BaseTestCase):
|
|||
for fd in temp_fds:
|
||||
os.close(fd)
|
||||
|
||||
def check_swap_fds(self, stdin_no, stdout_no, stderr_no):
|
||||
# open up some temporary files
|
||||
temps = [mkstemp() for i in range(3)]
|
||||
temp_fds = [fd for fd, fname in temps]
|
||||
try:
|
||||
# unlink the files -- we won't need to reopen them
|
||||
for fd, fname in temps:
|
||||
os.unlink(fname)
|
||||
|
||||
# save a copy of the standard file descriptors
|
||||
saved_fds = [os.dup(fd) for fd in range(3)]
|
||||
try:
|
||||
# duplicate the temp files over the standard fd's 0, 1, 2
|
||||
for fd, temp_fd in enumerate(temp_fds):
|
||||
os.dup2(temp_fd, fd)
|
||||
|
||||
# write some data to what will become stdin, and rewind
|
||||
os.write(stdin_no, b"STDIN")
|
||||
os.lseek(stdin_no, 0, 0)
|
||||
|
||||
# now use those files in the given order, so that subprocess
|
||||
# has to rearrange them in the child
|
||||
p = subprocess.Popen([sys.executable, "-c",
|
||||
'import sys; got = sys.stdin.read();'
|
||||
'sys.stdout.write("got %s"%got); sys.stderr.write("err")'],
|
||||
stdin=stdin_no,
|
||||
stdout=stdout_no,
|
||||
stderr=stderr_no)
|
||||
p.wait()
|
||||
|
||||
for fd in temp_fds:
|
||||
os.lseek(fd, 0, 0)
|
||||
|
||||
out = os.read(stdout_no, 1024)
|
||||
err = support.strip_python_stderr(os.read(stderr_no, 1024))
|
||||
finally:
|
||||
for std, saved in enumerate(saved_fds):
|
||||
os.dup2(saved, std)
|
||||
os.close(saved)
|
||||
|
||||
self.assertEqual(out, b"got STDIN")
|
||||
self.assertEqual(err, b"err")
|
||||
|
||||
finally:
|
||||
for fd in temp_fds:
|
||||
os.close(fd)
|
||||
|
||||
# When duping fds, if there arises a situation where one of the fds is
|
||||
# either 0, 1 or 2, it is possible that it is overwritten (#12607).
|
||||
# This tests all combinations of this.
|
||||
def test_swap_fds(self):
|
||||
self.check_swap_fds(0, 1, 2)
|
||||
self.check_swap_fds(0, 2, 1)
|
||||
self.check_swap_fds(1, 0, 2)
|
||||
self.check_swap_fds(1, 2, 0)
|
||||
self.check_swap_fds(2, 0, 1)
|
||||
self.check_swap_fds(2, 1, 0)
|
||||
|
||||
def test_surrogates_error_message(self):
|
||||
def prepare():
|
||||
raise ValueError("surrogate:\uDCff")
|
||||
|
|
|
@ -174,6 +174,22 @@ class OtherNetworkTests(unittest.TestCase):
|
|||
opener.open(request)
|
||||
self.assertEqual(request.get_header('User-agent'),'Test-Agent')
|
||||
|
||||
def test_sites_no_connection_close(self):
|
||||
# Some sites do not send Connection: close header.
|
||||
# Verify that those work properly. (#issue12576)
|
||||
|
||||
try:
|
||||
with urllib.request.urlopen('http://www.imdb.com') as res:
|
||||
pass
|
||||
except ValueError as e:
|
||||
self.fail("urlopen failed for sites not sending Connection:close")
|
||||
else:
|
||||
self.assertTrue(res)
|
||||
|
||||
req = urllib.request.urlopen('http://www.imdb.com')
|
||||
res = req.read()
|
||||
self.assertTrue(res)
|
||||
|
||||
def _test_urls(self, urls, handlers, retry=True):
|
||||
import time
|
||||
import logging
|
||||
|
|
|
@ -1134,11 +1134,11 @@ class AbstractHTTPHandler(BaseHandler):
|
|||
|
||||
try:
|
||||
h.request(req.get_method(), req.selector, req.data, headers)
|
||||
r = h.getresponse() # an HTTPResponse instance
|
||||
except socket.error as err:
|
||||
raise URLError(err)
|
||||
finally:
|
||||
except socket.error as err: # timeout error
|
||||
h.close()
|
||||
raise URLError(err)
|
||||
else:
|
||||
r = h.getresponse()
|
||||
|
||||
r.url = req.get_full_url()
|
||||
# This line replaces the .msg attribute of the HTTPResponse
|
||||
|
|
|
@ -41,6 +41,15 @@ Core and Builtins
|
|||
Library
|
||||
-------
|
||||
|
||||
- Issue #12607: In subprocess, fix issue where if stdin, stdout or stderr is
|
||||
given as a low fd, it gets overwritten.
|
||||
|
||||
- Issue #12590: IDLE editor window now always displays the first line
|
||||
when opening a long file. With Tk 8.5, the first line was hidden.
|
||||
|
||||
- Issue #12576: Fix urlopen behavior on sites which do not send (or obfuscates)
|
||||
Connection:close header.
|
||||
|
||||
- Issue #1813: Fix codec lookup under Turkish locales.
|
||||
|
||||
- Issue #12591: Improve support of "universal newlines" in the subprocess
|
||||
|
|
|
@ -69,6 +69,13 @@ static void child_exec(char *const exec_array[],
|
|||
}
|
||||
POSIX_CALL(close(errpipe_read));
|
||||
|
||||
/* When duping fds, if there arises a situation where one of the fds is
|
||||
either 0, 1 or 2, it is possible that it is overwritten (#12607). */
|
||||
if (c2pwrite == 0)
|
||||
POSIX_CALL(c2pwrite = dup(c2pwrite));
|
||||
if (errwrite == 0 || errwrite == 1)
|
||||
POSIX_CALL(errwrite = dup(errwrite));
|
||||
|
||||
/* Dup fds for child.
|
||||
dup2() removes the CLOEXEC flag but we must do it ourselves if dup2()
|
||||
would be a no-op (issue #10806). */
|
||||
|
|
|
@ -1102,7 +1102,7 @@ PyDoc_STRVAR(find__doc__,
|
|||
"B.find(sub[, start[, end]]) -> int\n\
|
||||
\n\
|
||||
Return the lowest index in B where subsection sub is found,\n\
|
||||
such that sub is contained within s[start,end]. Optional\n\
|
||||
such that sub is contained within B[start,end]. Optional\n\
|
||||
arguments start and end are interpreted as in slice notation.\n\
|
||||
\n\
|
||||
Return -1 on failure.");
|
||||
|
@ -1172,7 +1172,7 @@ PyDoc_STRVAR(rfind__doc__,
|
|||
"B.rfind(sub[, start[, end]]) -> int\n\
|
||||
\n\
|
||||
Return the highest index in B where subsection sub is found,\n\
|
||||
such that sub is contained within s[start,end]. Optional\n\
|
||||
such that sub is contained within B[start,end]. Optional\n\
|
||||
arguments start and end are interpreted as in slice notation.\n\
|
||||
\n\
|
||||
Return -1 on failure.");
|
||||
|
|
|
@ -1273,7 +1273,7 @@ PyDoc_STRVAR(find__doc__,
|
|||
"B.find(sub[, start[, end]]) -> int\n\
|
||||
\n\
|
||||
Return the lowest index in B where substring sub is found,\n\
|
||||
such that sub is contained within s[start:end]. Optional\n\
|
||||
such that sub is contained within B[start:end]. Optional\n\
|
||||
arguments start and end are interpreted as in slice notation.\n\
|
||||
\n\
|
||||
Return -1 on failure.");
|
||||
|
@ -1312,7 +1312,7 @@ PyDoc_STRVAR(rfind__doc__,
|
|||
"B.rfind(sub[, start[, end]]) -> int\n\
|
||||
\n\
|
||||
Return the highest index in B where substring sub is found,\n\
|
||||
such that sub is contained within s[start:end]. Optional\n\
|
||||
such that sub is contained within B[start:end]. Optional\n\
|
||||
arguments start and end are interpreted as in slice notation.\n\
|
||||
\n\
|
||||
Return -1 on failure.");
|
||||
|
|
|
@ -7587,7 +7587,7 @@ PyDoc_STRVAR(find__doc__,
|
|||
"S.find(sub[, start[, end]]) -> int\n\
|
||||
\n\
|
||||
Return the lowest index in S where substring sub is found,\n\
|
||||
such that sub is contained within s[start:end]. Optional\n\
|
||||
such that sub is contained within S[start:end]. Optional\n\
|
||||
arguments start and end are interpreted as in slice notation.\n\
|
||||
\n\
|
||||
Return -1 on failure.");
|
||||
|
@ -8513,7 +8513,7 @@ PyDoc_STRVAR(rfind__doc__,
|
|||
"S.rfind(sub[, start[, end]]) -> int\n\
|
||||
\n\
|
||||
Return the highest index in S where substring sub is found,\n\
|
||||
such that sub is contained within s[start:end]. Optional\n\
|
||||
such that sub is contained within S[start:end]. Optional\n\
|
||||
arguments start and end are interpreted as in slice notation.\n\
|
||||
\n\
|
||||
Return -1 on failure.");
|
||||
|
|
|
@ -833,7 +833,7 @@ AC_SUBST(HGVERSION)
|
|||
AC_SUBST(HGTAG)
|
||||
AC_SUBST(HGBRANCH)
|
||||
|
||||
if test -e $srcdir/.hg/00changelog.i
|
||||
if test -e $srcdir/.hg/dirstate
|
||||
then
|
||||
AC_CHECK_PROG(HAS_HG, hg, found, not-found)
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue