Commit Graph

41216 Commits

Author SHA1 Message Date
Zachary Ware 964c261dc9 [3.6] bpo-27425: Be more explicit in .gitattributes (GH-840) (GH-2083)
Also updates checked-in line endings on some files
2017-06-10 15:39:29 -05:00
Yury Selivanov 6e14fd2a14 [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409) (#2062)
* bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (#409)

(cherry picked from commit a608d2d5a7)

* [3.6] bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (GH-409)

* asyncio SSL contexts leak sockets after calling close with certain servers

* cleanup _shutdown_timeout_handle on _fatal_error.
(cherry picked from commit a608d2d5a7)
2017-06-10 10:00:45 -04:00
terryjreedy 12cbd87ac0 [3.6] bpo-30290: IDLE - pep8 names and tests for help-about (#2070)
(cherry picked from commit 054e09147a)

* bpo-30290: IDLE: Refactor help_about to PEP8 names (#1714)

Patch by Cheryl Sabella.
(cherry picked from commit 5a346d5dbc)

* IDLE test_help_about: edit and add test. (#1838)

Coverage is now 100%
(cherry picked from commit eca7da0f13)
2017-06-10 02:53:19 -04:00
Yury Selivanov 361362f3a0 [3.6] Fix TypeError is asyncio/proactor_events (GH-993) (#2061)
(cherry picked from commit 34792d25ab)
2017-06-10 00:15:28 -04:00
Mariatta 753422f6e3 bpo-30266: support "= None" pattern in AbstractContextManager (GH-1448) (GH-2054)
contextlib.AbstractContextManager now supports anti-registration
by setting __enter__ = None or __exit__ = None, following the pattern
introduced in bpo-25958..
(cherry picked from commit 57161aac5e)
2017-06-09 20:36:28 -07:00
Yury Selivanov fe9c7a0fd3 Break circular references when closing SSLTransport objects (#981) (#2049) 2017-06-09 19:14:35 -04:00
Yury Selivanov 7a16a4535d Closing transport during handshake process leaks socket (#480) (#2044) 2017-06-09 18:33:31 -04:00
Yury Selivanov fa7f519113 Fix waiter cancellation in asyncio.Lock (#1031) (#2037)
Avoid a deadlock when the waiter who is about to take the lock is
cancelled

Issue #27585
2017-06-09 17:07:48 -04:00
Yury Selivanov e89f95bfd0 [3.6] bpo-30039: Don't run signal handlers while resuming a yield from stack (GH-1081) (#1640)
If we have a chain of generators/coroutines that are 'yield from'ing
each other, then resuming the stack works like:

- call send() on the outermost generator
- this enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- which calls send() on the next generator
- which enters _PyEval_EvalFrameDefault, which re-executes the
  YIELD_FROM opcode
- ...etc.

However, every time we enter _PyEval_EvalFrameDefault, the first thing
we do is to check for pending signals, and if there are any then we
run the signal handler. And if it raises an exception, then we
immediately propagate that exception *instead* of starting to execute
bytecode. This means that e.g. a SIGINT at the wrong moment can "break
the chain" – it can be raised in the middle of our yield from chain,
with the bottom part of the stack abandoned for the garbage collector.

The fix is pretty simple: there's already a special case in
_PyEval_EvalFrameEx where it skips running signal handlers if the next
opcode is SETUP_FINALLY. (I don't see how this accomplishes anything
useful, but that's another story.) If we extend this check to also
skip running signal handlers when the next opcode is YIELD_FROM, then
that closes the hole – now the exception can only be raised at the
innermost stack frame.

This shouldn't have any performance implications, because the opcode
check happens inside the "slow path" after we've already determined
that there's a pending signal or something similar for us to process;
the vast majority of the time this isn't true and the new check
doesn't run at all..
(cherry picked from commit ab4413a7e9)
2017-06-09 17:06:39 -04:00
Victor Stinner b7577456c4 bpo-30524: Write unit tests for FASTCALL (#2022) (#2030)
Test C functions:

* _PyObject_FastCall()
* _PyObject_FastCallDict()
* _PyObject_FastCallKeywords()
(cherry picked from commit 3b5cf85edc)
2017-06-09 22:28:32 +02:00
terryjreedy bbeaccc76b [3.6] IDLE test_textview: add comments and test, increase coverage to 100% (GH-1641) (#2018)
(cherry picked from commit 295304d412)
2017-06-09 15:59:31 -04:00
Serhiy Storchaka 570b1c971c [3.6] bpo-30529: Fix errors for invalid whitespaces in f-string subexpressions. (GH-1888) (#2013)
'invalid character in identifier' now is raised instead of
'f-string: empty expression not allowed' if a subexpression contains
only whitespaces and they are not accepted by Python parser.
(cherry picked from commit 2e9cd58)
2017-06-09 00:38:06 +03:00
Victor Stinner b319d09ee4 bpo-30418: Popen.communicate() always ignore EINVAL (#2002) (#2004)
On Windows, subprocess.Popen.communicate() now also ignore EINVAL
on stdin.write() if the child process is still running but closed the
pipe.
(cherry picked from commit d52aa31378)
2017-06-08 23:14:07 +02:00
Denis Osipov ca1b66fd05 [3.6] bpo-30584: Fix test_os fails on non-English Windows (GH-1980) (#1999)
* Fix bpo-30584

* Adding a comment mentionning the bpo and explaining what is the identifier

* Add Denis Osipov to Misc/ACKS
(cherry picked from commit 897bba7563)
2017-06-08 14:02:05 +02:00
Antoine Pietri ceabf9acf0 bpo-30177: pathlib: include the full path in resolve(strict=False) (#1893) (#1985) 2017-06-07 10:18:56 -07:00
Nate 09b6c0c71e [3.6] bpo-29822: make inspect.isabstract() work during __init_subclass__ (#1979)
At the time when an abstract base class' __init_subclass__ runs,
ABCMeta.__new__ has not yet finished running, so in the presence of
__init_subclass__, inspect.isabstract() can no longer depend only on
TPFLAGS_IS_ABSTRACT.
(cherry picked from commit fcfe80ec25)
2017-06-07 07:21:34 +03:00
Nate 6fb12b5c43 bpo-29581: bpo-29581: Make ABCMeta.__new__ pass **kwargs to type.__new__ (GH-527) (GH-1282)
Many metaclasses in the standard library don't play nice with
__init_subclass__. This bug makes ABCMeta in particular with
__init_subclass__, which is an 80/20 solution for me personally.
AFAICT, a general solution to this problem requires updating all
metaclasses in the standard library to make sure they pass **kwargs to
type.__new__, whereas this PR only fixes ABCMeta. For context, see
https://bugs.python.org/issue29581.

* added a test combining ABCMeta and __init_subclass__
* Added NEWS item

(cherry picked from commit bd583ef985)

* [3.6] bpo-29581: Make ABCMeta.__new__ pass **kwargs to type.__new__ (GH-527)

Many metaclasses in the standard library don't play nice with
__init_subclass__. This bug makes ABCMeta in particular with
__init_subclass__, which is an 80/20 solution for me personally.
AFAICT, a general solution to this problem requires updating all
metaclasses in the standard library to make sure they pass **kwargs to
type.__new__, whereas this PR only fixes ABCMeta. For context, see
https://bugs.python.org/issue29581.

* added a test combining ABCMeta and __init_subclass__
* Added NEWS item.
(cherry picked from commit bd583ef985)

* **kwargs -> ``kwargs`` in attempts to fix the Travis build.

* Quote the **kwargs
2017-06-06 17:31:03 -07:00
Steve Dower 2bafc0dcca [3.6] bpo-30557: faulthandler now correctly filters and displays exception … (#1960)
* bpo-30557: faulthandler now correctly filters and displays exception codes on Windows (#1924)

* bpo-30557: faulthandler now correctly filters and displays exception codes on Windows

* Adds test for non-fatal exceptions.

* Adds bpo number to comment.

* bpo-30557: Fix test_faulthandler (#1969)

On Windows 8, 8.1 and 10 at least, the exit code is the exception
code (no bit is cleared).
2017-06-06 13:47:14 -07:00
Mariatta e1a60d9032 [3.6] bpo-30303: IDLE: Add _utest argument to textview (GH-1499) (#1916)
(cherry picked from commit ba365da9ce)
2017-06-06 11:56:59 -04:00
Zachary Ware 7e6d999b6c [3.6] Fix skipping test_UNC_path on AppVeyor due to a different error being raised (GH-1920)
We get `ERROR_BAD_NETPATH` (53) on AppVeyor which is translated to
ENOENT (2).
(cherry picked from commit 7a99625e0d)
2017-06-04 17:14:03 -05:00
Xiang Zhang 95b4da2be4 bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses (#1676) (#1903) 2017-06-01 22:20:27 +08:00
Mariatta 94d8261d1c [3.6] bpo-29960 _random.Random corrupted on exception in setstate(). … (#1287)
(cherry picked from commit 9616a82e78)
2017-05-27 07:20:24 -07:00
Serhiy Storchaka b52c68a5a3 [3.6] bpo-30398: Add a docstring for re.error. (GH-1647) (#1830)
Also document that some attributes may be None.
(cherry picked from commit 12d6b5d)
2017-05-27 16:37:40 +03:00
Antoine Pitrou 2783cc4262 [3.6] bpo-30414: multiprocessing.Queue._feed do not break from main loop on exc (GH-1683) (#1815)
* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc

Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.

* bpo-30414: multiprocesing.Queue._feed do not break from main loop on exc

Queue background running thread was not handling exceptions correctly.
Any exception occurred inside thread (putting unpickable object) cause
feeder to finish running. After that every message put into queue is
silently ignored.
(cherry picked from commit bc50f03db4)
2017-05-25 16:57:46 +02:00
Serhiy Storchaka 89a3102640 [3.6] bpo-29104: Fixed parsing backslashes in f-strings. (GH-490) (#1812)
(cherry picked from commit 0cd7a3f)
2017-05-25 14:18:55 +03:00
Stéphane Wirtel c3454f0e79 bpo-30394: Fix a socket leak in smtplib.SMTP.__init__() (#1700) (#1790) 2017-05-25 02:59:06 +08:00
Łukasz Langa 70705e3cdf [3.6] call remove_done_callback in finally section (GH-1688) (#1755)
(cherry picked from commit 21b3e04c13)
2017-05-23 00:36:23 -07:00
Vijay Kumar 762add7877 Fix spelling mistakes in tkinter.py (#1751)
Ran the docstrings through spell checker, and fixed spelling issues.
2017-05-23 09:14:02 +03:00
Łukasz Langa e8412e684e [3.6] bpo-23894: make lib2to3 recognize f-strings (GH-1733) (#1737)
Note: this doesn't unpack f-strings into the underlying JoinedStr AST.

Ideally we'd fully implement JoinedStr here but given its additional
complexity, I think this is worth bandaiding as is. This unblocks tools like
https://github.com/google/yapf to format 3.6 syntax using f-strings.
(cherry picked from commit 1b9530c536)
2017-05-22 22:23:29 -07:00
Łukasz Langa 1398b1bc7d [3.6] Make rb'' strings work in lib2to3 (GH-1724) (#1730)
This partially solves bpo-23894.
(cherry picked from commit 0c4aca54dc)
2017-05-22 16:35:15 -07:00
Xiang Zhang 54af41d42e bpo-30003: Fix handling escape characters in HZ codec (#1556) (#1719) 2017-05-23 01:03:00 +08:00
delirious-lettuce 0702cc01fa [3.6] Fix typos in multiple `.rst` files (GH-1668) (#1702)
(cherry picked from commit 3378b2062c)
2017-05-22 00:26:01 +03:00
Serhiy Storchaka cf5c1be8f6 [3.6] bpo-30415: Add new tests for the fnmatch module. (GH-1684) (#1694)
(cherry picked from commit 8175547)
2017-05-21 10:35:39 +03:00
Senthil Kumaran b5bf7e85b7 bpo-29976: urllib.parse clarify '' in scheme values. (GH-984) (GH-1692)
(cherry picked from commit 906f5330b9)
2017-05-20 23:23:03 -07:00
Serhiy Storchaka 564398af6c [3.6] bpo-27945: Fixed various segfaults with dict. (GH-1657) (#1677)
Based on patches by Duane Griffin and Tim Mitchell.
(cherry picked from commit 753bca3934)
2017-05-20 13:06:26 +03:00
Serhiy Storchaka 193f7e094f [3.6] bpo-25794: Fix `type.__setattr__()` for non-interned attribute names. (GH-1652) (#1673)
Based on patch by Eryk Sun.
(cherry picked from commit d896985bb2)
2017-05-20 10:23:31 +03:00
Victor Stinner 2773add19a bpo-27103: regrtest disables -W if -R is used (#1651) (#1656)
Workaround for a regrtest bug.
(cherry picked from commit fcdd9b6b7e)
2017-05-18 13:36:51 -07:00
Victor Stinner 44944b602a bpo-30387: Fix warning in test_threading (#1634) (#1636)
test_is_alive_after_fork() now joins directly the thread to avoid the
following warning added by bpo-30357:

Warning -- threading_cleanup() failed to cleanup 0 threads
after 2 sec (count: 0, dangling: 21)

Use also a different exit code to catch generic exit code 1.
(cherry picked from commit f8d05b3a24)
2017-05-17 14:49:38 -07:00
Senthil Kumaran 0d1727835f Remove unused variable in test_urllibnet. (#1598) (#1600)
(cherry picked from commit 1bd7d299bd)
2017-05-17 10:51:01 -07:00
Xiang Zhang 43d4c0329e bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601) (#1628)
Under *spawn* and *forkserver* start methods, SimpleQueue.empty() could
raise AttributeError due to not setting _poll in __setstate__.
2017-05-17 22:03:35 +08:00
Victor Stinner 460945f22a bpo-30273: update distutils.sysconfig for venv's created from Python (#1515) (#1625)
compiled out-of-tree (builddir != srcdir). (see also bpo-15366)
(cherry picked from commit dbdea629e2)
2017-05-16 17:58:02 -07:00
Victor Stinner 6b5b85aecf bpo-30357: test_thread now uses threading_cleanup() (#1592) (#1622)
test_thread: setUp() now uses support.threading_setup() and
support.threading_cleanup() to wait until threads complete to avoid
random side effects on following tests.

Co-Authored-By:  Grzegorz Grzywacz <grzegorz.grzywacz@nazwa.pl>
(cherry picked from commit 79ef7f8e88)
2017-05-16 17:06:14 -07:00
Victor Stinner aaa0536525 bpo-30329: Catch Windows error 10022 on shutdown() (#1538) (#1620)
Catch the Windows socket WSAEINVAL error (code 10022) in imaplib and
poplib on shutdown(SHUT_RDWR): An invalid operation was attempted

This error occurs sometimes on SSL connections.
(cherry picked from commit 83a2c28798)
2017-05-16 15:29:41 -07:00
Serhiy Storchaka 73fb45df04 [3.6] bpo-30375: Correct the stacklevel of regex compiling warnings. (GH-1595) (#1604)
Warnings emitted when compile a regular expression now always point
to the line in the user code.  Previously they could point into inners
of the re module if emitted from inside of groups or conditionals..
(cherry picked from commit c7ac7280c3)
2017-05-16 18:16:15 +03:00
Xiang Zhang 0ce1f7e02d bpo-30110: fix resource leak in test_asyncio.test_events (#1413) (#1584) 2017-05-15 13:17:01 +08:00
Victor Stinner d05f7fdf6c [3.6] bpo-30345: Update test_gdb.py and python-gdb.py from master (#1549)
* python-gdb.py supports method-wrapper

bpo-29367: python-gdb.py now supports also method-wrapper (wrapperobject)
objects.

(cherry picked from commit 611083331d)

* Update and enhance python-gdb.py

bpo-29259: Detect PyCFunction is the current frame, not only in the
older frame.
2017-05-13 00:21:50 +02:00
INADA Naoki 3dc7c52a9f bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1546)
when there are no more `await` or `yield (from)` before return in coroutine,
cancel was ignored.

example:

    async def coro():
        asyncio.Task.current_task().cancel()
        return 42
    ...
    res = await coro()  # should raise CancelledError

(cherry picked from commit 991adca012)
2017-05-11 21:56:42 +09:00
Victor Stinner 81ed537846 bpo-30320: test_eintr now uses pthread_sigmask() (#1523) (#1524)
Rewrite sigwaitinfo() and sigtimedwait() unit tests for EINTR using
pthread_sigmask() to fix a race condition between the child and the
parent process.

Remove the pipe which was used as a weak workaround against the race
condition.

sigtimedwait() is now tested with a child process sending a signal
instead of testing the timeout feature which is more unstable
(especially regarding to clock resolution depending on the platform).
(cherry picked from commit 211a392cc1)
2017-05-10 08:47:22 +02:00
Serhiy Storchaka 418d60a525 [3.6] bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (GH-1490) (#1525)
Now allowed several subsequential inline modifiers at the start of the
pattern (e.g. '(?i)(?s)...').  In verbose mode whitespaces and comments
now are allowed before and between inline modifiers (e.g.
'(?x) (?i) (?s)...')..
(cherry picked from commit 305ccbe27e)
2017-05-10 06:44:02 +03:00
Xiang Zhang 72e1b61da0 bpo-29990: Fix range checking in GB18030 decoder (#1495) (#1507)
When decoding a 4-byte GB18030 sequence, the first and third byte cannot exceed 0xFE.
2017-05-09 12:16:50 +08:00