Commit Graph

42572 Commits

Author SHA1 Message Date
Andrew Svetlov 4a02543cf9
bpo-26133: Dont unsubscribe signals in UNIX even loop on interpreter shutdown (#4956) 2017-12-21 17:06:46 +02:00
Коренберг Марк fbd605151f bpo-32323: urllib.parse.urlsplit() must not lowercase() IPv6 scope value (#4867) 2017-12-21 14:16:17 +02:00
Paul Ganssle 09dc2f508c bpo-15873: Implement [date][time].fromisoformat (#4699)
Closes bpo-15873.
2017-12-21 00:33:49 -05:00
INADA Naoki 507434fd50
bpo-15216: io: TextIOWrapper.reconfigure() accepts encoding, errors and newline (GH-2343) 2017-12-21 09:59:53 +09:00
Andrew Svetlov 51eb1c6b9c
bpo-29970: Make ssh_handshake_timeout None by default (#4939)
* Make ssh_handshake_timeout None by default.
* Raise ValueError if ssl_handshake_timeout is used without ssl.
* Raise ValueError if ssl_handshake_timeout is not positive.
2017-12-20 20:24:43 +02:00
Antoine Pitrou 1f1a34c314
bpo-32379: Faster MRO computation for single inheritance (#4932)
* bpo-32379: Faster MRO computation for single inheritance
2017-12-20 15:58:21 +01:00
Marcel Plch 776407fe89 bpo-31901: atexit callbacks should be run at subinterpreter shutdown (#4611)
Change atexit behavior and PEP-489 multiphase init support.
2017-12-20 11:17:58 +01:00
Neil Aspinall f7686c1f55 bpo-29970: Add timeout for SSL handshake in asyncio
10 seconds by default.
2017-12-19 21:45:42 +02:00
Michael Felt c5ae169e1b bpo-26439 Fix ctypes.util.find_library failure on AIX (#4507)
Implement find_library() support in ctypes/util for AIX.

Add some AIX specific tests.
2017-12-19 13:58:49 +01:00
Julien Duponchelle 319c0345cd bpo-29711: Fix stop_serving in proactor loop kill all listening servers (#431) 2017-12-19 07:23:17 -05:00
Yury Selivanov 36c2c04478
bpo-32355: Optimize asyncio.gather() (#4913) 2017-12-19 07:19:53 -05:00
Yury Selivanov a9d7e552c7
bpo-32357: Optimize asyncio.iscoroutine() for non-native coroutines (#4915) 2017-12-19 07:18:45 -05:00
Yury Selivanov a7bd64c0c0
bpo-27456: Simplify sock type checks (#4922)
Recent sock.type fix (see bug 32331) makes sock.type checks simpler
in asyncio.
2017-12-19 06:44:37 -05:00
Andrew Svetlov 21be85f520
Improve test coverage (#4924) 2017-12-19 08:51:16 +02:00
Yury Selivanov 9818142b1b
bpo-32331: Fix socket.type when SOCK_NONBLOCK is available (#4877) 2017-12-18 20:02:54 -05:00
Yury Selivanov d757aaf9dd
bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914) 2017-12-18 17:03:23 -05:00
izbyshev 2d8f06382e 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.
2017-12-18 12:26:49 -08:00
Segev Finer b2a6083eb0 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.
2017-12-18 10:28:19 +01:00
Nathaniel J. Smith 902ab80b59 bpo-30050: Allow disabling full buffer warnings in signal.set_wakeup_fd (#4792) 2017-12-17 23:10:18 -05:00
Yury Selivanov 1b7c11ff0e
bpo-32348: Optimize asyncio.Future schedule/add/remove callback. (#4907) 2017-12-17 20:19:47 -05:00
Andrew Svetlov 5382c05021
bpo-32351: Use fastpath in asyncio.sleep if delay<0 (#4908)
* Use fastpath in asyncio.sleep if delay<0

* Add NEWS entry
2017-12-17 16:41:30 +02:00
Andrew Svetlov 44d1a5912e
bpo-32250: Implement asyncio.current_task() and asyncio.all_tasks() (#4799) 2017-12-16 21:58:38 +02:00
Serhiy Storchaka 45700fb757 Add tests for using PEP560 with classes implemented in C. (#4883)
Based on tests from #4878
2017-12-16 10:25:56 +01:00
Nick Coghlan 9c19b02024
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)
2017-12-16 21:51:19 +13:00
Victor Stinner 9454060e84
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.
2017-12-16 04:54:22 +01:00
Yury Selivanov e796b2fe26
bpo-27456: Ensure TCP_NODELAY is set on linux (#4231) 2017-12-15 19:32:25 -05:00
Brett Cannon 4ac5150e06
bpo-32248: Implement importlib.abc.ResourceReader (GH-4892) 2017-12-15 16:29:35 -08:00
Victor Stinner 9402c8367b
bpo-32294: Fix multiprocessing test_semaphore_tracker() (#4885)
Run the child process with -E option to ignore the PYTHONWARNINGS
environment variable.
2017-12-15 16:29:24 +01:00
Serhiy Storchaka 3327a2ddf1
bpo-32265: Classify class and static methods of builtin types. (#4776)
Add types.ClassMethodDescriptorType for unbound class methods.
2017-12-15 14:13:41 +02:00
Serhiy Storchaka 2e3f570185
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.
2017-12-15 14:11:43 +02:00
Serhiy Storchaka 3325a6780c
bpo-27169: The __debug__ constant is now optimized out at compile time. (#4880)
This fixes also bpo-22091.
2017-12-15 12:35:48 +02:00
Andrew Svetlov f74ef458ab
bpo-32311: Implement asyncio.create_task() shortcut (#4848)
* Implement functionality
* Add documentation
2017-12-15 07:04:38 +02:00
Yury Selivanov 19a44f63c7
bpo-32327: Convert asyncio functions documented as coroutines to coroutines. (#4872) 2017-12-14 20:53:26 -05:00
Victor Stinner 358e5e17a5
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.
2017-12-15 00:51:22 +01:00
Giuseppe Scrivano 96a5e50a5d bpo-32143: add f_fsid to os.statvfs() (#4571)
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-12-14 17:46:46 -05:00
Ivan Levkivskyi 2b5fd1e9ca
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.
2017-12-14 23:32:56 +01:00
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