Commit Graph

17922 Commits

Author SHA1 Message Date
Ivan Levkivskyi 29fda8db16 bpo-28556: Updates to typing module (#2076)
This PR contains two updates to typing module:

- Support ContextManager on all versions (original PR by Jelle Zijlstra).
- Add generic AsyncContextManager.
2017-06-10 12:57:56 -07:00
Victor Stinner 1b7863c3b6 bpo-30595: Fix multiprocessing.Queue.get(timeout) (#2027)
multiprocessing.Queue.get() with a timeout now polls its reader in
non-blocking mode if it succeeded to aquire the lock but the acquire
took longer than the timeout.

Co-Authored-By: Grzegorz Grzywacz <grzgrzgrz3@gmail.com>
2017-06-10 13:10:13 +02:00
Roy Williams 171b9a354e bpo-30605: Fix compiling binary regexs with BytesWarnings enabled. (#2016)
Running our unit tests with `-bb` enabled triggered this failure.
2017-06-10 08:01:16 +03:00
Nikolay Kim a608d2d5a7 bpo-29406: asyncio SSL contexts leak sockets after calling close with certain servers (#409)
* asyncio SSL contexts leak sockets after calling close with certain servers

* cleanup _shutdown_timeout_handle on _fatal_error
2017-06-10 00:04:39 -04:00
Yury Selivanov 70fede100e Add a NEWS entry for #29870 (PR #981) (#2047) 2017-06-09 18:38:30 -04:00
Nikolay Kim a0e3d2dd09 Closing transport during handshake process leaks socket (#480) 2017-06-09 17:46:14 -04:00
Yury Selivanov 7be651c7aa bpo-27585: Add a NEWS entry for #1031 (#2036) 2017-06-09 16:34:29 -04:00
Giampaolo Rodola fbfaa6fd57 bpo-30014: make poll-like selector's modify() method faster (#1030)
* #30014: make selectors.DefaultSelector.modify() faster by relying on selector's modify() method instead of un/register()ing the fd

* #30014: add unit test

* speedup poll/epoll/devpoll modify() method by using internal modify() call

* update doc

* address PR comments

* update NEWS entries

* use != instead of 'is not'
2017-06-09 22:20:41 +02:00
Jelle Zijlstra 57161aac5e bpo-30266: support "= None" pattern in AbstractContextManager (#1448)
contextlib.AbstractContextManager now supports anti-registration
by setting __enter__ = None or __exit__ = None, following the pattern
introduced in bpo-25958.
2017-06-09 08:21:47 -07:00
Victor Stinner d52aa31378 bpo-30418: Popen.communicate() always ignore EINVAL (#2002)
On Windows, subprocess.Popen.communicate() now also ignore EINVAL
on stdin.write() if the child process is still running but closed the
pipe.
2017-06-08 17:30:39 +02:00
Lisa Roach 64505a1f6c bpo-30486: Allow setting cell value (#1840)
The cell_contents attribute of the cell object is now writable.
2017-06-08 14:43:26 +03:00
Will Roberts 0ecdc52514 bpo-30537: use PyNumber in itertools.islice instead of PyLong (#1918)
* bpo-30537: use PyNumber in itertools instead of PyLong

* bpo-30537: revert changes except to islice_new

* bpo-30537: test itertools.islice and add entry to Misc/NEWS
2017-06-07 23:03:04 -07:00
Aaron Hall, MBA ff48739ed0 bpo-30463: Add an empty __slots__ to abc.ABC. 2017-06-06 22:34:57 +03:00
Vinay Sajip 6260d9f203 bpo-30520: Implemented pickling for loggers. (#1956)
Implemented pickling for loggers.
2017-06-06 16:34:29 +01:00
Steve Dower e6a23c8f9a 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.
2017-06-05 15:54:15 -07:00
Antoine Pitrou 3c2817b688 Fix bpo-30526: Add TextIOWrapper.reconfigure() and a TextIOWrapper.write_through attribute (#1922)
* Fix bpo-30526: Add TextIOWrapper.reconfigure()

* Apply Nick's improved wording

* Update Misc/NEWS
2017-06-03 12:32:28 +02:00
Nick Coghlan 7a82f9c2b9 bpo-30052: Always regenerate cross-references (#1339)
* bpo-30052: Always regenerate cross-references

The patch for bpo-30052 changed the preferred link target
for :func:`bytes` and :func`bytearray` references to be the
respective type definitions rather than the corresponding
builtin function entries.

This patch changes the daily documentation builds to disable
the output caching in Sphinx, in order to ensure that
cross-reference changes like this one are reliably picked
up and applied automatically after merging.
2017-06-02 23:30:57 +10:00
Johan Liu aead53b6ee bpo-30245: Fix possible overflow when organize struct.pack_into error message (#1682) 2017-06-02 14:33:04 +08:00
Xiang Zhang 0b4b57df96 bpo-30378: Fix the problem that SysLogHandler can't handle IPv6 addresses (#1676) 2017-06-01 21:11:56 +08:00
Albert-Jan Nijburg fc354f0785 bpo-25324: copy tok_name before changing it (#1608)
* add test to check if were modifying token

* copy list so import tokenize doesnt have side effects on token

* shorten line

* add tokenize tokens to token.h to get them to show up in token

* move ERRORTOKEN back to its previous location, and fix nitpick

* copy comments from token.h automatically

* fix whitespace and make more pythonic

* change to fix comments from @haypo

* update token.rst and Misc/NEWS

* change wording

* some more wording changes
2017-05-31 16:00:21 +02:00
Antoine Pitrou f7ecfac0c1 Doc nits for bpo-16500 (#1841)
* Doc nits for bpo-16500

* Fix more references
2017-05-28 11:35:14 +02:00
xdegaye c0364fc7c2 bpo-20210: Support the *disabled* marker in Setup files (GH-132)
Extension modules listed after the *disabled* marker are not built at all,
neither by the Makefile nor by setup.py.
2017-05-27 18:25:03 +02:00
Antoine Pitrou 346cbd351e bpo-16500: Allow registering at-fork handlers (#1715)
* bpo-16500: Allow registering at-fork handlers

* Address Serhiy's comments

* Add doc for new C API

* Add doc for new Python-facing function

* Add NEWS entry + doc nit
2017-05-27 17:50:54 +02:00
Mariatta f931fd1c2a bpo-30470: Deprecate invalid ctypes call protection on Windows. (GH-1810)
Calling Ctypes functions is deprecated in 3.6.2 and will be removed in 3.7
2017-05-27 07:23:26 -07:00
grzgrzgrz3 bc50f03db4 bpo-30414: multiprocessing.Queue._feed do not break from main loop on exc (#1683)
* 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.
2017-05-25 16:22:57 +02:00
Serhiy Storchaka 0cd7a3f196 bpo-29104: Fixed parsing backslashes in f-strings. (#490) 2017-05-25 13:33:55 +03:00
Garvit Khatri 94987826e8 bpo-29851: Have importlib.reload() raise ImportError if the module's spec is not found (GH-972) 2017-05-24 15:19:50 -07:00
Eric Snow 6b4be195cd bpo-22257: Small changes for PEP 432. (#1728)
PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
2017-05-22 21:36:03 -07:00
Thomas Kluyver f9169ce6b4 bpo-25532: Protect against infinite loops in inspect.unwrap() (#1717)
Some objects (like test mocks) auto-generate new objects on
attribute access, which can lead to an infinite loop in
inspect.unwrap().

Ensuring references are retained to otherwise temporary objects
and capping the size of the memo dict turns this case into a
conventional exception instead.
2017-05-23 13:27:52 +10:00
Eric Snow e377416c10 bpo-29102: Add a unique ID to PyInterpreterState. (#1639) 2017-05-22 19:46:40 -07:00
T. Wouters ddbfa2c35b Add --with-assertions configure flag to enable C assertions(#1731)
Defaults to 'no', but as before assertions are implied by --with-pydebug.
2017-05-23 01:30:49 +02:00
Xiang Zhang 89a5e03244 bpo-30003: Fix handling escape characters in HZ codec (#1556) 2017-05-22 22:42:05 +08:00
Serhiy Storchaka 753bca3934 bpo-27945: Fixed various segfaults with dict. (#1657)
Based on patches by Duane Griffin and Tim Mitchell.
2017-05-20 12:30:02 +03:00
Serhiy Storchaka d896985bb2 bpo-25794: Fix `type.__setattr__()` for non-interned attribute names. (#1652)
Based on patch by Eryk Sun.
2017-05-20 08:48:06 +03:00
Nathaniel J. Smith ab4413a7e9 bpo-30039: Don't run signal handlers while resuming a yield from stack (#1081)
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.
2017-05-17 13:33:23 -07:00
Dong-hee Na 378d70642a bpo-30149: Fix partialmethod without explicit self parameter (#1308) 2017-05-17 12:00:51 -07:00
Xiang Zhang 6f75bc003a bpo-30301: Fix AttributeError when using SimpleQueue.empty() (#1601)
Under  *spawn* and *forkserver* start methods, SimpleQueue.empty() could
raise AttributeError due to not setting _poll in __setstate__.
2017-05-17 21:04:00 +08:00
Serhiy Storchaka d97b7dc94b bpo-30380: Fix Sphinx 1.6.1 warnings. (#1613)
* Use explicit numbering for footnotes referred by explicit number.
* Restore missed footnote reference in stdtypes.rst.
* Fix literal strings formatting in howto/urllib2.rst.
* Update susp-ignored.csv for zipapp.rst.
* Fix suspicious mark up in Misc/NEWS.
2017-05-16 23:18:09 +03:00
Serhiy Storchaka c7ac7280c3 bpo-30375: Correct the stacklevel of regex compiling warnings. (#1595)
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.
2017-05-16 15:16:15 +03:00
Victor Stinner 79ef7f8e88 bpo-30357: test_thread now uses threading_cleanup() (#1592)
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>
2017-05-15 17:55:32 +02:00
Victor Stinner 83a2c28798 bpo-30329: Catch Windows error 10022 on shutdown() (#1538)
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.
2017-05-15 17:33:45 +02:00
Serhiy Storchaka edef358ed6 bpo-29196: Removed old-deprecated classes Plist, Dict and _InternalDict (#488)
in the plistlib module.  Dict values in the result of functions
readPlist() and readPlistFromBytes() are now exact dicts.
2017-05-15 13:21:31 +03:00
Victor Stinner d812eb731d bpo-9850: Document macpath deprecation in Misc/NEWS (#1590) 2017-05-15 11:39:10 +02:00
Serhiy Storchaka 4ab6abfca4 bpo-30299: Display a bytecode when compile a regex in debug mode. (#1491)
`re.compile(..., re.DEBUG)` now displays the compiled bytecode in
human readable form.
2017-05-14 09:05:13 +03:00
Serhiy Storchaka 821a9d146b bpo-30340: Enhanced regular expressions optimization. (#1542)
This increased the performance of matching some patterns up to 25 times.
2017-05-14 08:32:33 +03:00
Serhiy Storchaka 7e19dbc92e bpo-28974: `object.__format__(x, '')` is now equivalent to `str(x)` (#506)
rather than `format(str(self), '')`.
2017-05-13 12:40:52 +03:00
INADA Naoki 991adca012 bpo-30048: asyncio: fix Task.cancel() was ignored. (GH-1097)
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
2017-05-11 21:18:38 +09:00
stratakis f6eae5bf1c bpo-28787: Fix out of tree --with-dtrace builds (#135)
* bpo-28787: Fix out of tree --with-dtrace builds

* Unsilence directory creation

* Add Misc/NEWS and Misc/ACKS entries
2017-05-10 17:08:15 +02:00
Serhiy Storchaka 305ccbe27e bpo-30298: Weaken the condition of deprecation warnings for inline modifiers. (#1490)
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)...').
2017-05-10 06:05:20 +03:00
Serhiy Storchaka 6d336a0279 bpo-30285: Optimize case-insensitive matching and searching (#1482)
of regular expressions.
2017-05-09 23:37:14 +03:00