]> granicus.if.org Git - python/log
python
5 years agobpo-31961: Fix support of path-like executables in subprocess. (GH-5914)
Serhiy Storchaka [Tue, 28 May 2019 19:49:35 +0000 (22:49 +0300)]
bpo-31961: Fix support of path-like executables in subprocess. (GH-5914)

5 years agoFix typo in docs for socket.CAN_RAW_FD_FRAMES (GH-13635)
karl ding [Tue, 28 May 2019 18:35:26 +0000 (11:35 -0700)]
Fix typo in docs for socket.CAN_RAW_FD_FRAMES (GH-13635)

There is an extra "one" in the text description for the constant
socket.CAN_RAW_FD_FRAMES

5 years agobpo-36933: fix what's new. (GH-13627)
Matthias Bussonnier [Tue, 28 May 2019 17:30:35 +0000 (10:30 -0700)]
bpo-36933: fix what's new. (GH-13627)

Original Pr was reformed and news not updated.

https://bugs.python.org/issue36933

5 years agobpo-22640: Add silent mode to py_compile.compile() (GH-12976)
Joannah Nanjekye [Tue, 28 May 2019 16:29:04 +0000 (13:29 -0300)]
bpo-22640: Add silent mode to py_compile.compile() (GH-12976)

5 years agobpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)
Zackery Spytz [Tue, 28 May 2019 15:16:33 +0000 (09:16 -0600)]
bpo-33407: Implement Py_DEPRECATED() on MSVC (GH-8980)

5 years agobpo-33725: multiprocessing uses spawn by default on macOS (GH-13603)
Victor Stinner [Tue, 28 May 2019 14:02:50 +0000 (16:02 +0200)]
bpo-33725: multiprocessing uses spawn by default on macOS (GH-13603)

On macOS, the multiprocessing module now uses the "spawn" start
method by default.

5 years agobpo-36829: sys.excepthook and sys.unraisablehook flush (GH-13620)
Victor Stinner [Tue, 28 May 2019 14:01:17 +0000 (16:01 +0200)]
bpo-36829: sys.excepthook and sys.unraisablehook flush (GH-13620)

sys.excepthook() and sys.unraisablehook() now explicitly flush the
file (usually sys.stderr).

If file.flush() fails, sys.excepthook() silently ignores the error,
whereas sys.unraisablehook() logs the new exception.

5 years agoDoc: Add missing forward reference in the tutorial. (GH-13499)
Julien Palard [Tue, 28 May 2019 13:10:23 +0000 (15:10 +0200)]
Doc: Add missing forward reference in the tutorial. (GH-13499)

5 years agobpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)
Zackery Spytz [Tue, 28 May 2019 12:55:29 +0000 (06:55 -0600)]
bpo-26423: Fix possible overflow in wrap_lenfunc() (GH-13606)

Fix possible overflow in wrap_lenfunc() when
sizeof(long) < sizeof(Py_ssize_t) (e.g., 64-bit Windows).

5 years agobpo-32299: Return patched dict when using patch.dict as a context manager (GH-11062)
Mario Corchero [Tue, 28 May 2019 12:53:31 +0000 (13:53 +0100)]
bpo-32299: Return patched dict when using patch.dict as a context manager (GH-11062)

5 years agobpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)
Jeroen Demeyer [Tue, 28 May 2019 12:42:53 +0000 (14:42 +0200)]
bpo-36922: implement PEP-590 Py_TPFLAGS_METHOD_DESCRIPTOR (GH-13338)

Co-authored-by: Mark Shannon <mark@hotpy.org>
5 years agoDoc: Space breaking whole definition. (GH-13615)
Julien Palard [Tue, 28 May 2019 12:04:42 +0000 (14:04 +0200)]
Doc: Space breaking whole definition. (GH-13615)

5 years agobpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618)
Inada Naoki [Tue, 28 May 2019 12:02:52 +0000 (21:02 +0900)]
bpo-35279: reduce default max_workers of ThreadPoolExecutor (GH-13618)

5 years agoRemove outdated time.monotonic reference (GH-13264)
Brad [Tue, 28 May 2019 10:47:24 +0000 (06:47 -0400)]
Remove outdated time.monotonic reference (GH-13264)

Per ae58649, time.monotonic is always available, making the old note outdated.

5 years agobpo-36900: Fix compilation on HP-UX (GH-13614)
Victor Stinner [Tue, 28 May 2019 10:24:00 +0000 (12:24 +0200)]
bpo-36900: Fix compilation on HP-UX (GH-13614)

dynload_hpux.c: add #include "pycore_pystate.h" for
_PyInterpreterState_GET_UNSAFE().

5 years agobpo-29883: Asyncio proactor udp (GH-13440)
Andrew Svetlov [Tue, 28 May 2019 09:52:15 +0000 (12:52 +0300)]
bpo-29883: Asyncio proactor udp (GH-13440)

Follow-up for #1067

https://bugs.python.org/issue29883

5 years agoDOC: Unnecessary plural. (GH-13613)
Julien Palard [Tue, 28 May 2019 08:35:25 +0000 (10:35 +0200)]
DOC: Unnecessary plural. (GH-13613)

5 years agobpo-37058: PEP 544: Add Protocol to typing module (GH-13585)
Ivan Levkivskyi [Tue, 28 May 2019 07:40:15 +0000 (08:40 +0100)]
bpo-37058: PEP 544: Add Protocol to typing module (GH-13585)

I tried to get rid of the `_ProtocolMeta`, but unfortunately it didn'y work. My idea to return a generic alias from `@runtime_checkable` made runtime protocols unpickleable. I am not sure what is worse (a custom metaclass or having some classes unpickleable), so I decided to stick with the status quo (since there were no complains so far). So essentially this is a copy of the implementation in `typing_extensions` with two modifications:
* Rename `@runtime` to `@runtime_checkable` (plus corresponding updates).
* Allow protocols that extend `collections.abc.Iterable` etc.

5 years agobpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) (GH-13577)
Matthias Bussonnier [Tue, 28 May 2019 07:10:59 +0000 (00:10 -0700)]
bpo-36933: Remove sys.set_coroutine_wrapper (marked for removal in 3.8) (GH-13577)

It has been documented as deprecated and to be removed in 3.8;

From a comment on another thread – which I can't find ; leave get_coro_wrapper() for now, but always return `None`.

https://bugs.python.org/issue36933

5 years agobpo-36996: Handle async functions when mock.patch is used as a decorator (GH-13562)
Xtreak [Tue, 28 May 2019 07:07:39 +0000 (12:37 +0530)]
bpo-36996: Handle async functions when mock.patch is used as a decorator (GH-13562)

Return a coroutine while patching async functions with a decorator.

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
https://bugs.python.org/issue36996

5 years agoAdd @maxking to CODEOWNERS file (GH-13599)
Abhilash Raj [Tue, 28 May 2019 04:15:48 +0000 (00:15 -0400)]
Add @maxking to CODEOWNERS file (GH-13599)

5 years agobpo-36686: Improve the documentation of the std* params in loop.subprocess_exec ...
sbstp [Mon, 27 May 2019 23:51:19 +0000 (19:51 -0400)]
bpo-36686: Improve the documentation of the std* params in loop.subprocess_exec (GH-13586)

https://bugs.python.org/issue36686

5 years agobpo-37054, _pyio: Fix BytesIO and TextIOWrapper __del__() (GH-13601)
Victor Stinner [Mon, 27 May 2019 23:44:21 +0000 (01:44 +0200)]
bpo-37054, _pyio: Fix BytesIO and TextIOWrapper __del__() (GH-13601)

Fix destructor _pyio.BytesIO and _pyio.TextIOWrapper: initialize
their _buffer attribute as soon as possible (in the class body),
because it's used by __del__() which calls close().

5 years agobpo-37039: IDLE - zoomheight fixes (GH-13576)
Terry Jan Reedy [Mon, 27 May 2019 23:16:46 +0000 (19:16 -0400)]
bpo-37039: IDLE - zoomheight fixes (GH-13576)

Move doc entry to match menu and refactor zoom function.
A followup patch will include a blurb.

5 years agobpo-1230540: Add threading.excepthook() (GH-13515)
Victor Stinner [Mon, 27 May 2019 22:39:52 +0000 (00:39 +0200)]
bpo-1230540: Add threading.excepthook() (GH-13515)

Add a new threading.excepthook() function which handles uncaught
Thread.run() exception. It can be overridden to control how uncaught
exceptions are handled.

threading.ExceptHookArgs is not documented on purpose: it should not
be used directly.

* threading.excepthook() and threading.ExceptHookArgs.
* Add _PyErr_Display(): similar to PyErr_Display(), but accept a
  'file' parameter.
* Add _thread._excepthook(): C implementation of the exception hook
  calling _PyErr_Display().
* Add _thread._ExceptHookArgs: structseq type.
* Add threading._invoke_excepthook_wrapper() which handles the gory
  details to ensure that everything remains alive during Python
  shutdown.
* Add unit tests.

5 years agobpo-36889: Merge asyncio streams (GH-13251)
Andrew Svetlov [Mon, 27 May 2019 19:56:22 +0000 (22:56 +0300)]
bpo-36889: Merge asyncio streams (GH-13251)

https://bugs.python.org/issue36889

5 years agobpo-37050: Remove expr_text from FormattedValue ast node, use Constant node instead...
Eric V. Smith [Mon, 27 May 2019 19:31:52 +0000 (15:31 -0400)]
bpo-37050: Remove expr_text from FormattedValue ast node, use Constant node instead (GH-13597)

When using the "=" debug functionality of f-strings, use another Constant node (or a merged constant node) instead of adding expr_text to the FormattedValue node.

5 years agobpo-32941: Fix test_madvise failure when page size >= 8kiB (GH-13596)
Antoine Pitrou [Mon, 27 May 2019 17:57:23 +0000 (19:57 +0200)]
bpo-32941:  Fix test_madvise failure when page size >= 8kiB (GH-13596)

https://bugs.python.org/issue32941

5 years agoFix a typo in SECURITY.md (GH-13568)
Philippe Gagnon [Mon, 27 May 2019 17:45:24 +0000 (13:45 -0400)]
Fix a typo in SECURITY.md (GH-13568)

There is a duplicated "in" in the Supported Versions text.

5 years agobpo-37051: Refine note on what objects are hashable (GH-13587)
Raymond Hettinger [Mon, 27 May 2019 17:21:31 +0000 (10:21 -0700)]
bpo-37051: Refine note on what objects are hashable (GH-13587)

5 years agobpo-32941: Add madvise() for mmap objects (GH-6172)
Zackery Spytz [Mon, 27 May 2019 16:48:17 +0000 (10:48 -0600)]
bpo-32941: Add madvise() for mmap objects (GH-6172)

Allow mmap objects to access the madvise() system call.

5 years agobpo-36763: Implement the PEP 587 (GH-13592)
Victor Stinner [Mon, 27 May 2019 14:39:22 +0000 (16:39 +0200)]
bpo-36763: Implement the PEP 587 (GH-13592)

* Add a whole new documentation page:
  "Python Initialization Configuration"
* PyWideStringList_Append() return type is now PyStatus,
  instead of int
* PyInterpreterState_New() now calls PyConfig_Clear() if
  PyConfig_InitPythonConfig() fails.
* Rename files:

  * Python/coreconfig.c => Python/initconfig.c
  * Include/cpython/coreconfig.h => Include/cpython/initconfig.h
  * Include/internal/: pycore_coreconfig.h => pycore_initconfig.h

* Rename structures

  * _PyCoreConfig => PyConfig
  * _PyPreConfig => PyPreConfig
  * _PyInitError => PyStatus
  * _PyWstrList => PyWideStringList

* Rename PyConfig fields:

  * use_module_search_paths => module_search_paths_set
  * module_search_path_env => pythonpath_env

* Rename PyStatus field: _func => func
* PyInterpreterState: rename core_config field to config
* Rename macros and functions:

  * _PyCoreConfig_SetArgv() => PyConfig_SetBytesArgv()
  * _PyCoreConfig_SetWideArgv() => PyConfig_SetArgv()
  * _PyCoreConfig_DecodeLocale() => PyConfig_SetBytesString()
  * _PyInitError_Failed() => PyStatus_Exception()
  * _Py_INIT_ERROR_TYPE_xxx enums => _PyStatus_TYPE_xxx
  * _Py_UnixMain() => Py_BytesMain()
  * _Py_ExitInitError() => Py_ExitStatusException()
  * _Py_PreInitializeFromArgs() => Py_PreInitializeFromBytesArgs()
  * _Py_PreInitializeFromWideArgs() => Py_PreInitializeFromArgs()
  * _Py_PreInitialize() => Py_PreInitialize()
  * _Py_RunMain() => Py_RunMain()
  * _Py_InitializeFromConfig() => Py_InitializeFromConfig()
  * _Py_INIT_XXX() => _PyStatus_XXX()
  * _Py_INIT_FAILED() => _PyStatus_EXCEPTION()

* Rename 'err' PyStatus variables to 'status'
* Convert RUN_CODE() macro to config_run_code() static inline function
* Remove functions:

  * _Py_InitializeFromArgs()
  * _Py_InitializeFromWideArgs()
  * _PyInterpreterState_GetCoreConfig()

5 years agobpo-37027: Return a proxy socket object from transp.get_extra_info('socket') (GH...
Yury Selivanov [Mon, 27 May 2019 13:57:20 +0000 (15:57 +0200)]
bpo-37027: Return a proxy socket object from transp.get_extra_info('socket') (GH-13530)

Return a safe to use proxy socket object from `transport.get_extra_info('socket')`

https://bugs.python.org/issue37027

5 years agobpo-35397: Remove deprecation and document urllib.parse.unwrap (GH-11481)
Rémi Lapeyre [Mon, 27 May 2019 13:43:45 +0000 (15:43 +0200)]
bpo-35397: Remove deprecation and document urllib.parse.unwrap (GH-11481)

5 years agobpo-37035: Don't log OSError (GH-13548)
Andrew Svetlov [Mon, 27 May 2019 13:28:34 +0000 (16:28 +0300)]
bpo-37035: Don't log OSError (GH-13548)

https://bugs.python.org/issue37035

5 years agobpo-37047: Refactor AsyncMock setup logic for autospeccing (GH-13574)
Xtreak [Mon, 27 May 2019 12:56:23 +0000 (18:26 +0530)]
bpo-37047: Refactor AsyncMock setup logic for autospeccing (GH-13574)

Handle late binding and attribute access in unittest.mock.AsyncMock
setup for autospeccing.

5 years agobpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)
Yury Selivanov [Mon, 27 May 2019 12:45:12 +0000 (14:45 +0200)]
bpo-32528: Make asyncio.CancelledError a BaseException. (GH-13528)

This will address the common mistake many asyncio users make:
an "except Exception" clause breaking Tasks cancellation.

In addition to this change, we stop inheriting asyncio.TimeoutError
and asyncio.InvalidStateError from their concurrent.futures.*
counterparts.  There's no point for these exceptions to share the
inheritance chain.

In 3.9 we'll focus on implementing supervisors and cancel scopes,
which should allow better handling of all exceptions, including
SystemExit and KeyboardInterrupt

5 years agobpo-37028: asyncio REPL; activated via 'python -m asyncio'. (GH-13472)
Yury Selivanov [Mon, 27 May 2019 11:42:29 +0000 (13:42 +0200)]
bpo-37028: asyncio REPL; activated via 'python -m asyncio'. (GH-13472)

This makes it easy to play with asyncio APIs with simply
using async/await in the REPL.

5 years agobpo-36829: Add _PyErr_WriteUnraisableMsg() (GH-13488)
Victor Stinner [Mon, 27 May 2019 06:57:14 +0000 (08:57 +0200)]
bpo-36829: Add _PyErr_WriteUnraisableMsg() (GH-13488)

* sys.unraisablehook: add 'err_msg' field to UnraisableHookArgs.
* Use _PyErr_WriteUnraisableMsg() in _ctypes _DictRemover_call()
  and gc delete_garbage().

5 years agoAdd one more test for typing.Final (GH-13588)
Ivan Levkivskyi [Sun, 26 May 2019 23:54:13 +0000 (00:54 +0100)]
Add one more test for typing.Final (GH-13588)

5 years agobpo-36772 Allow lru_cache to be used as decorator without making a function call...
Raymond Hettinger [Sun, 26 May 2019 18:27:35 +0000 (11:27 -0700)]
bpo-36772 Allow lru_cache to be used as decorator without making a function call (GH-13048)

5 years agobpo-37053: handle strings like u"bar" correctly in Tools/parser/unparse.py (GH-13583)
Chih-Hsuan Yen [Sun, 26 May 2019 17:08:20 +0000 (01:08 +0800)]
bpo-37053: handle strings like u"bar" correctly in Tools/parser/unparse.py (GH-13583)

Constant.kind is added in https://bugs.python.org/issue36280.
Current possible values for Constant.kind are "u" or None.

For r'bar' and b'bar', Constant.kind value is None, so there's no need
for special handling.

https://bugs.python.org/issue37053

5 years agobpo-36785: PEP 574 implementation (GH-7076)
Antoine Pitrou [Sun, 26 May 2019 15:10:09 +0000 (17:10 +0200)]
bpo-36785: PEP 574 implementation (GH-7076)

5 years agoFix highlighting in importlib.metadata docs (GH-13575)
Anthony Sottile [Sun, 26 May 2019 14:30:52 +0000 (07:30 -0700)]
Fix highlighting in importlib.metadata docs (GH-13575)

5 years agobpo-28866: No type cache for types with specialized mro, invalidation is hard. (...
Julien Palard [Sun, 26 May 2019 14:25:47 +0000 (16:25 +0200)]
bpo-28866: No type cache for types with specialized mro, invalidation is hard. (#13157)

* No type cache for types with specialized mro, invalidation is hard.

* FIX: Don't disable method cache custom types that do not implement mro().

* fixing implem.

* Avoid storing error flags, also decref.

* news entry

* Clear as soon as we're getting an error.

* FIX: Reference leak.

5 years agobpo-37049: PEP 589: Add TypedDict to typing module (GH-13573)
Ivan Levkivskyi [Sun, 26 May 2019 08:39:24 +0000 (09:39 +0100)]
bpo-37049: PEP 589: Add TypedDict to typing module (GH-13573)

The implementation is straightforward and essentially is just copied from `typing_extensions`.

5 years agobpo-37046: PEP 586: Add Literal to typing module (#13572)
Ivan Levkivskyi [Sun, 26 May 2019 08:37:48 +0000 (09:37 +0100)]
bpo-37046: PEP 586: Add Literal to typing module (#13572)

The implementation is straightforward and essentially is just copied from `typing_extensions`.

5 years agobpo-37045: PEP 591: Add final qualifiers to typing module (GH-13571)
Ivan Levkivskyi [Sun, 26 May 2019 08:37:07 +0000 (09:37 +0100)]
bpo-37045: PEP 591: Add final qualifiers to typing module (GH-13571)

The implementation is straightforward, it just mimics `ClassVar` (since the latter is also a name/access qualifier, not really a type). Also it is essentially copied from `typing_extensions`.

5 years agobpo-37017: PyObject_CallMethodObjArgs uses LOAD_METHOD optimization (GH-13516)
Michael J. Sullivan [Sun, 26 May 2019 07:23:34 +0000 (00:23 -0700)]
bpo-37017: PyObject_CallMethodObjArgs uses LOAD_METHOD optimization (GH-13516)

Update PyObject_CallMethodObjArgs and _PyObject_CallMethodIdObjArgs
to use _PyObject_GetMethod to avoid creating a bound method object
in many cases.

On a microbenchmark of PyObject_CallMethodObjArgs calling a method on
an interpreted Python class, this optimization resulted in a 1.7x
speedup.

5 years agoDocs: FIX broken links. (GH-13491)
Julien Palard [Sat, 25 May 2019 18:02:24 +0000 (20:02 +0200)]
Docs: FIX broken links. (GH-13491)

5 years agobpo-34632 fix buildbots and remove artifact (GH-13566)
Jason R. Coombs [Sat, 25 May 2019 14:00:21 +0000 (10:00 -0400)]
bpo-34632 fix buildbots and remove artifact (GH-13566)

* bpo-34632: Also include the test data directory.

* bpo-34632: remove the framework resources artifacts, accidentally added in 1bbf7b661f (ccbccce)

5 years ago📝 Add a GitHub-specific security page (GH-13526)
Sviatoslav Sydorenko [Sat, 25 May 2019 10:03:45 +0000 (12:03 +0200)]
📝 Add a GitHub-specific security page (GH-13526)

* 📝 Add a GitHub-specific security page

It will show up @
https://github.com/python/cpython/security/policy
allowing to navigate users who get there from "Security" tab in the
GitHub repo to the full article explaining the security vulnerability
reporting practices.

Co-Authored-By: Hugo <hugovk@users.noreply.github.com>
5 years agobpo-34632: fix installation of importlib.metadata (#13563)
Chih-Hsuan Yen [Sat, 25 May 2019 08:09:35 +0000 (16:09 +0800)]
bpo-34632: fix installation of importlib.metadata (#13563)

5 years agobpo-37038: Make idlelib.run runnable; add test clause (GH-13560)
Terry Jan Reedy [Sat, 25 May 2019 01:59:53 +0000 (21:59 -0400)]
bpo-37038: Make idlelib.run runnable; add test clause (GH-13560)

5 years agobpo-34632: Add importlib.metadata (GH-12547)
Jason R. Coombs [Fri, 24 May 2019 23:59:01 +0000 (19:59 -0400)]
bpo-34632: Add importlib.metadata (GH-12547)

Add importlib.metadata module as forward port of the standalone importlib_metadata.

5 years agobpo-36829: Document test.support.catch_unraisable_exception() (GH-13554)
Victor Stinner [Fri, 24 May 2019 22:09:38 +0000 (00:09 +0200)]
bpo-36829: Document test.support.catch_unraisable_exception() (GH-13554)

catch_unraisable_exception() now also removes its 'unraisable'
attribute at the context manager exit.

5 years agobpo-37032: Add CodeType.replace() method (GH-13542)
Victor Stinner [Fri, 24 May 2019 21:57:23 +0000 (23:57 +0200)]
bpo-37032: Add CodeType.replace() method (GH-13542)

5 years agobpo-37021: Port _randommodule to the argument clinic (GH-13532)
Pablo Galindo [Fri, 24 May 2019 21:09:23 +0000 (22:09 +0100)]
bpo-37021: Port _randommodule to the argument clinic (GH-13532)

5 years agobpo-35907: Fix typo in the NEWS entry (GH-13559)
Victor Stinner [Fri, 24 May 2019 21:06:25 +0000 (23:06 +0200)]
bpo-35907: Fix typo in the NEWS entry (GH-13559)

5 years agobpo-36969: Make PDB args command display positional only arguments (GH-13459)
Rémi Lapeyre [Fri, 24 May 2019 20:44:31 +0000 (22:44 +0200)]
bpo-36969: Make PDB args command display positional only arguments (GH-13459)

5 years agobpo-35907: Clarify the NEWS entry (GH-13523)
Victor Stinner [Fri, 24 May 2019 20:06:32 +0000 (22:06 +0200)]
bpo-35907: Clarify the NEWS entry (GH-13523)

5 years agobpo-37023: Skip test_gdb under PGO (GH-13555)
Steve Dower [Fri, 24 May 2019 20:00:04 +0000 (13:00 -0700)]
bpo-37023: Skip test_gdb under PGO (GH-13555)

5 years agobpo-8138: Initialize wsgiref's SimpleServer as single-threaded (GH-12977)
Berker Peksag [Fri, 24 May 2019 17:24:42 +0000 (20:24 +0300)]
bpo-8138: Initialize wsgiref's SimpleServer as single-threaded (GH-12977)

5 years agobpo-21536: Fix configure.ac for LIBPYTHON on Android/Cygwin (GH-13552)
E. M. Bray [Fri, 24 May 2019 16:39:39 +0000 (18:39 +0200)]
bpo-21536: Fix configure.ac for LIBPYTHON on Android/Cygwin (GH-13552)

Add also missing AC_MSG_RESULT for AC_MSG_CHECKING(MACHDEP).

5 years agobpo-36721: Fix pkg-config symbolic links on "make install" (GH-13551)
Victor Stinner [Fri, 24 May 2019 16:27:13 +0000 (18:27 +0200)]
bpo-36721: Fix pkg-config symbolic links on "make install" (GH-13551)

5 years agobpo-36511: Ensure error code propagates out of batch files (GH-13529)
Paul Monson [Fri, 24 May 2019 16:15:39 +0000 (09:15 -0700)]
bpo-36511: Ensure error code propagates out of batch files (GH-13529)

5 years agobpo-21536: On Cygwin, C extensions must be linked with libpython (GH-13549)
E. M. Bray [Fri, 24 May 2019 15:33:47 +0000 (17:33 +0200)]
bpo-21536: On Cygwin, C extensions must be linked with libpython (GH-13549)

It is also possible to link against a library or executable with a
statically linked libpython, but not both with the same DLL.  In fact
building a statically linked python is currently broken on Cygwin
for other (related) reasons.

The same problem applies to other POSIX-like layers over Windows
(MinGW, MSYS) but Python's build system does not seem to attempt
to support those platforms at the moment.

5 years agobpo-36710: Add tstate parameter in ceval.c (GH-13547)
Victor Stinner [Fri, 24 May 2019 15:01:38 +0000 (17:01 +0200)]
bpo-36710: Add tstate parameter in ceval.c (GH-13547)

* Fix a possible reference leak in _PyErr_Print() if exception
  is NULL.
* PyErr_BadInternalCall(): replace PyErr_Format() with _PyErr_SetString().
* Add pycore_pyerrors.h header file.
* New functions:

  * _PyErr_Clear()
  * _PyErr_Fetch()
  * _PyErr_Print()
  * _PyErr_Restore()
  * _PyErr_SetObject()
  * _PyErr_SetString()

* Add 'tstate' parameter to _PyEval_AddPendingCall().

5 years agoFix typos in Doc/library/email.generator.rst documentation (GH-13539)
Nick Sung [Fri, 24 May 2019 13:50:35 +0000 (21:50 +0800)]
Fix typos in Doc/library/email.generator.rst documentation (GH-13539)

5 years agobpo-37031: Fix PyOS_AfterFork_Child() (GH-13537)
Victor Stinner [Fri, 24 May 2019 13:20:23 +0000 (15:20 +0200)]
bpo-37031: Fix PyOS_AfterFork_Child() (GH-13537)

PyOS_AfterFork_Child(): _PyInterpreterState_DeleteExceptMain() must
be called after _PyRuntimeState_ReInitThreads().

_PyRuntimeState_ReInitThreads() resets interpreters mutex after fork,
mutex used by _PyInterpreterState_DeleteExceptMain().

5 years agoSupport Py_UNUSED() on clang (GH-13544)
Victor Stinner [Fri, 24 May 2019 13:16:08 +0000 (15:16 +0200)]
Support Py_UNUSED() on clang (GH-13544)

5 years agobpo-36710: Add tstate parameter in errors.c (GH-13540)
Victor Stinner [Fri, 24 May 2019 11:44:24 +0000 (13:44 +0200)]
bpo-36710: Add tstate parameter in errors.c (GH-13540)

Add 'PyThreadState *tstate' parameter to errors.c functions to avoid
relying on global variables (indirectly on _PyRuntime).

5 years agobpo-37031: Reuse _PyRuntime.main_thread in signalmodule.c (GH-13538)
Victor Stinner [Fri, 24 May 2019 11:43:55 +0000 (13:43 +0200)]
bpo-37031: Reuse _PyRuntime.main_thread in signalmodule.c (GH-13538)

Remove main_thread and main_interp variables from signalmodule.c:
reuse _PyRuntime which already track the main thread and the main
interpreter.

* Remove #include <sys/types.h> which became useless: getpid() call
  has been removed.
* Add runtime argument to is_main()
* is_main() now gets the interpreter from runtime.

5 years agobpo-36045: builtins.help() now prefixes `async` for async functions (GH-12010)
Dan Rose [Fri, 24 May 2019 11:38:01 +0000 (06:38 -0500)]
bpo-36045: builtins.help() now prefixes `async` for async functions (GH-12010)

Previously, it was hard to tell whether a function should be awaited. It was also incorrect (per PEP 484) to put this in the type hint for coroutine functions. Added this info to the output of builtins.help and pydoc.

https://bugs.python.org/issue36045

5 years agoFix typo: decription -> description (GH-13543)
Xtreak [Fri, 24 May 2019 11:17:48 +0000 (16:47 +0530)]
Fix typo: decription -> description (GH-13543)

5 years agobpo-20285: Improve help docs for object (GH-4759)
Cheryl Sabella [Fri, 24 May 2019 10:43:29 +0000 (06:43 -0400)]
bpo-20285: Improve help docs for object (GH-4759)

5 years agobpo-34626: Document creating heap types from the C-API (GH-9154)
Petr Viktorin [Fri, 24 May 2019 09:19:42 +0000 (11:19 +0200)]
bpo-34626: Document creating heap types from the C-API (GH-9154)

bpo-34626: Document creating heap types from the C-API

Add missing descriptions of PEP384's PyType_Spec and PyType_Slot,
along with some introductory prose.

5 years agoFix warning in _testembed.c (GH-13533)
Pablo Galindo [Thu, 23 May 2019 23:53:21 +0000 (00:53 +0100)]
Fix warning in _testembed.c (GH-13533)

5 years agobpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not handled...
Matěj Cepl [Thu, 23 May 2019 20:30:00 +0000 (22:30 +0200)]
bpo-23395: Fix PyErr_SetInterrupt if the SIGINT signal is ignored or not handled (GH-7778)

``_thread.interrupt_main()`` now avoids setting the Python error status if the ``SIGINT`` signal is ignored or not handled by Python.

5 years agobpo-36842: Implement PEP 578 (GH-12613)
Steve Dower [Thu, 23 May 2019 15:45:22 +0000 (08:45 -0700)]
bpo-36842: Implement PEP 578 (GH-12613)

Adds sys.audit, sys.addaudithook, io.open_code, and associated C APIs.

5 years agobpo-36797: Reduce levels of indirection in outdated distutils docs (#13462)
Nick Coghlan [Thu, 23 May 2019 14:06:39 +0000 (00:06 +1000)]
bpo-36797: Reduce levels of indirection in outdated distutils docs (#13462)

5 years agobpo-37008: make mock_open handle able to honor next() (GH-13492)
Damien Nadé [Thu, 23 May 2019 10:03:25 +0000 (12:03 +0200)]
bpo-37008: make mock_open handle able to honor next() (GH-13492)

I've reported the issue on https://bugs.python.org/issue37008 and now I'm trying to bring a solution to this minor issue.

I think it could be trivially backported to 3.7 branch.

https://bugs.python.org/issue37008

5 years agobpo-33164: update blake2 implementation (GH-6286)
David Carlier [Thu, 23 May 2019 04:32:44 +0000 (04:32 +0000)]
bpo-33164: update blake2 implementation (GH-6286)

5 years agobpo-36763: Fix _PyPreConfig_InitCompatConfig() utf8_mode (GH-13518)
Victor Stinner [Thu, 23 May 2019 02:12:27 +0000 (04:12 +0200)]
bpo-36763: Fix _PyPreConfig_InitCompatConfig() utf8_mode (GH-13518)

* _PyPreConfig_InitCompatConfig() sets utf8_mode to 0.
* Change Py_UTF8Mode default value to 0.
* Fix _PyPreConfig_Copy(): copy also _config_init attrbibute.
* _PyPreConfig_AsDict() exports _config_init
* Fix _PyPreConfig_GetGlobalConfig(): use Py_UTF8Mode if it's greater
  than 0, even if utf8_mode >= 0.
* Add unit tests on environment variables using Python API.

5 years agobpo-18748: _pyio.IOBase emits unraisable exception (GH-13512)
Victor Stinner [Thu, 23 May 2019 01:45:09 +0000 (03:45 +0200)]
bpo-18748: _pyio.IOBase emits unraisable exception (GH-13512)

In development (-X dev) mode and in a debug build, IOBase finalizer
of the _pyio module now logs the exception if the close() method
fails. The exception is ignored silently by default in release build.

test_io: test_error_through_destructor() now uses
support.catch_unraisable_exception() rather than capturing stderr.

5 years agobpo-36721: Add --embed option to python-config (GH-13500)
Victor Stinner [Thu, 23 May 2019 01:30:23 +0000 (03:30 +0200)]
bpo-36721: Add --embed option to python-config (GH-13500)

To embed Python into an application, a new --embed option must be
passed to "python3-config --libs --embed" to get "-lpython3.8" (link
the application to libpython). To support both 3.8 and older, try
"python3-config --libs --embed" first and fallback to "python3-config
--libs" (without --embed) if the previous command fails.

Add a pkg-config "python-3.8-embed" module to embed Python into an
application: "pkg-config python-3.8-embed --libs" includes
"-lpython3.8".  To support both 3.8 and older, try "pkg-config
python-X.Y-embed --libs" first and fallback to "pkg-config python-X.Y
--libs" (without --embed) if the previous command fails (replace
"X.Y" with the Python version).

On the other hand, "pkg-config python3.8 --libs" no longer contains
"-lpython3.8". C extensions must not be linked to libpython (except
on Android, case handled by the script); this change is backward
incompatible on purpose.

"make install" now also installs "python-3.8-embed.pc".

5 years agobpo-27737: Allow whitespace only headers encoding (#13478)
Batuhan Taşkaya [Thu, 23 May 2019 01:13:16 +0000 (04:13 +0300)]
bpo-27737: Allow whitespace only headers encoding (#13478)

5 years agobpo-35091: Objects/listobject.c: Replace overflow checks in gallop fu… (GH-10202)
Alexey Izbyshev [Thu, 23 May 2019 00:01:08 +0000 (03:01 +0300)]
bpo-35091: Objects/listobject.c: Replace overflow checks in gallop fu… (GH-10202)

…nctions with asserts

The actual overflow can never happen because of the following:
* The size of a list can't be greater than PY_SSIZE_T_MAX / sizeof(PyObject*).
* The size of a pointer on all supported plaftorms is at least 4 bytes.
* ofs is positive and less than the list size at the beginning of each iteration.

https://bugs.python.org/issue35091

5 years agobpo-36829: PyErr_WriteUnraisable() normalizes exception (GH-13507)
Victor Stinner [Wed, 22 May 2019 23:00:58 +0000 (01:00 +0200)]
bpo-36829: PyErr_WriteUnraisable() normalizes exception (GH-13507)

PyErr_WriteUnraisable() now creates a traceback object if there is no
current traceback. Moreover, call PyErr_NormalizeException() and
PyException_SetTraceback() to normalize the exception value. Ignore
silently any error.

5 years agobpo-36763: Rename private Python initialization functions (GH-13511)
Victor Stinner [Wed, 22 May 2019 22:57:57 +0000 (00:57 +0200)]
bpo-36763: Rename private Python initialization functions (GH-13511)

* Rename private C functions:

  * _Py_Initialize_ReconfigureCore => pyinit_core_reconfigure
  * _Py_InitializeCore_impl => pyinit_core_config
  * _Py_InitializeCore = > pyinit_core
  * _Py_InitializeMainInterpreter => pyinit_main
  * init_python => pyinit_python

* Rename _testembed.c commands: add "test_" prefix.

5 years agobpo-36941: Project file fixups for Windows ARM64 (GH-13477)
Paul Monson [Wed, 22 May 2019 22:16:21 +0000 (15:16 -0700)]
bpo-36941: Project file fixups for Windows ARM64 (GH-13477)

5 years agobpo-36763: Add _PyPreConfig._config_init (GH-13481)
Victor Stinner [Wed, 22 May 2019 21:58:50 +0000 (23:58 +0200)]
bpo-36763: Add _PyPreConfig._config_init (GH-13481)

* _PyPreConfig_GetGlobalConfig() and  _PyCoreConfig_GetGlobalConfig()
  now do nothing if the configuration was not initialized with
  _PyPreConfig_InitCompatConfig() and _PyCoreConfig_InitCompatConfig()
* Remove utf8_mode=-2 special case: use utf8_mode=-1 instead.
* Fix _PyPreConfig_InitPythonConfig():

  * isolated = 0 instead of -1
  * use_environment = 1 instead of -1

* Rename _PyConfig_INIT to  _PyConfig_INIT_COMPAT
* Rename _PyPreConfig_Init() to _PyPreConfig_InitCompatConfig()
* Rename _PyCoreConfig_Init() to _PyCoreConfig_InitCompatConfig()
* PyInterpreterState_New() now uses _PyCoreConfig_InitPythonConfig()
  as default configuration, but it's very quickly overriden anyway.
* _freeze_importlib.c uses _PyCoreConfig_SetString() to set
  program_name.
* Cleanup preconfig_init_utf8_mode(): cmdline is always non-NULL.

5 years agobpo-36829: Add test.support.catch_unraisable_exception() (GH-13490)
Victor Stinner [Wed, 22 May 2019 21:44:02 +0000 (23:44 +0200)]
bpo-36829: Add test.support.catch_unraisable_exception() (GH-13490)

* Copy test_exceptions.test_unraisable() to
  test_sys.UnraisableHookTest().
* Use catch_unraisable_exception() in test_coroutines,
  test_exceptions, test_generators.

5 years agobpo-24882: Let ThreadPoolExecutor reuse idle threads before creating new thread ...
Sean [Wed, 22 May 2019 21:29:58 +0000 (14:29 -0700)]
bpo-24882: Let ThreadPoolExecutor reuse idle threads before creating new thread (#6375)

* Fixes issue 24882

* Add news file entry for change.

* Change test_concurrent_futures.ThreadPoolShutdownTest

Adjust the shutdown test so that, after submitting three jobs
to the executor, the test checks for less than three threads,
instead of looking for exactly three threads.

If idle threads are being recycled properly, then we should have
less than three threads.

* Switched idle count to semaphor, Updated tests

As suggested by reviewer tomMoral, swapped lock-protected counter
with a semaphore to track the number of unused threads.

Adjusted test_threads_terminate to wait for completiton of the
previous future before submitting a new one (and checking the
number of threads used).

Also added a new test to confirm the thread pool can be saturated.

* Updates tests as requested by pitrou.

* Correct minor whitespace error.

* Make test_saturation faster

5 years agobpo-33110: Catch errors raised when running add_done_callback on already completed...
Sam Martin [Wed, 22 May 2019 21:29:02 +0000 (22:29 +0100)]
bpo-33110: Catch errors raised when running add_done_callback on already completed futures (GH-13141)

Wrap the callback call within the `add_done_callback` function within concurrent.futures, in order to behave in an identical manner to callbacks added to a running future are triggered once it has completed.

5 years agobpo-36878: Only allow text after `# type: ignore` if first character ASCII (GH-13504)
Michael J. Sullivan [Wed, 22 May 2019 20:43:37 +0000 (13:43 -0700)]
bpo-36878: Only allow text after `# type: ignore` if first character ASCII (GH-13504)

This disallows things like `# type: ignoreé`, which seems wrong.

Also switch to using Py_ISALNUM for the alnum check, for consistency
with other code (and maybe correctness re: locale issues?).

https://bugs.python.org/issue36878

5 years agobpo-35907, CVE-2019-9948: urllib rejects local_file:// scheme (GH-13474)
Victor Stinner [Wed, 22 May 2019 20:15:01 +0000 (22:15 +0200)]
bpo-35907, CVE-2019-9948: urllib rejects local_file:// scheme (GH-13474)

CVE-2019-9948: Avoid file reading as disallowing the unnecessary URL
scheme in URLopener().open() and URLopener().retrieve()
of urllib.request.

Co-Authored-By: SH <push0ebp@gmail.com>
5 years agobpo-34616: Document top level async in whatsnew/3.8. (GH-13484)
Matthias Bussonnier [Wed, 22 May 2019 19:07:45 +0000 (12:07 -0700)]
bpo-34616: Document top level async in whatsnew/3.8. (GH-13484)

https://bugs.python.org/issue34616

5 years agobpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)
Jake Tesler [Wed, 22 May 2019 15:43:17 +0000 (08:43 -0700)]
bpo-36084: Add native thread ID (TID) to threading.Thread (GH-13463)

Add native thread ID (TID) to threading.Thread objects
(supported platforms: Windows, FreeBSD, Linux, macOS).

5 years agobpo-33482: fix codecs.StreamRecoder.writelines (GH-6779)
Jelle Zijlstra [Wed, 22 May 2019 15:18:26 +0000 (08:18 -0700)]
bpo-33482: fix codecs.StreamRecoder.writelines (GH-6779)

A very simple fix. I found this while writing typeshed stubs for StreamRecoder.

https://bugs.python.org/issue33482