]> granicus.if.org Git - python/log
python
7 years agobpo-32355: Optimize asyncio.gather() (#4913)
Yury Selivanov [Tue, 19 Dec 2017 12:19:53 +0000 (07:19 -0500)]
bpo-32355: Optimize asyncio.gather() (#4913)

7 years agobpo-32357: Optimize asyncio.iscoroutine() for non-native coroutines (#4915)
Yury Selivanov [Tue, 19 Dec 2017 12:18:45 +0000 (07:18 -0500)]
bpo-32357: Optimize asyncio.iscoroutine() for non-native coroutines (#4915)

7 years agobpo-27456: Simplify sock type checks (#4922)
Yury Selivanov [Tue, 19 Dec 2017 11:44:37 +0000 (06:44 -0500)]
bpo-27456: Simplify sock type checks (#4922)

Recent sock.type fix (see bug 32331) makes sock.type checks simpler
in asyncio.

7 years agobpo-32030: Fix compiler warnings (#4921)
Victor Stinner [Tue, 19 Dec 2017 10:35:58 +0000 (11:35 +0100)]
bpo-32030: Fix compiler warnings (#4921)

Fix compiler warnings in Py_FinalizeEx(): only define variables if
they are needed, add #ifdef.

Other cleanup changes:

* _PyWarnings_InitWithConfig() is no more needed: call
  _PyWarnings_Init() instead.
* Inline pymain_init_main_interpreter() in its caller. This
  subfunction is no more justifed.

7 years agoImprove test coverage (#4924)
Andrew Svetlov [Tue, 19 Dec 2017 06:51:16 +0000 (08:51 +0200)]
Improve test coverage (#4924)

7 years agobpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877)
Yury Selivanov [Tue, 19 Dec 2017 01:02:54 +0000 (20:02 -0500)]
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877)

7 years agobpo-32030: Fix compilation on FreeBSD, #include <fenv.h> (#4919)
Victor Stinner [Mon, 18 Dec 2017 22:42:55 +0000 (23:42 +0100)]
bpo-32030: Fix compilation on FreeBSD, #include <fenv.h> (#4919)

* main.c: add missing #include <fenv.h> on FreeBSD
* indent also other #ifdef in main.c
* cleanup Programs/python.c

7 years agobpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914)
Yury Selivanov [Mon, 18 Dec 2017 22:03:23 +0000 (17:03 -0500)]
bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914)

7 years agobpo-32369: test_subprocess: Fix pass_fds check in test_close_fds() (#4920)
izbyshev [Mon, 18 Dec 2017 20:26:49 +0000 (03:26 +0700)]
bpo-32369: test_subprocess: Fix pass_fds check in test_close_fds() (#4920)

The last part of test_close_fds() doesn't match its own comment.
The following assertion always holds because fds_to_keep and open_fds
are disjoint by construction.

self.assertFalse(remaining_fds & fds_to_keep & open_fds,
                 "Some fds not in pass_fds were left open")

Fix the code to match the message in the assertion.

7 years agoAdd @asvetlov to asyncio codeowners (#4917)
Andrew Svetlov [Mon, 18 Dec 2017 16:20:42 +0000 (18:20 +0200)]
Add @asvetlov to asyncio codeowners (#4917)

7 years agobpo-32365: Fix a reference leak when compile __debug__. (#4916)
Serhiy Storchaka [Mon, 18 Dec 2017 12:29:12 +0000 (14:29 +0200)]
bpo-32365: Fix a reference leak when compile __debug__. (#4916)

It was introduced in bpo-27169.

7 years agobpo-19764: Implemented support for subprocess.Popen(close_fds=True) on Windows (...
Segev Finer [Mon, 18 Dec 2017 09:28:19 +0000 (11:28 +0200)]
bpo-19764: Implemented support for subprocess.Popen(close_fds=True) on Windows (#1218)

Even though Python marks any handles it opens as non-inheritable there
is still a race when using `subprocess.Popen` since creating a process
with redirected stdio requires temporarily creating inheritable handles.
By implementing support for `subprocess.Popen(close_fds=True)` we fix
this race.

In order to implement this we use PROC_THREAD_ATTRIBUTE_HANDLE_LIST
which is available since Windows Vista. Which allows to pass an explicit
list of handles to inherit when creating a process.

This commit also adds `STARTUPINFO.lpAttributeList["handle_list"]`
which can be used to control PROC_THREAD_ATTRIBUTE_HANDLE_LIST
directly.

7 years agobpo-29469: peephole: Remove const_stack (GH-4879)
INADA Naoki [Mon, 18 Dec 2017 06:52:54 +0000 (15:52 +0900)]
bpo-29469: peephole: Remove const_stack (GH-4879)

Constant folding was moved to AST optimizer.
But compiler may emit LOAD_CONSTs + BUILD_TUPLE.
For example, default arguments can be constant tuple
if all arguments are constant.

This commit makes peephole's tuple folding simple.
It doesn't support nested tuples because nested
tuples are folded by AST optimizer already.

7 years agobpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792)
Nathaniel J. Smith [Mon, 18 Dec 2017 04:10:18 +0000 (20:10 -0800)]
bpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792)

7 years agobpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907)
Yury Selivanov [Mon, 18 Dec 2017 01:19:47 +0000 (20:19 -0500)]
bpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907)

7 years agoadd 'extern' to pygetopt.h symbols, so then don't end up in comdat (#4909)
Benjamin Peterson [Sun, 17 Dec 2017 18:34:00 +0000 (10:34 -0800)]
add 'extern' to pygetopt.h symbols, so then don't end up in comdat (#4909)

bpo-32264

7 years agobpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)
Andrew Svetlov [Sun, 17 Dec 2017 14:41:30 +0000 (16:41 +0200)]
bpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)

* Use fastpath in asyncio.sleep if delay<0

* Add NEWS entry

7 years agobpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() (#4799)
Andrew Svetlov [Sat, 16 Dec 2017 19:58:38 +0000 (21:58 +0200)]
bpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() (#4799)

7 years agoFix PyObject_Hash signature in comment (#4905)
Andrew Svetlov [Sat, 16 Dec 2017 19:08:05 +0000 (21:08 +0200)]
Fix PyObject_Hash signature in comment (#4905)

7 years agoAdd tests for using PEP560 with classes implemented in C. (#4883)
Serhiy Storchaka [Sat, 16 Dec 2017 09:25:56 +0000 (11:25 +0200)]
Add tests for using PEP560 with classes implemented in C. (#4883)

Based on tests from #4878

7 years agobpo-32002: Refactor C locale coercion tests (GH-4369)
Nick Coghlan [Sat, 16 Dec 2017 08:51:19 +0000 (21:51 +1300)]
bpo-32002: Refactor C locale coercion tests (GH-4369)

Exactly which locale requests will end up giving
you the "C" locale is actually platform dependent.

A blank locale and "POSIX" will translate to "C"
on most Linux distros, but may not do so on other platforms, so this adjusts the way the tests are structured to better account for that.

This is an initial step towards fixing the current
test failure on Cygwin (hence the issue reference)

7 years agofix up signedness in PyImport_ExtendInittab (#4831)
Benjamin Peterson [Sat, 16 Dec 2017 07:42:33 +0000 (23:42 -0800)]
fix up signedness in PyImport_ExtendInittab (#4831)

As a result of 92a3c6f493ad411e4cf0acdf305ef4876aa90669, the compiler complains:

Python/import.c:2311:21: warning: comparison of integers of different signs: 'long' and 'unsigned long' [-Wsign-compare]
    if ((i + n + 1) <= PY_SSIZE_T_MAX / sizeof(struct _inittab)) {
         ~~~~~~~~~  ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This overflow is extremely unlikely to happen, but let's avoid undefined
behavior anyway.

7 years agobpo-29240, bpo-32030: Py_Main() re-reads config if encoding changes (#4899)
Victor Stinner [Sat, 16 Dec 2017 03:54:22 +0000 (04:54 +0100)]
bpo-29240, bpo-32030: Py_Main() re-reads config if encoding changes (#4899)

bpo-29240, bpo-32030: If the encoding change (C locale coerced or
UTF-8 Mode changed), Py_Main() now reads again the configuration with
the new encoding.

Changes:

* Add _Py_UnixMain() called by main().
* Rename pymain_free_pymain() to pymain_clear_pymain(), it can now be
  called multipled times.
* Rename pymain_parse_cmdline_envvars() to pymain_read_conf().
* Py_Main() now clears orig_argc and orig_argv at exit.
* Remove argv_copy2, Py_Main() doesn't modify argv anymore. There is
  no need anymore to get two copies of the wchar_t** argv.
* _PyCoreConfig: add coerce_c_locale and coerce_c_locale_warn.
* Py_UTF8Mode is now initialized to -1.
* Locale coercion (PEP 538) now respects -I and -E options.

7 years agobpo-27456: Ensure TCP_NODELAY is set on linux (#4231)
Yury Selivanov [Sat, 16 Dec 2017 00:32:25 +0000 (19:32 -0500)]
bpo-27456: Ensure TCP_NODELAY is set on linux (#4231)

7 years agobpo-32248: Implement importlib.abc.ResourceReader (GH-4892)
Brett Cannon [Sat, 16 Dec 2017 00:29:35 +0000 (16:29 -0800)]
bpo-32248: Implement importlib.abc.ResourceReader (GH-4892)

7 years agobpo-29240: Don't define decode_locale() on macOS (#4895)
Victor Stinner [Fri, 15 Dec 2017 22:06:17 +0000 (23:06 +0100)]
bpo-29240: Don't define decode_locale() on macOS (#4895)

Don't define decode_locale() nor encode_locale() on macOS or Android.

7 years agoMinor wording tweak for itertools documentation (#4893)
Raymond Hettinger [Fri, 15 Dec 2017 21:17:55 +0000 (13:17 -0800)]
Minor wording tweak for itertools documentation (#4893)

7 years agoF-strings docs: link to Format Specifiers (GH-4888)
Mariatta [Fri, 15 Dec 2017 18:07:01 +0000 (10:07 -0800)]
F-strings docs: link to Format Specifiers (GH-4888)

Link to the Format Specification Mini Language section from f-strings' documentation.

7 years agobpo-32294: Fix multiprocessing test_semaphore_tracker() (#4885)
Victor Stinner [Fri, 15 Dec 2017 15:29:24 +0000 (16:29 +0100)]
bpo-32294: Fix multiprocessing test_semaphore_tracker() (#4885)

Run the child process with -E option to ignore the PYTHONWARNINGS
environment variable.

7 years agobpo-32329: Add versionchanged to -R option doc (#4884)
Victor Stinner [Fri, 15 Dec 2017 15:29:01 +0000 (16:29 +0100)]
bpo-32329: Add versionchanged to -R option doc (#4884)

7 years agobpo-32265: Classify class and static methods of builtin types. (#4776)
Serhiy Storchaka [Fri, 15 Dec 2017 12:13:41 +0000 (14:13 +0200)]
bpo-32265: Classify class and static methods of builtin types. (#4776)

Add types.ClassMethodDescriptorType for unbound class methods.

7 years agobpo-30416: Protect the optimizer during constant folding. (#4860)
Serhiy Storchaka [Fri, 15 Dec 2017 12:11:43 +0000 (14:11 +0200)]
bpo-30416: Protect the optimizer during constant folding. (#4860)

It no longer spends much time doing complex calculations and no
longer consumes much memory for creating large constants that will
be dropped later.

This fixes also bpo-21074.

7 years agobpo-32240: Add the const qualifier to declarations of PyObject* array arguments....
Serhiy Storchaka [Fri, 15 Dec 2017 11:11:11 +0000 (13:11 +0200)]
bpo-32240: Add the const qualifier to declarations of PyObject* array arguments. (#4746)

7 years agobpo-27169: The __debug__ constant is now optimized out at compile time. (#4880)
Serhiy Storchaka [Fri, 15 Dec 2017 10:35:48 +0000 (12:35 +0200)]
bpo-27169: The __debug__ constant is now optimized out at compile time. (#4880)

This fixes also bpo-22091.

7 years agobpo-28393: Update encoding lookup docs wrt bpo-27938 (#4871)
Ville Skyttä [Fri, 15 Dec 2017 10:19:23 +0000 (12:19 +0200)]
bpo-28393: Update encoding lookup docs wrt bpo-27938 (#4871)

7 years agomove pygetopt.h to internal (closes bpo-32264) (#4830)
Benjamin Peterson [Fri, 15 Dec 2017 07:48:12 +0000 (23:48 -0800)]
move pygetopt.h to internal (closes bpo-32264) (#4830)

7 years agobpo-32311: Implement asyncio.create_task() shortcut (#4848)
Andrew Svetlov [Fri, 15 Dec 2017 05:04:38 +0000 (07:04 +0200)]
bpo-32311: Implement asyncio.create_task() shortcut (#4848)

* Implement functionality
* Add documentation

7 years agobpo-32327: Convert asyncio functions documented as coroutines to coroutines. (#4872)
Yury Selivanov [Fri, 15 Dec 2017 01:53:26 +0000 (20:53 -0500)]
bpo-32327: Convert asyncio functions documented as coroutines to coroutines. (#4872)

7 years agobpo-32030: Add _PyMainInterpreterConfig.executable (#4876)
Victor Stinner [Fri, 15 Dec 2017 01:05:29 +0000 (02:05 +0100)]
bpo-32030: Add _PyMainInterpreterConfig.executable (#4876)

* Add new fields to _PyMainInterpreterConfig:

  * executable
  * prefix
  * base_prefix
  * exec_prefix
  * base_exec_prefix

* _PySys_EndInit() now sets sys attributes from
  _PyMainInterpreterConfig

7 years agobpo-32030: Add _PyCoreConfig_Copy() (#4874)
Victor Stinner [Fri, 15 Dec 2017 00:46:02 +0000 (01:46 +0100)]
bpo-32030: Add _PyCoreConfig_Copy() (#4874)

Each interpreter now has its core_config and main_config copy:

* Add _PyCoreConfig_Copy() and _PyMainInterpreterConfig_Copy()
* Move _PyCoreConfig_Read(), _PyCoreConfig_Clear() and
  _PyMainInterpreterConfig_Clear() from Python/pylifecycle.c to
  Modules/main.c
* Fix _Py_InitializeEx_Private(): call _PyCoreConfig_ReadEnv() before
  _Py_InitializeCore()

7 years agobpo-32329: Fix -R option for hash randomization (#4873)
Victor Stinner [Thu, 14 Dec 2017 23:51:22 +0000 (00:51 +0100)]
bpo-32329: Fix -R option for hash randomization (#4873)

bpo-32329, bpo-32030:

* The -R option now turns on hash randomization when the
  PYTHONHASHSEED environment variable is set to 0 Previously, the
  option was ignored.
* sys.flags.hash_randomization is now properly set to 0 when hash
  randomization is turned off by PYTHONHASHSEED=0.
* _PyCoreConfig_ReadEnv() now reads the PYTHONHASHSEED environment
  variable. _Py_HashRandomization_Init() now only apply the
  configuration, it doesn't read PYTHONHASHSEED anymore.

7 years agobpo-32143: add f_fsid to os.statvfs() (#4571)
Giuseppe Scrivano [Thu, 14 Dec 2017 22:46:46 +0000 (23:46 +0100)]
bpo-32143: add f_fsid to os.statvfs() (#4571)

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
7 years agobpo-32226: Implementation of PEP 560 (core components) (#4732)
Ivan Levkivskyi [Thu, 14 Dec 2017 22:32:56 +0000 (23:32 +0100)]
bpo-32226: Implementation of PEP 560 (core components) (#4732)

This part of the PEP implementation adds support for
__mro_entries__ and __class_getitem__ by updating
__build_class__ and PyObject_GetItem.

7 years agobpo-29469: Optimize literal lists and sets iterating on the AST level. (#4866)
Serhiy Storchaka [Thu, 14 Dec 2017 18:24:31 +0000 (20:24 +0200)]
bpo-29469: Optimize literal lists and sets iterating on the AST level. (#4866)

7 years agobpo-32277: Fix exception raised from chmod(..., follow_symlinks=False) (#4797)
Anthony Sottile [Thu, 14 Dec 2017 16:57:55 +0000 (08:57 -0800)]
bpo-32277: Fix exception raised from chmod(..., follow_symlinks=False) (#4797)

7 years agobpo-32314: Implement asyncio.run() (#4852)
Yury Selivanov [Thu, 14 Dec 2017 14:42:21 +0000 (09:42 -0500)]
bpo-32314: Implement asyncio.run() (#4852)

7 years agobpo-29469: Remove unnecessary peephole optimizer (GH-4863)
INADA Naoki [Thu, 14 Dec 2017 13:18:26 +0000 (22:18 +0900)]
bpo-29469: Remove unnecessary peephole optimizer (GH-4863)

Conversions like `not a is b -> a is not b` are implemented
in AST optimizer in previous commit (7ea143a).
So this commit removes them from peephole optimizer.

7 years agobpo-32030: Add _PyMainInterpreterConfig.warnoptions (#4855)
Victor Stinner [Thu, 14 Dec 2017 11:05:26 +0000 (12:05 +0100)]
bpo-32030: Add _PyMainInterpreterConfig.warnoptions (#4855)

Add warnoptions and xoptions fields to _PyMainInterpreterConfig.

7 years agobpo-32297: Few misspellings found in Python source code comments. (#4803)
Mike [Thu, 14 Dec 2017 11:04:53 +0000 (14:04 +0300)]
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

7 years agobpo-32225: Implementation of PEP 562 (#4731)
Ivan Levkivskyi [Thu, 14 Dec 2017 10:59:44 +0000 (11:59 +0100)]
bpo-32225: Implementation of PEP 562 (#4731)

Implement PEP 562: module __getattr__ and __dir__.
The implementation simply updates module_getattro and
module_dir.

7 years agobpo-32302: Fix distutils bdist_wininst for CRT v142 (#4851)
Victor Stinner [Thu, 14 Dec 2017 10:39:34 +0000 (11:39 +0100)]
bpo-32302: Fix distutils bdist_wininst for CRT v142 (#4851)

CRT v142 is binary compatible with CRT v140.

7 years agobpo-29469: Move constant folding to AST optimizer (GH-2858)
INADA Naoki [Thu, 14 Dec 2017 07:47:20 +0000 (16:47 +0900)]
bpo-29469: Move constant folding to AST optimizer (GH-2858)

7 years agobpo-32030: Rewrite _PyMainInterpreterConfig (#4854)
Victor Stinner [Thu, 14 Dec 2017 01:20:52 +0000 (02:20 +0100)]
bpo-32030: Rewrite _PyMainInterpreterConfig (#4854)

_PyMainInterpreterConfig now contains Python objects, whereas
_PyCoreConfig contains wchar_t* strings.

Core config:

* Rename _PyMainInterpreterConfig_ReadEnv() to _PyCoreConfig_ReadEnv()
* Move 3 strings from _PyMainInterpreterConfig to _PyCoreConfig:
  module_search_path_env, home, program_name.
* Add _PyCoreConfig_Clear()
* _PyPathConfig_Calculate() now takes core config rather than main
  config
* _PyMainInterpreterConfig_Read() now requires also a core config

Main config:

* Add _PyMainInterpreterConfig.module_search_path: sys.path list
* Add _PyMainInterpreterConfig.argv: sys.argv list
* _PyMainInterpreterConfig_Read() now computes module_search_path

7 years agobpo-30241: implement contextlib.AbstractAsyncContextManager (#1412)
Jelle Zijlstra [Thu, 14 Dec 2017 01:19:17 +0000 (17:19 -0800)]
bpo-30241: implement contextlib.AbstractAsyncContextManager (#1412)

7 years agobpo-32296: Unbreak tests on Windows (#4850)
Yury Selivanov [Wed, 13 Dec 2017 22:28:41 +0000 (17:28 -0500)]
bpo-32296: Unbreak tests on Windows (#4850)

7 years agobpo-32030: Add _PyPathConfig_ComputeArgv0() (#4845)
Victor Stinner [Wed, 13 Dec 2017 20:05:57 +0000 (21:05 +0100)]
bpo-32030: Add _PyPathConfig_ComputeArgv0() (#4845)

Changes:

* Split _PySys_SetArgvWithError() into subfunctions for Py_Main():

  * Create the Python list object
  * Set sys.argv to the list
  * Compute argv0
  * Prepend argv0 to sys.path

* Add _PyPathConfig_ComputeArgv0()
* Remove _PySys_SetArgvWithError()
* Py_Main() now splits the code to compute sys.argv/path0 and the
  code to update the sys module: add pymain_compute_argv()
  subfunction.

7 years agobpo-32296: Implement asyncio.get_event_loop and _get_running_loop in C. (#4827)
Yury Selivanov [Wed, 13 Dec 2017 19:49:42 +0000 (14:49 -0500)]
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.

7 years agopymain_set_sys_argv() now copies argv (#4838)
Victor Stinner [Wed, 13 Dec 2017 16:31:16 +0000 (17:31 +0100)]
pymain_set_sys_argv() now copies argv (#4838)

bpo-29240, bpo-32030:

* Rename pymain_set_argv() to pymain_set_sys_argv()
* pymain_set_sys_argv() now creates of copy of argv and modify the
  copy, rather than modifying pymain->argv
* Call pymain_set_sys_argv() earlier: before pymain_run_python(), but
  after pymain_get_importer().
* Add _PySys_SetArgvWithError() to handle errors

7 years agopythoninfo: Add builtins, test.support, ... (#4840)
Victor Stinner [Wed, 13 Dec 2017 16:27:40 +0000 (17:27 +0100)]
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>
7 years agoFix couple typos (#4839)
Andrew Svetlov [Wed, 13 Dec 2017 15:50:16 +0000 (17:50 +0200)]
Fix couple typos (#4839)

7 years agotrivial: link updates in documentation (#2765)
jimmy [Wed, 13 Dec 2017 12:37:51 +0000 (13:37 +0100)]
trivial: link updates in documentation (#2765)

7 years agobpo-29240: PEP 540: Add a new UTF-8 Mode (#855)
Victor Stinner [Wed, 13 Dec 2017 11:29:09 +0000 (12:29 +0100)]
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.

7 years agobpo-32284: Fix documentation of BinaryIO and TextIO (#4832)
Sebastian Rittau [Wed, 13 Dec 2017 08:39:55 +0000 (09:39 +0100)]
bpo-32284: Fix documentation of BinaryIO and TextIO (#4832)

7 years agoTest atexit shutdown mechanism in a subprocess (#4828)
Antoine Pitrou [Wed, 13 Dec 2017 01:29:07 +0000 (02:29 +0100)]
Test atexit shutdown mechanism in a subprocess (#4828)

* Test atexit shutdown mechanism in a subprocess

7 years agobpo-17852: Revert incorrect fix based on misunderstanding of _Py_PyAtExit() semantics...
Antoine Pitrou [Wed, 13 Dec 2017 00:39:26 +0000 (01:39 +0100)]
bpo-17852: Revert incorrect fix based on misunderstanding of _Py_PyAtExit() semantics (#4826)

7 years agoimport.c: Fix a GCC warning (#4822)
Victor Stinner [Tue, 12 Dec 2017 22:29:28 +0000 (23:29 +0100)]
import.c: Fix a GCC warning (#4822)

Fix the warning:

Python/import.c: warning: comparison between signed and unsigned integer expressions
     if ((i + n + 1) <= PY_SSIZE_T_MAX / sizeof(struct _inittab)) {

7 years agobpo-32101: Fix tests for PYTHONDEVMODE=1 (#4821)
Victor Stinner [Tue, 12 Dec 2017 22:15:00 +0000 (23:15 +0100)]
bpo-32101: Fix tests for PYTHONDEVMODE=1 (#4821)

test_asycio: remove also aio_path which was used when asyncio was
developed outside the stdlib.

7 years agobpo-32230: Set sys.warnoptions with -X dev (#4820)
Victor Stinner [Tue, 12 Dec 2017 21:59:48 +0000 (22:59 +0100)]
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.

7 years agoFix improper use of re.escape() in tests. (#4814)
Serhiy Storchaka [Tue, 12 Dec 2017 17:21:50 +0000 (19:21 +0200)]
Fix improper use of re.escape() in tests. (#4814)

7 years agoFix implementation dependent assertion in test_plistlib. (#4813)
Serhiy Storchaka [Tue, 12 Dec 2017 17:03:08 +0000 (19:03 +0200)]
Fix implementation dependent assertion in test_plistlib. (#4813)

It is failed with an advanced optimizer.

7 years agobpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748)
Serhiy Storchaka [Tue, 12 Dec 2017 11:55:04 +0000 (13:55 +0200)]
bpo-32241: Add the const qualifire to declarations of umodifiable strings. (#4748)

7 years agobpo-31942: Document optional support of start and stop attributes in Sequence.index...
Nitish Chandra [Tue, 12 Dec 2017 10:22:30 +0000 (15:52 +0530)]
bpo-31942: Document optional support of start and stop attributes in Sequence.index method (#4277)

7 years agobpo-32255: Always quote a single empty field when write into a CSV file. (#4769)
Licht Takeuchi [Tue, 12 Dec 2017 09:57:06 +0000 (18:57 +0900)]
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.

7 years agoFix small typo in tupleobject.h (#4801)
Chris [Tue, 12 Dec 2017 07:59:30 +0000 (23:59 -0800)]
Fix small typo in tupleobject.h (#4801)

7 years agoFix idlelib comment typos reported by Mike on pull request 4803. (#4807)
Terry Jan Reedy [Tue, 12 Dec 2017 03:59:08 +0000 (22:59 -0500)]
Fix idlelib comment typos reported by Mike on pull request 4803. (#4807)

7 years agobpo-32227: functools.singledispatch supports registering via type annotations (#4733)
Łukasz Langa [Mon, 11 Dec 2017 21:56:31 +0000 (13:56 -0800)]
bpo-32227: functools.singledispatch supports registering via type annotations (#4733)

7 years agobpo-32258: Replace 'yield from' to 'await' in asyncio docs (#4779)
Andrew Svetlov [Mon, 11 Dec 2017 15:35:49 +0000 (17:35 +0200)]
bpo-32258: Replace 'yield from' to 'await' in asyncio docs (#4779)

* Replace 'yield from' to 'await' in asyncio docs

* Fix docstrings

7 years agoAdd asyncio.get_running_loop() function. (#4782)
Yury Selivanov [Mon, 11 Dec 2017 15:07:44 +0000 (10:07 -0500)]
Add asyncio.get_running_loop() function. (#4782)

7 years agobpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785)
Yury Selivanov [Mon, 11 Dec 2017 15:04:40 +0000 (10:04 -0500)]
bpo-32273: Move asyncio.test_utils to test.test_asyncio (#4785)

7 years agobpo-32272: Remove asyncio.async() function. (#4784)
Yury Selivanov [Mon, 11 Dec 2017 15:03:48 +0000 (10:03 -0500)]
bpo-32272: Remove asyncio.async() function. (#4784)

7 years agobpo-22671: Clarify and test default read method implementations (#4568)
Sanyam Khurana [Mon, 11 Dec 2017 13:42:09 +0000 (19:12 +0530)]
bpo-22671: Clarify and test default read method implementations (#4568)

Original patch written by Martin Panter, enhanced by Sanyam Khurana.

7 years agobpo-32252: Fix faulthandler_suppress_crash_report() (#4794)
Victor Stinner [Mon, 11 Dec 2017 12:57:12 +0000 (13:57 +0100)]
bpo-32252: Fix faulthandler_suppress_crash_report() (#4794)

Fix faulthandler_suppress_crash_report() used to prevent core dump files
when testing crashes. getrlimit() returns zero on success.

7 years agobpo-32262: Fix f-string (#4787)
Yury Selivanov [Mon, 11 Dec 2017 00:52:53 +0000 (19:52 -0500)]
bpo-32262: Fix f-string (#4787)

7 years agobpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775)
Yury Selivanov [Sun, 10 Dec 2017 23:36:12 +0000 (18:36 -0500)]
bpo-32262: Fix codestyle; use f-strings formatting where necessary. (#4775)

7 years agoSkip test_read_pty_output test on macOS for poll and select. (#4774)
Yury Selivanov [Sun, 10 Dec 2017 17:40:19 +0000 (12:40 -0500)]
Skip test_read_pty_output test on macOS for poll and select. (#4774)

Starting with 10.13.2 the test hangs forever.

7 years agobpo-32114: Updated the documentation for get_event_loop to reflect the policy change...
Pablo Galindo [Sun, 10 Dec 2017 17:34:59 +0000 (17:34 +0000)]
bpo-32114: Updated the documentation for get_event_loop to reflect the policy change (#4510)

7 years agoRemoved doubled 'bpo-'. (#4777)
Terry Jan Reedy [Sun, 10 Dec 2017 09:02:53 +0000 (04:02 -0500)]
Removed doubled 'bpo-'. (#4777)

7 years agobpo-31506: Improve the error message logic for class instantiation (GH-4740)
Sanyam Khurana [Sun, 10 Dec 2017 00:14:22 +0000 (05:44 +0530)]
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.

7 years agobyte swap the raw hash secrets (more bpo-32260) (#4773)
Benjamin Peterson [Sat, 9 Dec 2017 21:11:39 +0000 (13:11 -0800)]
byte swap the raw hash secrets (more bpo-32260) (#4773)

7 years agofix my byte-swapping implementation (#4772)
Benjamin Peterson [Sat, 9 Dec 2017 20:18:56 +0000 (12:18 -0800)]
fix my byte-swapping implementation (#4772)

7 years agobpo-32260: don't byte swap siphash keys (#4771)
Benjamin Peterson [Sat, 9 Dec 2017 19:24:18 +0000 (11:24 -0800)]
bpo-32260: don't byte swap siphash keys (#4771)

Reference siphash takes the keys as a bytes, so it makes sense to byte swap
when reifying the keys as 64-bit integers. However, Python's siphash takes host
integers in to start with.

7 years agocloses bpo-31650: PEP 552 (Deterministic pycs) implementation (#4575)
Benjamin Peterson [Sat, 9 Dec 2017 18:26:52 +0000 (10:26 -0800)]
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.

7 years agobpo-32253: Deprecate with statement and bare await for asyncio locks (GH-4764)
Andrew Svetlov [Sat, 9 Dec 2017 18:00:05 +0000 (20:00 +0200)]
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

7 years agobpo-32212: Updated logging documentation to make parameter names more consistent...
Vinay Sajip [Sat, 9 Dec 2017 11:09:04 +0000 (11:09 +0000)]
bpo-32212: Updated logging documentation to make parameter names more consistent with source. (GH-4765)

7 years agobpo-32193: Convert asyncio to async/await usage (#4753)
Andrew Svetlov [Fri, 8 Dec 2017 22:23:48 +0000 (00:23 +0200)]
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

7 years agobpo-22589 Changed MIME type of .bmp to "image/bmp" (#4756)
Nitish Chandra [Fri, 8 Dec 2017 12:48:44 +0000 (18:18 +0530)]
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.

7 years agoFix missing DECREF of mod. (#4749)
Neil Schemenauer [Fri, 8 Dec 2017 00:24:59 +0000 (16:24 -0800)]
Fix missing DECREF of mod. (#4749)

7 years agoPyLong_FromString(): fix Coverity CID 1424951 (#4738)
Victor Stinner [Thu, 7 Dec 2017 23:06:55 +0000 (00:06 +0100)]
PyLong_FromString(): fix Coverity CID 1424951 (#4738)

Explicitly cast digits (Py_ssize_t) to double to fix the following
false-alarm warning from Coverity:

"fsize_z = digits * log_base_BASE[base] + 1;"

CID 1424951: Incorrect expression (UNINTENDED_INTEGER_DIVISION)
Dividing integer expressions "9223372036854775783UL" and "4UL", and
then converting the integer quotient to type "double". Any remainder,
or fractional part of the quotient, is ignored.

7 years agobpo-32208: update threading.Semaphore docs and add unit test (#4709)
Garrett Berg [Thu, 7 Dec 2017 18:04:26 +0000 (11:04 -0700)]
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

7 years agobpo-32199: The getnode() ip getter now uses 'ip link' instead of 'ip link list'...
xdegaye [Thu, 7 Dec 2017 11:59:13 +0000 (12:59 +0100)]
bpo-32199:  The getnode() ip getter now uses 'ip link' instead of 'ip link list' (GH-4696)