Commit Graph

42536 Commits

Author SHA1 Message Date
Yury Selivanov 02a0a19206
bpo-32314: Implement asyncio.run() (#4852) 2017-12-14 09:42:21 -05:00
Mike 53f7a7c281 bpo-32297: Few misspellings found in Python source code comments. (#4803)
* Fix multiple typos in code comments

* Add spacing in comments (test_logging.py, test_math.py)

* Fix spaces at the beginning of comments in test_logging.py
2017-12-14 13:04:53 +02:00
Ivan Levkivskyi 5364b5cd75
bpo-32225: Implementation of PEP 562 (#4731)
Implement PEP 562: module __getattr__ and __dir__.
The implementation simply updates module_getattro and
module_dir.
2017-12-14 11:59:44 +01:00
Victor Stinner 9e7c136ad8
bpo-32302: Fix distutils bdist_wininst for CRT v142 (#4851)
CRT v142 is binary compatible with CRT v140.
2017-12-14 11:39:34 +01:00
Jelle Zijlstra 176baa326b bpo-30241: implement contextlib.AbstractAsyncContextManager (#1412) 2017-12-13 20:19:17 -05:00
Yury Selivanov bfbf04ef18
bpo-32296: Unbreak tests on Windows (#4850) 2017-12-13 17:28:41 -05:00
Yury Selivanov a70232f288
bpo-32296: Implement asyncio.get_event_loop and _get_running_loop in C. (#4827)
asyncio.get_event_loop(), and, subsequently asyncio._get_running_loop()
are one of the most frequently executed functions in asyncio.  They also
can't be sped up by third-party event loops like uvloop.

When implemented in C they become 4x faster.
2017-12-13 14:49:42 -05:00
Victor Stinner 981469794a
pythoninfo: Add builtins, test.support, ... (#4840)
Collect more info from builtins, resource, test.test_socket and
test.support modules.

Co-Authored-By: Christian Heimes <christian@python.org>
2017-12-13 17:27:40 +01:00
Andrew Svetlov 7a6706bf48
Fix couple typos (#4839) 2017-12-13 17:50:16 +02:00
Victor Stinner 91106cd9ff
bpo-29240: PEP 540: Add a new UTF-8 Mode (#855)
* Add -X utf8 command line option, PYTHONUTF8 environment variable
  and a new sys.flags.utf8_mode flag.
* If the LC_CTYPE locale is "C" at startup: enable automatically the
  UTF-8 mode.
* Add _winapi.GetACP(). encodings._alias_mbcs() now calls
  _winapi.GetACP() to get the ANSI code page
* locale.getpreferredencoding() now returns 'UTF-8' in the UTF-8
  mode. As a side effect, open() now uses the UTF-8 encoding by
  default in this mode.
* Py_DecodeLocale() and Py_EncodeLocale() now use the UTF-8 encoding
  in the UTF-8 Mode.
* Update subprocess._args_from_interpreter_flags() to handle -X utf8
* Skip some tests relying on the current locale if the UTF-8 mode is
  enabled.
* Add test_utf8mode.py.
* _Py_DecodeUTF8_surrogateescape() gets a new optional parameter to
  return also the length (number of wide characters).
* pymain_get_global_config() and pymain_set_global_config() now
  always copy flag values, rather than only copying if the new value
  is greater than the old value.
2017-12-13 12:29:09 +01:00
Antoine Pitrou fc5db95e00
Test atexit shutdown mechanism in a subprocess (#4828)
* Test atexit shutdown mechanism in a subprocess
2017-12-13 02:29:07 +01:00
Antoine Pitrou 317def9fdb bpo-17852: Revert incorrect fix based on misunderstanding of _Py_PyAtExit() semantics (#4826) 2017-12-13 01:39:26 +01:00
Victor Stinner 721e25c653
bpo-32101: Fix tests for PYTHONDEVMODE=1 (#4821)
test_asycio: remove also aio_path which was used when asyncio was
developed outside the stdlib.
2017-12-12 23:15:00 +01:00
Victor Stinner 747f48e2e9
bpo-32230: Set sys.warnoptions with -X dev (#4820)
Rather than supporting dev mode directly in the warnings module, this
instead adjusts the initialisation code to add an extra 'default'
entry to sys.warnoptions when dev mode is enabled.

This ensures that dev mode behaves *exactly* as if `-Wdefault` had
been passed on the command line, including in the way it interacts
with `sys.warnoptions`, and with other command line flags like `-bb`.

Fix also bpo-20361: have -b & -bb options take precedence over any
other warnings options.

Patch written by Nick Coghlan, with minor modifications of Victor Stinner.
2017-12-12 22:59:48 +01:00
Serhiy Storchaka b748e3b258
Fix improper use of re.escape() in tests. (#4814) 2017-12-12 19:21:50 +02:00
Serhiy Storchaka 0e069a1597
Fix implementation dependent assertion in test_plistlib. (#4813)
It is failed with an advanced optimizer.
2017-12-12 19:03:08 +02:00
Nitish Chandra 5ce0a2a100 bpo-31942: Document optional support of start and stop attributes in Sequence.index method (#4277) 2017-12-12 11:22:30 +01:00
Licht Takeuchi 2001900b0c bpo-32255: Always quote a single empty field when write into a CSV file. (#4769)
This allows to distinguish an empty row from a row consisting of a single empty field.
2017-12-12 11:57:06 +02:00
Terry Jan Reedy e570211406
Fix idlelib comment typos reported by Mike on pull request 4803. (#4807) 2017-12-11 22:59:08 -05:00
Łukasz Langa e56975351b
bpo-32227: functools.singledispatch supports registering via type annotations (#4733) 2017-12-11 13:56:31 -08:00
Andrew Svetlov 8874342cf3
bpo-32258: Replace 'yield from' to 'await' in asyncio docs (#4779)
* Replace 'yield from' to 'await' in asyncio docs

* Fix docstrings
2017-12-11 17:35:49 +02:00
Yury Selivanov abae67ebc2
Add asyncio.get_running_loop() function. (#4782) 2017-12-11 10:07:44 -05:00
Yury Selivanov 3e9751819a
bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785) 2017-12-11 10:04:40 -05:00
Yury Selivanov 9edad3c701
bpo-32272: Remove asyncio.async() function. (#4784) 2017-12-11 10:03:48 -05:00
Sanyam Khurana 1b74f9b77a bpo-22671: Clarify and test default read method implementations (#4568)
Original patch written by Martin Panter, enhanced by Sanyam Khurana.
2017-12-11 14:42:09 +01:00
Yury Selivanov 19d0d54809
bpo-32262: Fix f-string (#4787) 2017-12-10 19:52:53 -05:00
Yury Selivanov 6370f345e1
bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775) 2017-12-10 18:36:12 -05:00
Yury Selivanov c4d9df5fd7
Skip test_read_pty_output test on macOS for poll and select. (#4774)
Starting with 10.13.2 the test hangs forever.
2017-12-10 12:40:19 -05:00
Terry Jan Reedy f658641a05
Removed doubled 'bpo-'. (#4777) 2017-12-10 04:02:53 -05:00
Sanyam Khurana 780acc89bc bpo-31506: Improve the error message logic for class instantiation (GH-4740)
The error messages in `object.__new__` and `object.__init__` now aim
to point the user more directly at the name of the class being instantiated
in cases where they *haven't* been overridden (on the assumption that
the actual problem is a missing `__new__` or `__init__` definition in the
class body).

When they *have* been overridden, the errors still report themselves as
coming from object, on the assumption that the problem is with the call
up to the base class in the method implementation, rather than with the
way the constructor is being called.
2017-12-10 10:14:22 +10:00
Benjamin Peterson 42aa93b8ff
closes bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)
Python now supports checking bytecode cache up-to-dateness with a hash of the
source contents rather than volatile source metadata. See the PEP for details.

While a fairly straightforward idea, quite a lot of code had to be modified due
to the pervasiveness of pyc implementation details in the codebase. Changes in
this commit include:

- The core changes to importlib to understand how to read, validate, and
  regenerate hash-based pycs.

- Support for generating hash-based pycs in py_compile and compileall.

- Modifications to our siphash implementation to support passing a custom
  key. We then expose it to importlib through _imp.

- Updates to all places in the interpreter, standard library, and tests that
  manually generate or parse pyc files to grok the new format.

- Support in the interpreter command line code for long options like
  --check-hash-based-pycs.

- Tests and documentation for all of the above.
2017-12-09 10:26:52 -08:00
Andrew Svetlov 28d8d14013
bpo-32253: Deprecate with statement and bare await for asyncio locks (GH-4764)
* Add test for 'with (yield from lock)'
* Deprecate with statement for asyncio locks
* Document the deprecation
2017-12-09 20:00:05 +02:00
Andrew Svetlov 5f841b5538
bpo-32193: Convert asyncio to async/await usage (#4753)
* Convert asyncio/tasks.py to async/await

* Convert asyncio/queues.py to async/await

* Convert asyncio/test_utils.py to async/await

* Convert asyncio/base_subprocess.py to async/await

* Convert asyncio/subprocess.py to async/await

* Convert asyncio/streams.py to async/await

* Fix comments

* Convert asyncio/locks.py to async/await

* Convert asyncio.sleep to async def

* Add a comment

* Add missing news

* Convert stubs from AbstrctEventLoop to async functions

* Convert subprocess_shell/subprocess_exec

* Convert connect_read_pipe/connect_write_pip to async/await syntax

* Convert create_datagram_endpoint

* Convert create_unix_server/create_unix_connection

* Get rid of old style coroutines in unix_events.py

* Convert selector_events.py to async/await

* Convert wait_closed and create_connection

* Drop redundant line

* Convert base_events.py

* Code cleanup

* Drop redundant comments

* Fix indentation

* Add explicit tests for compatibility between old and new coroutines

* Convert windows event loop to use async/await

* Fix double awaiting of async function

* Convert asyncio/locks.py

* Improve docstring

* Convert tests to async/await

* Convert more tests

* Convert more tests

* Convert more tests

* Convert tests

* Improve test
2017-12-09 00:23:48 +02:00
Nitish Chandra ede157331b bpo-22589 Changed MIME type of .bmp to "image/bmp" (#4756)
Per rfc7903 this is the standard MIME type for this file format, and appears as such in the IANA MIME registry.
2017-12-08 07:48:44 -05:00
Garrett Berg a0374dd34a bpo-32208: update threading.Semaphore docs and add unit test (#4709)
* fix issue32208: update threading.Semaphore docs and add unit test to validate correct behavior

* add test for blocking

* Update threading.rst

* semaphore: remove documentation validation tests and move 'return value' test to BaseSemaphore
2017-12-07 20:04:26 +02:00
xdegaye 961dbe0548
bpo-32199: The getnode() ip getter now uses 'ip link' instead of 'ip link list' (GH-4696) 2017-12-07 12:59:13 +01:00
Pablo Galindo fb77e0d855 Fix hardcoded value in test_os.py (#4744) 2017-12-07 07:55:44 +01:00
Eric V. Smith 24e77f9265
Use raw strings for regex to avoid invalid escape sequences. (GH-4741) 2017-12-06 14:00:34 -05:00
Ned Deily 3f9a728d95 Update NEWS and pydoc topics. 2017-12-05 03:17:33 -05:00
Ned Deily b3edde8dd4
bpo-31380: Skip test_httpservers test_undecodable_file on macOS. (#4720)
The undecodable file name cannot be created on macOS APFS file systems.
2017-12-04 23:42:02 -05:00
Neil Schemenauer 8837dd092f
bpo-19610: Warn if distutils is provided something other than a list to some fields (#4685)
* Rather than raise TypeError, warn and call list() on the value.

* Fix tests, revise NEWS and whatsnew text.

* Revise documentation, a string is okay as well.

* Ensure 'requires' and 'obsoletes' are real lists.

* Test that requires and obsoletes are turned to lists.
2017-12-04 18:58:12 -08:00
Ivan Levkivskyi 29bc193210 [bpo-28556] Minor fixes for typing module (#4710) 2017-12-04 21:43:58 -05:00
Terry Jan Reedy 2c0c68d927
bpo-30928: update idlelib/NEWS.txt. (#4706) 2017-12-04 17:04:15 -05:00
Eric V. Smith f0db54a0a1
bpo-32214: Implement PEP 557: Data Classes (#4704) 2017-12-04 16:58:55 -05:00
Terry Jan Reedy 1e2fcac497
bpo-32207: Improve tk event exception tracebacks in IDLE. (#4703)
When tk event handling is driven by IDLE's run loop, a confusing
and distracting queue.EMPTY traceback context is no longer added
to tk event exception tracebacks.  The traceback is now the same
as when event handling is driven by user code.  Patch based on
a suggestion by Serhiy Storchaka.
2017-12-04 16:16:18 -05:00
Terry Jan Reedy 21255fc393
bpo-30928: Update idlelib/NEWS.txt to 2017 Dec 3. (#4701)
Patches are in 3.7.0a3 even if this update is not.
2017-12-04 14:48:25 -05:00
Serhiy Storchaka 70d56fb525
bpo-25054, bpo-1647489: Added support of splitting on zerowidth patterns. (#4471)
Also fixed searching patterns that could match an empty string.
2017-12-04 14:29:05 +02:00
Serhiy Storchaka e69fbb6a56
Fix a regression in uuid added in bpo-32107. (#4677)
uuid.get_node() always must return a stable result.
Also added a test for non-reproducibility of _random_getnode().
Original patch by Xavier de Gaye.
2017-12-04 11:51:55 +02:00
R. David Murray 85d5c18c9d
bpo-27240 Rewrite the email header folding algorithm. (#3488)
The original algorithm tried to delegate the folding to the tokens so
that those tokens whose folding rules differed could specify the
differences.  However, this resulted in a lot of duplicated code because
most of the rules were the same.

The new algorithm moves all folding logic into a set of functions
external to the token classes, but puts the information about which
tokens can be folded in which ways on the tokens...with the exception of
mime-parameters, which are a special case (which was not even
implemented in the old folder).

This algorithm can still probably be improved and hopefully simplified
somewhat.

Note that some of the test expectations are changed.  I believe the
changes are toward more desirable and consistent behavior: in general
when (re) folding a line the canonical version of the tokens is
generated, rather than preserving errors or extra whitespace.
2017-12-03 18:51:41 -05:00
Serhiy Storchaka 1fb72d2ad2
bpo-32137: The repr of deeply nested dict now raises a RecursionError (#4570)
instead of crashing due to a stack overflow.

This perhaps will fix similar problems in other extension types.
2017-12-03 22:12:11 +02:00