]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
5 years agocloses bpo-39922: Remove unused args from four functions. (GH-18893)
Andy Lester [Wed, 11 Mar 2020 02:18:12 +0000 (21:18 -0500)] 
closes bpo-39922: Remove unused args from four functions. (GH-18893)

5 years agoUpdates functools.py with consistent quotes (GH-18825)
Nikita Sobolev [Wed, 11 Mar 2020 00:32:15 +0000 (03:32 +0300)] 
Updates functools.py with consistent quotes (GH-18825)

I have noticed that `'` quotes are used everywhere except this particular case,
which was introduced in https://github.com/python/cpython/pull/18726

So, this is a trivial fix to enforce better consistency.

5 years agobpo-38631: _PyGILState_Init() returns PyStatus (GH-18908)
Victor Stinner [Tue, 10 Mar 2020 22:49:16 +0000 (23:49 +0100)] 
bpo-38631: _PyGILState_Init() returns PyStatus (GH-18908)

_PyGILState_Init() now returns PyStatus rather than calling
Py_FatalError() on failure.

5 years agobpo-38662: ensurepip invokes pip via runpy (GH-18901)
Miro Hrončok [Tue, 10 Mar 2020 21:16:28 +0000 (22:16 +0100)] 
bpo-38662: ensurepip invokes pip via runpy (GH-18901)

The ensurepip module now invokes pip via the runpy module.
Hence it is no longer tightly coupled with the internal API of the bundled
pip version, allowing easier updates to a newer pip version both
internally and for distributors.

This way, any changes to the internal pip API won't mean ensurepip needs to be
changed as well. Also, distributors can update their pip wheels independent on
CPython release schedule.

Co-Authored-By: Pradyun Gedam <pradyunsg@gmail.com>
Co-Authored-By: Miro Hrončok <miro@hroncok.cz>
5 years agotracemalloc: 'pretty top' example no longer changes the filename (GH-18903)
Adam Johnson [Tue, 10 Mar 2020 18:18:50 +0000 (18:18 +0000)] 
tracemalloc: 'pretty top' example no longer changes the filename (GH-18903)

I've used this recipe a couple times and the filename editing has always
been less than useful and something I've removed. This is because many
modules end up losing which package they are located in, e.g. `util/date.py`.

5 years agobpo-34822: Simplify AST for subscription. (GH-9605)
Serhiy Storchaka [Tue, 10 Mar 2020 16:52:34 +0000 (18:52 +0200)] 
bpo-34822: Simplify AST for subscription. (GH-9605)

* Remove the slice type.
* Make Slice a kind of the expr type instead of the slice type.
* Replace ExtSlice(slices) with Tuple(slices, Load()).
* Replace Index(value) with a value itself.

All non-terminal nodes in AST for expressions are now of the expr type.

5 years agobpo-39869: Fix typo in 'Instance objects' section. (GH-18889)
Antoine [Tue, 10 Mar 2020 14:17:40 +0000 (15:17 +0100)] 
bpo-39869: Fix typo in 'Instance objects' section. (GH-18889)

5 years agobpo-38075: Fix random_seed(): use PyObject_CallOneArg() (GH-18897)
Victor Stinner [Tue, 10 Mar 2020 14:15:14 +0000 (15:15 +0100)] 
bpo-38075: Fix random_seed(): use PyObject_CallOneArg() (GH-18897)

Fix the random.Random.seed() method when a bool is passed as the
seed.

PyObject_Vectorcall() was misused: use PyObject_CallOneArg() instead.

5 years agobpo-1294959: Add sys.platlibdir attribute (GH-18381)
Victor Stinner [Tue, 10 Mar 2020 08:53:09 +0000 (09:53 +0100)] 
bpo-1294959: Add sys.platlibdir attribute (GH-18381)

Add --with-platlibdir option to the configure script: name of the
platform-specific library directory, stored in the new sys.platlitdir
attribute. It is used to build the path of platform-specific dynamic
libraries and the path of the standard library.

It is equal to "lib" on most platforms. On Fedora and SuSE, it is
equal to "lib64" on 64-bit systems.

Co-Authored-By: Jan Matějek <jmatejek@suse.com>
Co-Authored-By: Matěj Cepl <mcepl@cepl.eu>
Co-Authored-By: Charalampos Stratakis <cstratak@redhat.com>
5 years agobpo-39828: Fix json.tool to catch BrokenPipeError (GH-18779)
Dong-hee Na [Tue, 10 Mar 2020 07:41:44 +0000 (16:41 +0900)] 
bpo-39828: Fix json.tool to catch BrokenPipeError (GH-18779)

5 years agobpo-39877: Deprecate PyEval_InitThreads() (GH-18892)
Victor Stinner [Tue, 10 Mar 2020 00:28:54 +0000 (01:28 +0100)] 
bpo-39877: Deprecate PyEval_InitThreads() (GH-18892)

Deprecated PyEval_InitThreads() and PyEval_ThreadsInitialized().
Calling PyEval_InitThreads() now does nothing.

5 years agobpo-39877: PyGILState_Ensure() don't call PyEval_InitThreads() (GH-18891)
Victor Stinner [Mon, 9 Mar 2020 23:37:48 +0000 (00:37 +0100)] 
bpo-39877: PyGILState_Ensure() don't call PyEval_InitThreads() (GH-18891)

PyGILState_Ensure() doesn't call PyEval_InitThreads() anymore when a
new Python thread state is created. The GIL is created by
Py_Initialize() since Python 3.7, it's not needed to call
PyEval_InitThreads() explicitly.

Add an assertion to ensure that the GIL is already created.

5 years agobpo-39763: Add _bootsubprocess to build Python on AIX (GH-18872)
Victor Stinner [Mon, 9 Mar 2020 22:45:59 +0000 (23:45 +0100)] 
bpo-39763: Add _bootsubprocess to build Python on AIX (GH-18872)

Add _bootsubprocess module to bootstrap Python: subprocess
implementation which only uses the os module.

On AIX, distutils.util uses _aix_support which calls
subprocess.check_output(), before the _posixsubprocess module is
built. Implement check_output() with os.system() in _bootsubprocess.

5 years agobpo-19466: Py_Finalize() clears daemon threads earlier (GH-18848)
Victor Stinner [Mon, 9 Mar 2020 22:37:49 +0000 (23:37 +0100)] 
bpo-19466: Py_Finalize() clears daemon threads earlier (GH-18848)

Clear the frames of daemon threads earlier during the Python shutdown to
call objects destructors. So "unclosed file" resource warnings are now
emitted for daemon threads in a more reliable way.

Cleanup _PyThreadState_DeleteExcept() code: rename "garbage" to
"list".

5 years agobpo-28577: Special case added to IP v4 and v6 hosts for /32 and /128 networks (GH...
Pete Wicken [Mon, 9 Mar 2020 22:33:45 +0000 (22:33 +0000)] 
bpo-28577: Special case added to IP v4 and v6 hosts for /32 and /128 networks (GH-18757)

The `.hosts()` method now returns the single address present in a /32 or /128 network.

5 years agobpo-39877: take_gil() checks tstate_must_exit() twice (GH-18890)
Victor Stinner [Mon, 9 Mar 2020 22:10:53 +0000 (23:10 +0100)] 
bpo-39877: take_gil() checks tstate_must_exit() twice (GH-18890)

take_gil() now also checks tstate_must_exit() after acquiring
the GIL: exit the thread if Py_Finalize() has been called.

5 years agobpo-36287: Make ast.dump() not output optional fields and attributes with default...
Serhiy Storchaka [Mon, 9 Mar 2020 22:07:47 +0000 (00:07 +0200)] 
bpo-36287: Make ast.dump() not output optional fields and attributes with default values. (GH-18843)

The default values for optional fields and attributes of AST nodes are now set
as class attributes (e.g. Constant.kind is set to None).

5 years agobpo-39877: Refactor take_gil() function (GH-18885)
Victor Stinner [Mon, 9 Mar 2020 21:12:04 +0000 (22:12 +0100)] 
bpo-39877: Refactor take_gil() function (GH-18885)

* Remove ceval parameter of take_gil(): get it from tstate.
* Move exit_thread_if_finalizing() call inside take_gil(). Replace
  exit_thread_if_finalizing() with tstate_must_exit(): the caller is
  now responsible to call PyThread_exit_thread().
* Move is_tstate_valid() assertion inside take_gil(). Remove
  is_tstate_valid(): inline code into take_gil().
* Move gil_created() assertion inside take_gil().

5 years agobpo-27115: Use Query subclass for IDLE editor Goto (GH-18871)
Terry Jan Reedy [Mon, 9 Mar 2020 20:51:20 +0000 (16:51 -0400)] 
bpo-27115: Use Query subclass for IDLE editor Goto (GH-18871)

Replace tkinter tkSimpleDialog.askinteger with a standard IDLE query dialog.
The new box checks for positivity before returning.

5 years agobpo-38870: Simplify sequence interleaves in ast.unparse (GH-17892)
Batuhan Taşkaya [Mon, 9 Mar 2020 20:27:03 +0000 (23:27 +0300)] 
bpo-38870: Simplify sequence interleaves in ast.unparse (GH-17892)

5 years agobpo-39877: Py_Initialize() pass tstate to PyEval_InitThreads() (GH-18884)
Victor Stinner [Mon, 9 Mar 2020 20:24:14 +0000 (21:24 +0100)] 
bpo-39877: Py_Initialize() pass tstate to PyEval_InitThreads() (GH-18884)

5 years agobpo-39877: Remove useless PyEval_InitThreads() calls (GH-18883)
Victor Stinner [Mon, 9 Mar 2020 19:56:57 +0000 (20:56 +0100)] 
bpo-39877: Remove useless PyEval_InitThreads() calls (GH-18883)

Py_Initialize() calls PyEval_InitThreads() since Python 3.7. It's no
longer needed to call it explicitly.

5 years agobpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the release mode...
Serhiy Storchaka [Mon, 9 Mar 2020 18:49:52 +0000 (20:49 +0200)] 
bpo-38249: Expand Py_UNREACHABLE() to __builtin_unreachable() in the release mode. (GH-16329)

Co-authored-by: Victor Stinner <vstinner@python.org>
5 years agobpo-36184: Port python-gdb.py to FreeBSD (GH-18873)
Victor Stinner [Mon, 9 Mar 2020 18:35:26 +0000 (19:35 +0100)] 
bpo-36184: Port python-gdb.py to FreeBSD (GH-18873)

python-gdb.py now checks for "take_gil" function name to check if a
frame tries to acquire the GIL, instead of checking for
"pthread_cond_timedwait" which is specific to Linux and can be a
different condition than the GIL.

5 years agobpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with...
Serhiy Storchaka [Mon, 9 Mar 2020 18:03:38 +0000 (20:03 +0200)] 
bpo-38643: Raise SystemError instead of crashing when PyNumber_ToBase is called with invalid base. (GH-18863)

5 years agobpo-39904: Move handling of one-argument call of type() from type.__new__() to type...
Serhiy Storchaka [Mon, 9 Mar 2020 17:59:03 +0000 (19:59 +0200)] 
bpo-39904: Move handling of one-argument call of type() from type.__new__() to type.__call__(). (GH-18852)

5 years agobpo-39850: Add support for abstract sockets in multiprocessing (GH-18866)
Pablo Galindo [Mon, 9 Mar 2020 13:48:01 +0000 (13:48 +0000)] 
bpo-39850: Add support for abstract sockets in multiprocessing (GH-18866)

5 years agobpo-39822: Use NULL instead of None for empty attrib in Element. (GH-18735)
Serhiy Storchaka [Mon, 9 Mar 2020 13:12:41 +0000 (15:12 +0200)] 
bpo-39822: Use NULL instead of None for empty attrib in Element. (GH-18735)

5 years agobpo-39903: Fix double decref in _elementtree.Element.__getstate__ (GH-18850)
Serhiy Storchaka [Mon, 9 Mar 2020 12:37:08 +0000 (14:37 +0200)] 
bpo-39903: Fix double decref in _elementtree.Element.__getstate__ (GH-18850)

5 years agobpo-38691: importlib ignores PYTHONCASEOK if -E is used (GH-18627)
idomic [Mon, 9 Mar 2020 11:57:53 +0000 (07:57 -0400)] 
bpo-38691: importlib ignores PYTHONCASEOK if -E is used (GH-18627)

The importlib module now ignores the PYTHONCASEOK
environment variable when the -E or -I command line
options are being used.

5 years agobpo-27115: Move IDLE Query error blanking (GH-18868)
Terry Jan Reedy [Mon, 9 Mar 2020 05:38:07 +0000 (01:38 -0400)] 
bpo-27115: Move IDLE Query error blanking (GH-18868)

Move required blanking of error text to non-overridden entry_ok().
(Omit news item.)

5 years agoFix typo in the parser generator (GH-18603)
xatier [Mon, 9 Mar 2020 02:58:24 +0000 (19:58 -0700)] 
Fix typo in the parser generator (GH-18603)

5 years agobpo-39517: Allow runpy.run_path() to accept path-like objects (GH-18699)
Maor Kleinberger [Sun, 8 Mar 2020 20:43:17 +0000 (22:43 +0200)] 
bpo-39517: Allow runpy.run_path() to accept path-like objects (GH-18699)

5 years ago bpo-39885: IDLE context menu clears selection (#18859)
Terry Jan Reedy [Sun, 8 Mar 2020 19:30:04 +0000 (15:30 -0400)] 
 bpo-39885: IDLE context menu clears selection  (#18859)

Since clicking to get an IDLE context menu moves the cursor,
any text selection should be and now is cleared.

5 years agobpo-39852: IDLE 'Go to line' deletes selection, updates status (GH-18801)
Terry Jan Reedy [Sun, 8 Mar 2020 18:32:42 +0000 (14:32 -0400)] 
bpo-39852: IDLE 'Go to line' deletes selection, updates status (GH-18801)

It appears standard that moving the text insert cursor away from a selection clears the
selection.  Clearing prevents accidental deletion of a possibly off-screen bit of text.
The update is for Ln and Col on the status bar.

5 years agofix typo: add space (GH-18853)
Julin S [Sun, 8 Mar 2020 17:52:15 +0000 (23:22 +0530)] 
fix typo: add space (GH-18853)

Fix typo in cmdline.rst
Add space between the `-m` option and the module name (`timeit`).

5 years agocloses bpo-39898: Remove unused arg from append_formattedvalue. (GH-18840)
Andy Lester [Sun, 8 Mar 2020 16:53:59 +0000 (11:53 -0500)] 
closes bpo-39898: Remove unused arg from append_formattedvalue. (GH-18840)

5 years agobpo-39567: Document audit for os.walk, os.fwalk, Path.glob and Path.rglob. (GH-18499)
Serhiy Storchaka [Sun, 8 Mar 2020 12:31:47 +0000 (14:31 +0200)] 
bpo-39567: Document audit for os.walk, os.fwalk, Path.glob and Path.rglob. (GH-18499)

5 years agobpo-39877: Fix PyEval_RestoreThread() for daemon threads (GH-18811)
Victor Stinner [Sun, 8 Mar 2020 10:57:45 +0000 (11:57 +0100)] 
bpo-39877: Fix PyEval_RestoreThread() for daemon threads (GH-18811)

* exit_thread_if_finalizing() does now access directly _PyRuntime
  variable, rather than using tstate->interp->runtime since tstate
  can be a dangling pointer after Py_Finalize() has been called.
* exit_thread_if_finalizing() is now called *before* calling
  take_gil(). _PyRuntime.finalizing is an atomic variable,
  we don't need to hold the GIL to access it.
* Add ensure_tstate_not_null() function to check that tstate is not
  NULL at runtime. Check tstate earlier. take_gil() does not longer
  check if tstate is NULL.

Cleanup:

* PyEval_RestoreThread() no longer saves/restores errno: it's already
  done inside take_gil().
* PyEval_AcquireLock(), PyEval_AcquireThread(),
  PyEval_RestoreThread() and _PyEval_EvalFrameDefault() now check if
  tstate is valid with the new is_tstate_valid() function which uses
  _PyMem_IsPtrFreed().

5 years agobpo-39890: Don't mutate the AST when compiling starred assignments (GH-18833)
Brandt Bucher [Sun, 8 Mar 2020 03:44:18 +0000 (19:44 -0800)] 
bpo-39890: Don't mutate the AST when compiling starred assignments (GH-18833)

5 years agobpo-36144: Update MappingProxyType with PEP 584's operators (#18814)
Brandt Bucher [Sat, 7 Mar 2020 19:03:09 +0000 (11:03 -0800)] 
bpo-36144: Update MappingProxyType with PEP 584's operators (#18814)

We make `|=` raise TypeError, since it would be surprising if `C.__dict__ |= {'x': 0}` silently did nothing, while `C.__dict__.update({'x': 0})` is an error.

5 years agobpo-39702: Update the Language Reference (PEP 614) (GH-18802)
Brandt Bucher [Sat, 7 Mar 2020 18:23:49 +0000 (10:23 -0800)] 
bpo-39702: Update the Language Reference (PEP 614) (GH-18802)

5 years agobpo-39199: Use 'eval' mode for the examples with expression nodes (GH-18828)
Pablo Galindo [Sat, 7 Mar 2020 18:22:58 +0000 (18:22 +0000)] 
bpo-39199: Use 'eval' mode for the examples with expression nodes (GH-18828)

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
5 years agobpo-38894: Fix pathlib.Path.glob in the presence of symlinks and insufficient permiss...
Pablo Galindo [Sat, 7 Mar 2020 17:53:20 +0000 (17:53 +0000)] 
bpo-38894: Fix pathlib.Path.glob in the presence of symlinks and insufficient permissions (GH-18815)

Co-authored-by: Matt Wozniski <mwozniski@bloomberg.net>
5 years agocloses bpo-39886: Remove unused arg from config_get_stdio_errors. (GH-18823)
Andy Lester [Sat, 7 Mar 2020 17:36:04 +0000 (11:36 -0600)] 
closes bpo-39886: Remove unused arg from config_get_stdio_errors. (GH-18823)

5 years agocloses bpo-39878: Remove unused arguments from static functions. (GH-18822)
Andy Lester [Sat, 7 Mar 2020 17:29:10 +0000 (11:29 -0600)] 
closes bpo-39878: Remove unused arguments from static functions. (GH-18822)

calc_number_widths -> PyObject *number

fill_number -> Py_ssize_t d_end

5 years agobpo-39889: Fix ast.unparse() for subscript. (GH-18824)
Serhiy Storchaka [Sat, 7 Mar 2020 15:25:32 +0000 (17:25 +0200)] 
bpo-39889: Fix ast.unparse() for subscript. (GH-18824)

5 years agobpo-39837: Disable macOS tests on Azure Pipelines (GH-18818)
Steve Dower [Sat, 7 Mar 2020 00:11:47 +0000 (00:11 +0000)] 
bpo-39837: Disable macOS tests on Azure Pipelines (GH-18818)

5 years agobpo-39882: Py_FatalError() logs the function name (GH-18819)
Victor Stinner [Fri, 6 Mar 2020 23:54:20 +0000 (00:54 +0100)] 
bpo-39882: Py_FatalError() logs the function name (GH-18819)

The Py_FatalError() function is replaced with a macro which logs
automatically the name of the current function, unless the
Py_LIMITED_API macro is defined.

Changes:

* Add _Py_FatalErrorFunc() function.
* Remove the function name from the message of Py_FatalError() calls
  which included the function name.
* Update tests.

5 years agobpo-39877: _PyRuntimeState.finalizing becomes atomic (GH-18816)
Victor Stinner [Fri, 6 Mar 2020 23:24:23 +0000 (00:24 +0100)] 
bpo-39877: _PyRuntimeState.finalizing becomes atomic (GH-18816)

Convert _PyRuntimeState.finalizing field to an atomic variable:

* Rename it to _finalizing
* Change its type to _Py_atomic_address
* Add _PyRuntimeState_GetFinalizing() and _PyRuntimeState_SetFinalizing()
  functions
* Remove _Py_CURRENTLY_FINALIZING() function: replace it with testing
  directly _PyRuntimeState_GetFinalizing() value

Convert _PyRuntimeState_GetThreadState() to static inline function.

5 years ago bpo-39573: Use Py_IS_TYPE() macro to check for types (GH-18809)
Andy Lester [Fri, 6 Mar 2020 22:53:17 +0000 (16:53 -0600)] 
 bpo-39573: Use Py_IS_TYPE() macro to check for types (GH-18809)

Co-authored-by: Victor Stinner <vstinner@python.org>
5 years agobpo-17422: slightly more precise language (GH-18682)
Caleb Donovick [Fri, 6 Mar 2020 18:20:48 +0000 (10:20 -0800)] 
bpo-17422: slightly more precise language (GH-18682)

5 years agobpo-39873: Cleanup _PyObject_CheckConsistency() (GH-18807)
Victor Stinner [Fri, 6 Mar 2020 17:57:48 +0000 (18:57 +0100)] 
bpo-39873: Cleanup _PyObject_CheckConsistency() (GH-18807)

Remove redundant check on Py_TYPE() value: it's already checked
inside _PyType_CheckConsistency().

5 years agobpo-36144: Implement defaultdict union (GH-18729)
Brandt Bucher [Fri, 6 Mar 2020 17:24:08 +0000 (09:24 -0800)] 
bpo-36144: Implement defaultdict union (GH-18729)

For PEP 585 (this isn't in the PEP but is an obvious follow-up).

5 years agocloses bpo-39872: Remove unused args from symtable_exit_block and symtable_visit_anno...
Andy Lester [Fri, 6 Mar 2020 15:46:04 +0000 (09:46 -0600)] 
closes bpo-39872: Remove unused args from symtable_exit_block and symtable_visit_annotations. (GH-18800)

5 years agobpo-39873: PyObject_Init() uses PyObject_INIT() (GH-18804)
Victor Stinner [Fri, 6 Mar 2020 14:55:14 +0000 (15:55 +0100)] 
bpo-39873: PyObject_Init() uses PyObject_INIT() (GH-18804)

Avoid duplicated code:

* PyObject_Init() uses PyObject_INIT()
* PyObject_InitVar() uses PyObject_INIT_VAR()

5 years agoPyPy already supports Python 3 (GH-18774)
Slam [Fri, 6 Mar 2020 11:08:17 +0000 (12:08 +0100)] 
PyPy already supports Python 3 (GH-18774)

5 years agobpo-39573: Make Py_IS_TYPE() take constant parameters (GH-18799)
Andy Lester [Fri, 6 Mar 2020 08:03:58 +0000 (02:03 -0600)] 
bpo-39573: Make Py_IS_TYPE() take constant parameters (GH-18799)

Add _PyObject_CAST_CONST() macro: cast a pointer to (const PyObject *).

5 years agobpo-39868: Update Language Reference for PEP 572. (#18793)
Brandt Bucher [Fri, 6 Mar 2020 05:19:22 +0000 (21:19 -0800)] 
bpo-39868: Update Language Reference for PEP 572. (#18793)

5 years agocloses bpo-39859: Do not downcast result of hstrerror (GH-18790)
Andy Lester [Fri, 6 Mar 2020 04:43:36 +0000 (22:43 -0600)] 
closes bpo-39859: Do not downcast result of hstrerror (GH-18790)

set_herror builds a string by calling hstrerror but downcasts its return value to char *.  It should be const char *.

Automerge-Triggered-By: @benjaminp
5 years agocloses bpo-39870: Remove unused arg from sys_displayhook_unencodable. (GH-18796)
Andy Lester [Fri, 6 Mar 2020 04:34:36 +0000 (22:34 -0600)] 
closes bpo-39870: Remove unused arg from sys_displayhook_unencodable. (GH-18796)

Also move int err to its innermost scope.

5 years agoIDLE doc: improve Startup failure subsection. (#18771)
Jules Lasne (jlasne) [Fri, 6 Mar 2020 01:28:14 +0000 (02:28 +0100)] 
IDLE doc: improve Startup failure subsection. (#18771)

Eliminate repeat of 'Options', reported by Jules Lasne, and improve wording elsewhere.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
5 years agoAdd a comment to _Py_RestoreSignals() (GH-18792)
Victor Stinner [Thu, 5 Mar 2020 17:13:56 +0000 (18:13 +0100)] 
Add a comment to _Py_RestoreSignals() (GH-18792)

subprocess _posix_spawn() should stay in sync with _Py_RestoreSignals().

5 years agobpo-39855: Fix test_subprocess if nobody user doesn't exist (GH-18781)
Victor Stinner [Thu, 5 Mar 2020 13:28:40 +0000 (14:28 +0100)] 
bpo-39855: Fix test_subprocess if nobody user doesn't exist (GH-18781)

test_subprocess.test_user() now skips the test on an user name if the
user name doesn't exist. For example, skip the test if the user
"nobody" doesn't exist on Linux.

5 years agobpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)
Gregory P. Smith [Thu, 5 Mar 2020 00:45:22 +0000 (16:45 -0800)] 
bpo-13487: Use sys.modules.copy() in inspect.getmodule() for thread safety. (GH-18786)

`list(sys.modules.items())` was apparently not immune to "dictionary
changed size during iteration" errors.

Tested internally using an integration test that has run into this a couple of times in the past two years.  With this patch applied, the test is no longer flaky.

5 years agoAdd a missing space after a period in 'typing.TypedDict' documentation (GH-18784)
Miss Islington (bot) [Thu, 5 Mar 2020 00:12:28 +0000 (16:12 -0800)] 
Add a missing space after a period in 'typing.TypedDict' documentation (GH-18784)

5 years agobpo-39808: Improve docs for pathlib.Path.stat() (GH-18719)
Brett Cannon [Wed, 4 Mar 2020 22:51:50 +0000 (14:51 -0800)] 
bpo-39808: Improve docs for pathlib.Path.stat() (GH-18719)

5 years agobpo-39674: Revert "bpo-37330: open() no longer accept 'U' in file mode (GH-16959...
Victor Stinner [Wed, 4 Mar 2020 17:50:22 +0000 (18:50 +0100)] 
bpo-39674: Revert "bpo-37330: open() no longer accept 'U' in file mode (GH-16959)" (GH-18767)

This reverts commit e471e72977c83664f13d041c78549140c86c92de.

The mode will be removed from Python 3.10.

5 years agobpo-39763: Refactor setup.py (GH-18778)
Victor Stinner [Wed, 4 Mar 2020 17:44:49 +0000 (18:44 +0100)] 
bpo-39763: Refactor setup.py (GH-18778)

Split long build_extensions() method into sub-methods.

Fix also a typo in Popen.wait(): replace sts with status.

5 years agobpo-39639: Remove the AST "Suite" node and associated code (GH-18513)
Batuhan Taşkaya [Wed, 4 Mar 2020 16:16:47 +0000 (19:16 +0300)] 
bpo-39639: Remove the AST "Suite" node and associated code (GH-18513)

The AST "Suite" node is no longer used and it can be removed from the ASDL definition and related structures (compiler, visitors, ...).

Co-Authored-By: Victor Stinner <vstinner@python.org>
Co-authored-by: Brett Cannon <54418+brettcannon@users.noreply.github.com>
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
5 years agobpo-39770, array module: Remove unnecessary descriptor counting (GH-18675)
Andy Lester [Wed, 4 Mar 2020 14:52:15 +0000 (08:52 -0600)] 
bpo-39770, array module: Remove unnecessary descriptor counting (GH-18675)

5 years agobpo-39674: Fix typo in What's New In Python 3.9 (GH-18776)
Victor Stinner [Wed, 4 Mar 2020 14:11:43 +0000 (15:11 +0100)] 
bpo-39674: Fix typo in What's New In Python 3.9 (GH-18776)

5 years agobpo-39763: distutils.spawn now uses subprocess (GH-18743)
Victor Stinner [Wed, 4 Mar 2020 13:50:19 +0000 (14:50 +0100)] 
bpo-39763: distutils.spawn now uses subprocess (GH-18743)

Reimplement distutils.spawn.spawn() function with the subprocess
module.

setup.py now uses a basic implementation of the subprocess module if
the subprocess module is not available: before required C extension
modules are built.

5 years agobpo-39573: Finish converting to new Py_IS_TYPE() macro (GH-18601)
Andy Lester [Wed, 4 Mar 2020 13:15:20 +0000 (07:15 -0600)] 
bpo-39573: Finish converting to new Py_IS_TYPE() macro (GH-18601)

5 years agobpo-39826: add getConnection() hook to logging HTTPHandler (GH-18745)
l0rb [Wed, 4 Mar 2020 10:49:51 +0000 (11:49 +0100)] 
bpo-39826: add getConnection() hook to logging HTTPHandler (GH-18745)

5 years agobpo-39702: Relax grammar restrictions on decorators (PEP 614) (GH-18570)
Brandt Bucher [Tue, 3 Mar 2020 22:25:44 +0000 (14:25 -0800)] 
bpo-39702: Relax grammar restrictions on decorators (PEP 614) (GH-18570)

5 years agobpo-39674: Suggest to test with DeprecationWarning (GH-18552)
Victor Stinner [Tue, 3 Mar 2020 21:52:20 +0000 (22:52 +0100)] 
bpo-39674: Suggest to test with DeprecationWarning (GH-18552)

Add a section in What's New In Python 3.9 to strongly advice to check
for DeprecationWarning in your Python projects.

Co-authored-by: Hugo van Kemenade <hugovk@users.noreply.github.com>
5 years agobpo-35712: Make using NotImplemented in a boolean context issue a deprecation warning...
MojoVampire [Tue, 3 Mar 2020 18:50:17 +0000 (18:50 +0000)] 
bpo-35712: Make using NotImplemented in a boolean context issue a deprecation warning (GH-13195)

5 years agobpo-39831: Remove outdated comment. (GH-18764)
Serhiy Storchaka [Tue, 3 Mar 2020 17:43:29 +0000 (19:43 +0200)] 
bpo-39831: Remove outdated comment. (GH-18764)

5 years agobpo-39674: Update collections ABC deprecation doc (GH-18747)
Victor Stinner [Tue, 3 Mar 2020 16:31:11 +0000 (17:31 +0100)] 
bpo-39674: Update collections ABC deprecation doc (GH-18747)

5 years agobpo-12915: Skip test_pkgutil.test_name_resolution() non-encodable filenames (GH-18720)
Michael Felt [Tue, 3 Mar 2020 10:11:11 +0000 (11:11 +0100)] 
bpo-12915: Skip test_pkgutil.test_name_resolution() non-encodable filenames (GH-18720)

When filesystem encoding cannot encode the Unicode string used for a filename
continue testing with the next example.

5 years agobpo-39778: Add clarification about tp_traverse and ownership (GH-18754)
Pablo Galindo [Tue, 3 Mar 2020 02:50:40 +0000 (02:50 +0000)] 
bpo-39778: Add clarification about tp_traverse and ownership (GH-18754)

Automerge-Triggered-By: @pablogsal
5 years agobpo-39802: Only expose set_escdelay and set_tabsize when curses extensions are activa...
Batuhan Taşkaya [Tue, 3 Mar 2020 02:00:10 +0000 (05:00 +0300)] 
bpo-39802: Only expose set_escdelay and set_tabsize when curses extensions are activated (GH-18705)

5 years agobpo-38091: Import deadlock detection causes deadlock (GH-17518)
Armin Rigo [Tue, 3 Mar 2020 01:37:25 +0000 (02:37 +0100)] 
bpo-38091: Import deadlock detection causes deadlock (GH-17518)

Automerge-Triggered-By: @brettcannon
5 years agobpo-38597: Never statically link extension initialization code on Windows (GH-18724)
Steve Dower [Tue, 3 Mar 2020 00:04:11 +0000 (00:04 +0000)] 
bpo-38597: Never statically link extension initialization code on Windows (GH-18724)

5 years agobpo-39778: Don't traverse weak-reference lists OrderedDict's tp_traverse and tp_clear...
Pablo Galindo [Mon, 2 Mar 2020 23:12:54 +0000 (23:12 +0000)] 
bpo-39778: Don't traverse weak-reference lists OrderedDict's tp_traverse and tp_clear (GH-18749)

Objects do not own weak references to them directly through the __weakref__ list so these
do not need to be traversed by the GC.

5 years ago bpo-39776: Lock ++interp->tstate_next_unique_id. (GH-18746) (#18746)
Stefan Krah [Mon, 2 Mar 2020 20:22:36 +0000 (21:22 +0100)] 
 bpo-39776: Lock ++interp->tstate_next_unique_id. (GH-18746) (#18746)

  - Threads created by PyGILState_Ensure() could have a duplicate tstate->id.

5 years agobpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750)
Serhiy Storchaka [Mon, 2 Mar 2020 20:05:08 +0000 (22:05 +0200)] 
bpo-39831: Fix a reference leak in PyErr_WarnEx(). (GH-18750)

5 years agobpo-38870: Add docstring support to ast.unparse (GH-17760)
Batuhan Taşkaya [Mon, 2 Mar 2020 18:59:01 +0000 (21:59 +0300)] 
bpo-38870: Add docstring support to ast.unparse (GH-17760)

Allow ast.unparse to detect docstrings in functions, modules and classes and produce
nicely formatted unparsed output for said docstrings.

Co-Authored-By: Pablo Galindo <Pablogsal@gmail.com>
5 years agobpo-39796: Fix _warnings module initialization (GH-18739)
Victor Stinner [Mon, 2 Mar 2020 14:02:18 +0000 (15:02 +0100)] 
bpo-39796: Fix _warnings module initialization (GH-18739)

* Add _PyWarnings_InitState() which only initializes the _warnings
  module state (tstate->interp->warnings) without creating a module
  object
* Py_InitializeFromConfig() now calls _PyWarnings_InitState() instead
  of _PyWarnings_Init()
* Rename also private functions of _warnings.c to avoid confusion
  between the public C API and the private C API.

5 years agobpo-39764: Make Task.get_stack accept ag_frame (#18669)
Lidi Zheng [Mon, 2 Mar 2020 12:45:54 +0000 (04:45 -0800)] 
bpo-39764: Make Task.get_stack accept ag_frame (#18669)

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-38380: Update macOS & Windows builds to SQLite v3.31.1 (GH-18678)
Erlend Egeberg Aasland [Mon, 2 Mar 2020 12:25:10 +0000 (13:25 +0100)] 
bpo-38380: Update macOS & Windows builds to SQLite v3.31.1 (GH-18678)

Automerge-Triggered-By: @zooba
5 years agobpo-39775: inspect: Change Signature.parameters back to OrderedDict. (GH-18684)
Inada Naoki [Mon, 2 Mar 2020 09:54:49 +0000 (18:54 +0900)] 
bpo-39775: inspect: Change Signature.parameters back to OrderedDict. (GH-18684)

5 years agoFix misleading statement about mixed-type numeric comparisons (GH-18615)
Mark Dickinson [Mon, 2 Mar 2020 08:57:27 +0000 (08:57 +0000)] 
Fix misleading statement about mixed-type numeric comparisons (GH-18615)

5 years agobpo-38913: Fix segfault in Py_BuildValue("(s#O)", ...) if entered with exception...
Serhiy Storchaka [Mon, 2 Mar 2020 06:42:39 +0000 (08:42 +0200)] 
bpo-38913: Fix segfault in Py_BuildValue("(s#O)", ...) if entered with exception raised. (GH-18656)

5 years agobpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666)
Chris A [Mon, 2 Mar 2020 06:39:50 +0000 (01:39 -0500)] 
bpo-38971: Open file in codecs.open() closes if exception raised. (GH-17666)

Open issue in the BPO indicated a desire to make the implementation of
codecs.open() at parity with io.open(), which implements a try/except to
assure file stream gets closed before an exception is raised.

5 years agobpo-39495: Remove default value from C impl of TreeBuilder.start (GH-18275)
Shantanu [Mon, 2 Mar 2020 06:33:24 +0000 (22:33 -0800)] 
bpo-39495: Remove default value from C impl of TreeBuilder.start (GH-18275)

5 years agobpo-39378: partial of PickleState struct should be traversed. (GH-18046)
Hai Shi [Mon, 2 Mar 2020 06:28:44 +0000 (14:28 +0800)] 
bpo-39378: partial of PickleState struct should be traversed. (GH-18046)

5 years agobpo-39199: Add descriptions of non-deprecated nodes to the AST module documentation...
Pablo Galindo [Mon, 2 Mar 2020 03:14:06 +0000 (03:14 +0000)] 
bpo-39199: Add descriptions of non-deprecated nodes to the AST module documentation (GH-17812)

Adapted from https://greentreesnakes.readthedocs.io

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
Co-authored-by: Carol Willing <carolcode@willingconsulting.com>
5 years agocloses bpo-39803: Remove unused str from _PyLong_FormatAdvancedWriter. (GH-18709)
Andy Lester [Sun, 1 Mar 2020 21:26:43 +0000 (15:26 -0600)] 
closes bpo-39803: Remove unused str from _PyLong_FormatAdvancedWriter. (GH-18709)