]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
5 years agobpo-40521: Disable method cache in subinterpreters (GH-19960)
Victor Stinner [Wed, 6 May 2020 16:23:58 +0000 (18:23 +0200)] 
bpo-40521: Disable method cache in subinterpreters (GH-19960)

When Python is built with experimental isolated interpreters, disable
the type method cache.

Temporary workaround until the cache is made per-interpreter.

5 years agobpo-40528: Improve and clear several aspects of the ASDL definition code for the...
Batuhan Taskaya [Wed, 6 May 2020 14:29:32 +0000 (17:29 +0300)] 
bpo-40528: Improve and clear several aspects of the ASDL definition code for the AST (GH-19952)

5 years agobpo-40527: Fix command line argument parsing (GH-19955)
Victor Stinner [Wed, 6 May 2020 13:22:17 +0000 (15:22 +0200)] 
bpo-40527: Fix command line argument parsing (GH-19955)

5 years agoRevert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" (#19950)
Raymond Hettinger [Wed, 6 May 2020 05:33:55 +0000 (22:33 -0700)] 
Revert "bpo-40517: Implement syntax highlighting support for ASDL (#19928)" (#19950)

This reverts commit d60040ba226bd2e3b6f58d074015aa2499dc1cb8.

5 years agobpo-40517: Implement syntax highlighting support for ASDL (#19928)
Batuhan Taskaya [Wed, 6 May 2020 05:24:39 +0000 (08:24 +0300)] 
bpo-40517: Implement syntax highlighting support for ASDL (#19928)

5 years agobpo-40480 "fnmatch" exponential execution time (GH-19908)
Tim Peters [Wed, 6 May 2020 02:28:24 +0000 (21:28 -0500)] 
bpo-40480 "fnmatch" exponential execution time (GH-19908)

bpo-40480:  create different regexps in the presence of multiple `*`
patterns to prevent fnmatch() from taking exponential time.

5 years agobpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects ...
Pablo Galindo [Tue, 5 May 2020 21:58:19 +0000 (22:58 +0100)] 
bpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects (GH-19946)

5 years agobpo-40504: Allow weakrefs to lru_cache objects (GH-19938)
Dennis Sweeney [Tue, 5 May 2020 21:14:32 +0000 (17:14 -0400)] 
bpo-40504: Allow weakrefs to lru_cache objects (GH-19938)

5 years agobpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes ...
Curtis Bucher [Tue, 5 May 2020 19:40:56 +0000 (12:40 -0700)] 
bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
5 years agobpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944)
Victor Stinner [Tue, 5 May 2020 18:33:06 +0000 (20:33 +0200)] 
bpo-40513: _xxsubinterpreters.run_string() releases the GIL (GH-19944)

In the experimental isolated subinterpreters build mode,
_xxsubinterpreters.run_string() now releases the GIL.

5 years agobpo-40513: Per-interpreter GIL (GH-19943)
Victor Stinner [Tue, 5 May 2020 18:27:47 +0000 (20:27 +0200)] 
bpo-40513: Per-interpreter GIL (GH-19943)

In the experimental isolated subinterpreters build mode, the GIL is
now per-interpreter.

Move gil from _PyRuntimeState.ceval to PyInterpreterState.ceval.

new_interpreter() always get the config from the main interpreter.

5 years agobpo-40513: new_interpreter() init GIL earlier (GH-19942)
Victor Stinner [Tue, 5 May 2020 18:16:37 +0000 (20:16 +0200)] 
bpo-40513: new_interpreter() init GIL earlier (GH-19942)

Fix also code to handle init_interp_main() failure.

5 years agobpo-40522: _PyThreadState_Swap() sets autoTSSkey (GH-19939)
Victor Stinner [Tue, 5 May 2020 17:56:48 +0000 (19:56 +0200)] 
bpo-40522: _PyThreadState_Swap() sets autoTSSkey (GH-19939)

In the experimental isolated subinterpreters build mode,
_PyThreadState_GET() gets the autoTSSkey variable and
_PyThreadState_Swap() sets the autoTSSkey variable.

* Add _PyThreadState_GetTSS()
* _PyRuntimeState_GetThreadState() and _PyThreadState_GET()
  return _PyThreadState_GetTSS()
* PyEval_SaveThread() sets the autoTSSkey variable to current Python
  thread state rather than NULL.
* eval_frame_handle_pending() doesn't check that
  _PyThreadState_Swap() result is NULL.
* _PyThreadState_Swap() gets the current Python thread state with
  _PyThreadState_GetTSS() rather than
  _PyRuntimeGILState_GetThreadState().
* PyGILState_Ensure() no longer checks _PyEval_ThreadsInitialized()
  since it cannot access the current interpreter.

5 years agobpo-40521: Disable free lists in subinterpreters (GH-19937)
Victor Stinner [Tue, 5 May 2020 17:55:29 +0000 (19:55 +0200)] 
bpo-40521: Disable free lists in subinterpreters (GH-19937)

When Python is built with experimental isolated interpreters, disable
tuple, dict and free free lists.

Temporary workaround until these caches are made per-interpreter.

Add frame_alloc() and frame_get_builtins() subfunctions to simplify
_PyFrame_New_NoTrack().

5 years agobpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH...
Steve Dower [Tue, 5 May 2020 17:45:35 +0000 (18:45 +0100)] 
bpo-40458: Increase reserved stack space to prevent overflow crash on Windows (GH-19845)

5 years agobpo-40521: Disable Unicode caches in isolated subinterpreters (GH-19933)
Victor Stinner [Tue, 5 May 2020 16:50:30 +0000 (18:50 +0200)] 
bpo-40521: Disable Unicode caches in isolated subinterpreters (GH-19933)

When Python is built in the experimental isolated subinterpreters
mode, disable Unicode singletons and Unicode interned strings since
they are shared by all interpreters.

Temporary workaround until these caches are made per-interpreter.

5 years agoRevert "bpo-40513: Per-interpreter signals pending (GH-19924)" (GH-19932)
Victor Stinner [Tue, 5 May 2020 15:40:18 +0000 (17:40 +0200)] 
Revert "bpo-40513: Per-interpreter signals pending (GH-19924)" (GH-19932)

This reverts commit 4e01946cafca0cf49f796c3118e0d65237bcad69.

5 years agobpo-40520: Remove redundant comment in pydebug.h (GH-19931)
Hai Shi [Tue, 5 May 2020 15:20:38 +0000 (10:20 -0500)] 
bpo-40520: Remove redundant comment in pydebug.h (GH-19931)

Automerge-Triggered-By: @corona10
5 years agobpo-29587: _PyErr_ChainExceptions() checks exception (GH-19902)
Victor Stinner [Tue, 5 May 2020 15:07:41 +0000 (17:07 +0200)] 
bpo-29587: _PyErr_ChainExceptions() checks exception (GH-19902)

_PyErr_ChainExceptions() now ensures that the first parameter is an
exception type, as done by _PyErr_SetObject().

* The following function now check PyExceptionInstance_Check() in an
  assertion using a new _PyBaseExceptionObject_cast() helper
  function:

  * PyException_GetTraceback(), PyException_SetTraceback()
  * PyException_GetCause(), PyException_SetCause()
  * PyException_GetContext(), PyException_SetContext()

* PyExceptionClass_Name() now checks PyExceptionClass_Check() with an
  assertion.

* Remove XXX comment and add gi_exc_state variable to _gen_throw().

* Remove comment from test_generators

5 years agobpo-40513: Per-interpreter recursion_limit (GH-19929)
Victor Stinner [Tue, 5 May 2020 14:52:52 +0000 (16:52 +0200)] 
bpo-40513: Per-interpreter recursion_limit (GH-19929)

Move recursion_limit member from _PyRuntimeState.ceval to
PyInterpreterState.ceval.

* Py_SetRecursionLimit() now only sets _Py_CheckRecursionLimit
  of ceval.c if the current Python thread is part of the main
  interpreter.
* Inline _Py_MakeEndRecCheck() into _Py_LeaveRecursiveCall().
* Convert _Py_RecursionLimitLowerWaterMark() macro into a static
  inline function.

5 years agobpo-32117: Updated Simpsons names in docs (GH-19737)
Javier Buzzi [Tue, 5 May 2020 14:49:57 +0000 (10:49 -0400)] 
bpo-32117: Updated Simpsons names in docs (GH-19737)

`sally` is not a Simpsons character

Automerge-Triggered-By: @gvanrossum
5 years agobpo-40514: Add --with-experimental-isolated-subinterpreters (GH-19926)
Victor Stinner [Tue, 5 May 2020 14:41:11 +0000 (16:41 +0200)] 
bpo-40514: Add --with-experimental-isolated-subinterpreters (GH-19926)

Add --with-experimental-isolated-subinterpreters build option to
configure: better isolate subinterpreters, experimental build mode.

When used, force the usage of the libc malloc() memory allocator,
since pymalloc relies on the unique global interpreter lock (GIL).

5 years agobpo-40513: Per-interpreter gil_drop_request (GH-19927)
Victor Stinner [Tue, 5 May 2020 14:14:31 +0000 (16:14 +0200)] 
bpo-40513: Per-interpreter gil_drop_request (GH-19927)

Move gil_drop_request member from _PyRuntimeState.ceval to
PyInterpreterState.ceval.

5 years agobpo-40513: Per-interpreter signals pending (GH-19924)
Victor Stinner [Tue, 5 May 2020 13:43:37 +0000 (15:43 +0200)] 
bpo-40513: Per-interpreter signals pending (GH-19924)

Move signals_pending from _PyRuntime.ceval to
PyInterpreterState.ceval.

5 years agobpo-40286: Put methods in correct sections. Add security notice to use secrets for...
Raymond Hettinger [Tue, 5 May 2020 05:52:13 +0000 (22:52 -0700)] 
bpo-40286: Put methods in correct sections. Add security notice to use secrets for session tokens. (GH-19870)

5 years agobpo-40459: Fix NameError in platform.py (GH-19855)
Dennis Sweeney [Tue, 5 May 2020 02:33:17 +0000 (22:33 -0400)] 
bpo-40459: Fix NameError in platform.py (GH-19855)

5 years agobpo-1635741: Port syslog module to multiphase initialization (GH-19907)
Dong-hee Na [Tue, 5 May 2020 01:49:46 +0000 (10:49 +0900)] 
bpo-1635741: Port syslog module to multiphase initialization (GH-19907)

5 years agobpo-40499: Mention that asyncio.wait() needs a non-empty aws set (GH-19900)
Joel Rosdahl [Mon, 4 May 2020 21:56:00 +0000 (23:56 +0200)] 
bpo-40499: Mention that asyncio.wait() needs a non-empty aws set (GH-19900)

A similar formulation was added in bpo-21596
(db74d982d43d98040e38665d843cbc8de4a082b1) but was lost in bpo-33649
(3faaa8857a42a36383bb18425444e597fc876797).

5 years agobpo-39470: Indicate that ``os.makedirs`` is equivalent to ``Path.mkdir`` (GH-18216)
Joannah Nanjekye [Mon, 4 May 2020 19:47:03 +0000 (16:47 -0300)] 
bpo-39470: Indicate that ``os.makedirs`` is equivalent to ``Path.mkdir`` (GH-18216)

* Indicate os.makedirs is equivalent to Path.mkdir

* 📜🤖 Added by blurb_it.

* ignore news feed

Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
5 years agobpo-40360: Add a What's New entry for lib2to3 pending deprecation (GH-19898)
Miro Hrončok [Mon, 4 May 2020 19:02:00 +0000 (21:02 +0200)] 
bpo-40360: Add a What's New entry for lib2to3 pending deprecation (GH-19898)

5 years agobpo-40275: test.support imports lazily locale import (GH-19761)
Hai Shi [Mon, 4 May 2020 18:05:02 +0000 (02:05 +0800)] 
bpo-40275: test.support imports lazily locale import (GH-19761)

5 years agobpo-40489: Add test case for dict contain use after free (GH-19906)
Dong-hee Na [Mon, 4 May 2020 17:30:42 +0000 (02:30 +0900)] 
bpo-40489: Add test case for dict contain use after free (GH-19906)

5 years agobpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892)
Hai Shi [Mon, 4 May 2020 15:05:54 +0000 (23:05 +0800)] 
bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892)

Don't define shared memory block's name in test_shared_memory_across_processes():
use SharedMemory(create=True) instead.

5 years agobpo-40455: Remove gcc10 warning about x_digits (#19852)
Dong-hee Na [Mon, 4 May 2020 13:32:42 +0000 (22:32 +0900)] 
bpo-40455: Remove gcc10 warning about x_digits (#19852)

* bpo-40455: Remove gcc10 warning about x_digits

* bpo-40455: nit

* bpo-40455: fix logic error

5 years agobpo-39573: Use Py_IS_TYPE to check for types (GH-19882)
Hai Shi [Mon, 4 May 2020 13:31:38 +0000 (21:31 +0800)] 
bpo-39573: Use Py_IS_TYPE to check for types (GH-19882)

5 years agobpo-40246: Revert reporting of invalid string prefixes (GH-19888)
Lysandros Nikolaou [Mon, 4 May 2020 11:32:18 +0000 (14:32 +0300)] 
bpo-40246: Revert reporting of invalid string prefixes (GH-19888)

Due to backwards compatibility concerns regarding keywords immediately followed by a string without whitespace between them (like in `bg="#d00" if clear else"#fca"`) will fail to parse,
commit 41d5b94af44e34ac05d4cd57460ed104ccf96628 has to be reverted.

5 years agobpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865)
Lysandros Nikolaou [Mon, 4 May 2020 10:58:31 +0000 (13:58 +0300)] 
bpo-40334: Spacialized error message for invalid args after bare '*' (GH-19865)

When parsing things like `def f(*): pass` the old parser used to output `SyntaxError: named arguments must follow bare *`, which the new parser wasn't able to do.

5 years agobpo-40491: Fix typo in syntax error for numeric literals (GH-19893)
Shantanu [Mon, 4 May 2020 08:13:30 +0000 (01:13 -0700)] 
bpo-40491: Fix typo in syntax error for numeric literals (GH-19893)

5 years agobpo-40408: Fix support of nested type variables in GenericAlias. (GH-19836)
Serhiy Storchaka [Mon, 4 May 2020 07:56:05 +0000 (10:56 +0300)] 
bpo-40408: Fix support of nested type variables in GenericAlias. (GH-19836)

5 years agobpo-40493: fix function type comment parsing (GH-19894)
Shantanu [Mon, 4 May 2020 05:08:14 +0000 (22:08 -0700)] 
bpo-40493: fix function type comment parsing (GH-19894)

The grammar for func_type_input rejected things like `(*t1) ->t2`. This fixes that.

Automerge-Triggered-By: @gvanrossum
5 years agoClean up unused imports for the peg generator module (GH-19891)
Anthony Shaw [Mon, 4 May 2020 02:03:05 +0000 (12:03 +1000)] 
Clean up unused imports for the peg generator module (GH-19891)

5 years agobpo-40334: Set error_indicator in _PyPegen_raise_error (GH-19887)
Lysandros Nikolaou [Mon, 4 May 2020 00:20:09 +0000 (03:20 +0300)] 
bpo-40334: Set error_indicator in _PyPegen_raise_error (GH-19887)

Due to PyErr_Occurred not being called at the beginning of each rule, we need to set the error indicator, so that rules do not get expanded after an exception has been thrown

5 years agoRemove outdated and confusing advice about setting maxsize (GH-19889)
Raymond Hettinger [Sun, 3 May 2020 23:45:13 +0000 (16:45 -0700)] 
Remove outdated and confusing advice about setting maxsize (GH-19889)

5 years agoRemove out-of-date comment (GH-19886)
Raymond Hettinger [Sun, 3 May 2020 18:25:46 +0000 (11:25 -0700)] 
Remove out-of-date comment (GH-19886)

5 years agobpo-38870: Don't start generated output with newlines in ast.unparse (GH-19636)
Batuhan Taskaya [Sun, 3 May 2020 17:11:51 +0000 (20:11 +0300)] 
bpo-38870: Don't start generated output with newlines in ast.unparse (GH-19636)

5 years agoSimplify set entry insertion logic. (GH-19881)
Raymond Hettinger [Sun, 3 May 2020 11:51:05 +0000 (04:51 -0700)] 
Simplify set entry insertion logic. (GH-19881)

5 years agobpo-29587: allow chaining NULL exceptions in _gen_throw() (GH-19877)
Chris Jerdonek [Sun, 3 May 2020 07:07:57 +0000 (00:07 -0700)] 
bpo-29587: allow chaining NULL exceptions in _gen_throw() (GH-19877)

This is a follow-up to GH-19823 that removes the check that the
exception value isn't NULL, prior to calling _PyErr_ChainExceptions().
This enables implicit exception chaining for gen.throw() in more
circumstances.

The commit also adds a test that a particular code snippet involving
gen.throw() doesn't crash.  The test shows why the new
`gi_exc_state.exc_type != Py_None` check that was added is necessary.
Without the new check, the code snippet (as well as a number of other
tests) crashes on certain platforms (e.g. Fedora but not Mac).

5 years agoMinor code cleanups for statistics (GH-19873)
Raymond Hettinger [Sun, 3 May 2020 02:30:24 +0000 (19:30 -0700)] 
Minor code cleanups for statistics (GH-19873)

* Minor cleanups:  Removed unused code.  Move C import near its Python version.

* Clean-up whitespace

5 years agoFix missing space in docs(GH-19866)
Mathieu Dupuy [Sat, 2 May 2020 23:50:47 +0000 (23:50 +0000)] 
Fix missing space in docs(GH-19866)

5 years agobpo-40465: Deprecate the optional argument to random.shuffle(). (#19867)
Raymond Hettinger [Sat, 2 May 2020 23:45:32 +0000 (16:45 -0700)] 
bpo-40465: Deprecate the optional argument to random.shuffle(). (#19867)

5 years agobpo-40419: timeit CLI docs now mention 1,2,5,10,... trials instead of powers of 10...
Sander [Sat, 2 May 2020 16:12:05 +0000 (18:12 +0200)] 
bpo-40419: timeit CLI docs now mention 1,2,5,10,... trials instead of powers of 10 (GH-19752)

5 years agoCall $(MKDIR_P) before regenerating the PEG meta-parser (GH-19861)
Pablo Galindo [Sat, 2 May 2020 15:15:27 +0000 (16:15 +0100)] 
Call $(MKDIR_P) before regenerating the PEG meta-parser (GH-19861)

5 years agobpo-39435: Make the first argument of pickle.loads() positional-only. (GH-19846)
Serhiy Storchaka [Sat, 2 May 2020 06:38:01 +0000 (09:38 +0300)] 
bpo-39435: Make the first argument of pickle.loads() positional-only. (GH-19846)

It was positional-only de facto: documentation and two implementations
used three different name.

5 years agobpo-40334: regenerate metaparser as part of regen-all (GH-19854)
Pablo Galindo [Sat, 2 May 2020 04:23:39 +0000 (05:23 +0100)] 
bpo-40334: regenerate metaparser as part of regen-all (GH-19854)

5 years agoFix some scripts in the peg generator folder (GH-19853)
Pablo Galindo [Sat, 2 May 2020 04:23:06 +0000 (05:23 +0100)] 
Fix some scripts in the peg generator folder (GH-19853)

5 years agobpo-29587: Update gen.throw() to chain exceptions (#19823)
Chris Jerdonek [Sat, 2 May 2020 01:14:19 +0000 (18:14 -0700)] 
bpo-29587: Update gen.throw() to chain exceptions (#19823)

Before this commit, if an exception was active inside a generator
when calling gen.throw(), that exception was lost (i.e. there was
no implicit exception chaining).  This commit fixes that by
setting exc.__context__ when calling gen.throw(exc).

5 years agobpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750)
Robert Rouhani [Fri, 1 May 2020 23:28:06 +0000 (16:28 -0700)] 
bpo-40417: Fix deprecation warning in PyImport_ReloadModule (GH-19750)

I can add another commit with the new test case I wrote to verify that the warning was being printed before my change, stopped printing after my change, and that the function does not return null after my change.

Automerge-Triggered-By: @brettcannon
5 years agobpo-40334: use the TOKENS file when checking dangling rules (GH-19849)
Pablo Galindo [Fri, 1 May 2020 22:14:12 +0000 (23:14 +0100)] 
bpo-40334: use the TOKENS file when checking dangling rules (GH-19849)

5 years agoFix the Tools/peg_generator/scripts/benchmark.py script (GH-19848)
Pablo Galindo [Fri, 1 May 2020 21:33:54 +0000 (22:33 +0100)] 
Fix the Tools/peg_generator/scripts/benchmark.py script (GH-19848)

5 years agobpo-39435: Fix docs for pickle.loads (GH-18160)
Shantanu [Fri, 1 May 2020 19:46:01 +0000 (12:46 -0700)] 
bpo-39435: Fix docs for pickle.loads (GH-18160)

5 years agobpo-40412: Nullify inittab_copy during finalization (GH-19746)
Gregory Szorc [Fri, 1 May 2020 18:07:54 +0000 (11:07 -0700)] 
bpo-40412: Nullify inittab_copy during finalization (GH-19746)

Otherwise we leave a dangling pointer to free'd memory. If we
then initialize a new interpreter in the same process and call
PyImport_ExtendInittab, we will (likely) crash when calling
PyMem_RawRealloc(inittab_copy, ...) since the pointer address
is bogus.

Automerge-Triggered-By: @brettcannon
5 years agobpo-39691: Clarify io.open_code behavior (GH-19824)
Shantanu [Fri, 1 May 2020 17:52:10 +0000 (10:52 -0700)] 
bpo-39691: Clarify io.open_code behavior (GH-19824)

5 years agoSimplify choice()'s interaction with the private _randbelow() method (GH-19831)
Raymond Hettinger [Fri, 1 May 2020 17:34:19 +0000 (10:34 -0700)] 
Simplify choice()'s interaction with the private _randbelow() method (GH-19831)

5 years agobpo-40334: Make the PyPegen* and PyParser* APIs more consistent (GH-19839)
Lysandros Nikolaou [Fri, 1 May 2020 17:30:51 +0000 (20:30 +0300)] 
bpo-40334: Make the PyPegen* and PyParser* APIs more consistent (GH-19839)

This commit makes both APIs more consistent by doing the following:
- Remove the `PyPegen_CodeObjectFrom*` functions, which weren't used
  and will probably not be needed. Functions like `Py_CompileStringObject`
  can be used instead.
- Include a `const char *filename` parameter in `PyPegen_ASTFromString`.
- Rename `PyPegen_ASTFromFile` to `PyPegen_ASTFromFilename`, because
  its signature is not the same with `PyParser_ASTFromFile`.

5 years agoEnsure that tok->type_comments is set on every path (GH-19828)
Guido van Rossum [Fri, 1 May 2020 16:42:32 +0000 (09:42 -0700)] 
Ensure that tok->type_comments is set on every path (GH-19828)

5 years agobpo-40334: Refactor lambda_parameters similar to parameters (GH-19830)
Guido van Rossum [Fri, 1 May 2020 16:42:03 +0000 (09:42 -0700)] 
bpo-40334: Refactor lambda_parameters similar to parameters (GH-19830)

5 years agobpo-40334: Correct return value of func_type_comment (GH-19833)
Pablo Galindo [Fri, 1 May 2020 15:32:09 +0000 (16:32 +0100)] 
bpo-40334: Correct return value of func_type_comment (GH-19833)

5 years agobpo-40334: unskip test_function_type in test_unparse with the new parser (GH-19837)
Pablo Galindo [Fri, 1 May 2020 15:02:06 +0000 (16:02 +0100)] 
bpo-40334: unskip test_function_type in test_unparse with the new parser (GH-19837)

5 years agobpo-40334: Improve column offsets for thrown syntax errors by Pegen (GH-19782)
Batuhan Taskaya [Fri, 1 May 2020 13:13:43 +0000 (16:13 +0300)] 
bpo-40334: Improve column offsets for thrown syntax errors by Pegen (GH-19782)

5 years agobpo-40462: fix variable and function names (GH-19832)
Furkan Önder [Fri, 1 May 2020 12:49:35 +0000 (15:49 +0300)] 
bpo-40462: fix variable and function names (GH-19832)

Automerge-Triggered-By: @vstinner
5 years agobpo-32494: Use gdbm_count for dbm_length if possible (GH-19814)
Dong-hee Na [Fri, 1 May 2020 12:15:35 +0000 (21:15 +0900)] 
bpo-32494: Use gdbm_count for dbm_length if possible (GH-19814)

5 years agobpo-40334: Simplify type handling in the PEG c_generator (GH-19818)
Pablo Galindo [Fri, 1 May 2020 11:32:26 +0000 (12:32 +0100)] 
bpo-40334: Simplify type handling in the PEG c_generator (GH-19818)

5 years agobpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)
Victor Stinner [Fri, 1 May 2020 09:33:44 +0000 (11:33 +0200)] 
bpo-40453: Add PyConfig._isolated_subinterpreter (GH-19820)

An isolated subinterpreter cannot spawn threads, spawn a child
process or call os.fork().

* Add private _Py_NewInterpreter(isolated_subinterpreter) function.
* Add isolated=True keyword-only parameter to
  _xxsubinterpreters.create().
* Allow again os.fork() in "non-isolated" subinterpreters.

5 years agoChange 'exception happened' to 'exception occurred' in two places (#19767)
Noah Doersing [Fri, 1 May 2020 04:30:10 +0000 (06:30 +0200)] 
Change 'exception happened' to 'exception occurred' in two places (#19767)

5 years agobpo-40334: Add support for feature_version in new PEG parser (GH-19827)
Lysandros Nikolaou [Fri, 1 May 2020 03:27:52 +0000 (06:27 +0300)] 
bpo-40334: Add support for feature_version in new PEG parser (GH-19827)

`ast.parse` and `compile` support a `feature_version` parameter that
tells the parser to parse the input string, as if it were written in
an older Python version.
The `feature_version` is propagated to the tokenizer, which uses it
to handle the three different stages of support for `async` and
`await`. Additionally, it disallows the following at parser level:
- The '@' operator in < 3.5
- Async functions in < 3.5
- Async comprehensions in < 3.6
- Underscores in numeric literals in < 3.6
- Await expression in < 3.5
- Variable annotations in < 3.6
- Async for-loops in < 3.5
- Async with-statements in < 3.5
- F-strings in < 3.6

Closes we-like-parsers/cpython#124.

5 years agobpo-40443: Remove unused imports in stdlib (GH-19815)
Victor Stinner [Fri, 1 May 2020 00:38:00 +0000 (02:38 +0200)] 
bpo-40443: Remove unused imports in stdlib (GH-19815)

5 years agobpo-40275: Fix name error in support.socket_helper (GH-19825)
Victor Stinner [Fri, 1 May 2020 00:35:24 +0000 (02:35 +0200)] 
bpo-40275: Fix name error in support.socket_helper (GH-19825)

Replace TestFailed with support.TestFailed.

Bug spotted by pyflakes.

5 years agoRemove dead code in test__xxsubinterpreters (GH-19826)
Victor Stinner [Fri, 1 May 2020 00:34:22 +0000 (02:34 +0200)] 
Remove dead code in test__xxsubinterpreters (GH-19826)

5 years agobpo-1635741: Fix compiler warning in _stat.c (GH-19822)
Victor Stinner [Thu, 30 Apr 2020 22:44:03 +0000 (00:44 +0200)] 
bpo-1635741: Fix compiler warning in _stat.c (GH-19822)

Cast Py_ARRAY_LENGTH() size_t to int explicitly.

5 years agoRevert "bpo-29587: Enable implicit exception chaining with gen.throw() (GH-19811...
Victor Stinner [Thu, 30 Apr 2020 20:44:24 +0000 (22:44 +0200)] 
Revert "bpo-29587: Enable implicit exception chaining with gen.throw() (GH-19811)" (#19821)

This reverts commit 2514a632fb7d37be24c2059d0e286d35600f9795.

5 years agobpo-29587: Enable implicit exception chaining with gen.throw() (GH-19811)
Chris Jerdonek [Thu, 30 Apr 2020 19:18:05 +0000 (12:18 -0700)] 
bpo-29587: Enable implicit exception chaining with gen.throw() (GH-19811)

Before this commit, if an exception was active inside a generator
when calling gen.throw(), then that exception was lost (i.e. there
was no implicit exception chaining).  This commit fixes that.

5 years agobpo-40334: Support type comments (GH-19780)
Guido van Rossum [Thu, 30 Apr 2020 19:12:19 +0000 (12:12 -0700)] 
bpo-40334: Support type comments (GH-19780)

This implements full support for # type: <type> comments, # type: ignore <stuff> comments, and the func_type parsing mode for ast.parse() and compile().

Closes https://github.com/we-like-parsers/cpython/issues/95.

(For now, you need to use the master branch of mypy, since another issue unique to 3.9 had to be fixed there, and there's no mypy release yet.)

The only thing missing is `feature_version=N`, which is being tracked in https://github.com/we-like-parsers/cpython/issues/124.

5 years agocompileall: Fix typos in docstring (GH-19810)
Jelle Zijlstra [Thu, 30 Apr 2020 10:39:11 +0000 (03:39 -0700)] 
compileall: Fix typos in docstring (GH-19810)

5 years agobpo-40443: Remove unused imports in distutils (GH-19802)
Victor Stinner [Thu, 30 Apr 2020 09:28:09 +0000 (11:28 +0200)] 
bpo-40443: Remove unused imports in distutils (GH-19802)

5 years agobpo-40443: Remove unused imports in the stdlib (GH-19803)
Victor Stinner [Thu, 30 Apr 2020 09:26:33 +0000 (11:26 +0200)] 
bpo-40443: Remove unused imports in the stdlib (GH-19803)

5 years agobpo-40394 - difflib.SequenceMatched.find_longest_match default args (GH-19742)
lrjball [Thu, 30 Apr 2020 03:42:45 +0000 (04:42 +0100)] 
bpo-40394 - difflib.SequenceMatched.find_longest_match default args (GH-19742)

* bpo-40394 - difflib.SequenceMatched.find_longest_match default args

Added default args to find_longest_match, as well as related tests.

5 years agobpo-40443: Remove unused imports in idlelib (GH-19801)
Victor Stinner [Thu, 30 Apr 2020 01:28:51 +0000 (03:28 +0200)] 
bpo-40443: Remove unused imports in idlelib (GH-19801)

5 years agobpo-40389: Improve repr of typing.Optional (#19714)
Vlad Serebrennikov [Thu, 30 Apr 2020 01:06:39 +0000 (04:06 +0300)] 
bpo-40389: Improve repr of typing.Optional (#19714)

5 years agobpo-40443: Remove unused imports in tests (GH-19804)
Victor Stinner [Thu, 30 Apr 2020 00:21:30 +0000 (02:21 +0200)] 
bpo-40443: Remove unused imports in tests (GH-19804)

5 years agobpo-40443: Remove unused imports in tests (GH-19805)
Victor Stinner [Wed, 29 Apr 2020 23:48:37 +0000 (01:48 +0200)] 
bpo-40443: Remove unused imports in tests (GH-19805)

5 years agobpo-40334: Fix test_peg_parser to actually use the old parser (GH-19778)
Lysandros Nikolaou [Wed, 29 Apr 2020 22:53:30 +0000 (01:53 +0300)] 
bpo-40334: Fix test_peg_parser to actually use the old parser (GH-19778)

Now that the default parser is the new PEG parser, ast.parse uses it, which means that we don't actually test something in test_peg_parser. This commit introduces a new keyword argument (`oldparser`) for `_peg_parser.parse_string` for specifying that a string needs to be parsed with the old parser. This keyword argument is used in the tests to actually compare the ASTs the new parser generates with those generated by the old parser.

5 years agobpo-40291: Add support for CAN_J1939 sockets (GH-19538)
karl ding [Wed, 29 Apr 2020 22:31:19 +0000 (15:31 -0700)] 
bpo-40291: Add support for CAN_J1939 sockets (GH-19538)

Add support for CAN_J1939 sockets that wrap SAE J1939 protocol
functionality provided by Linux 5.4+ kernels.

5 years agoFix plural typo in documentation (GH-19799)
Alex Povel [Wed, 29 Apr 2020 22:17:12 +0000 (00:17 +0200)] 
Fix plural typo in documentation (GH-19799)

Co-authored-by: Alex Povel <python@alexpovel.de>
5 years agobpo-1635741: Port _stat module to multiphase initialization (GH-19798)
Dong-hee Na [Wed, 29 Apr 2020 18:20:27 +0000 (03:20 +0900)] 
bpo-1635741: Port _stat module to multiphase initialization (GH-19798)

5 years agobpo-40328: Add tool for generating cjk mapping headers (GH-19602)
Dong-hee Na [Wed, 29 Apr 2020 17:34:24 +0000 (02:34 +0900)] 
bpo-40328: Add tool for generating cjk mapping headers (GH-19602)

5 years agobpo-40286: Remove C implementation of Random.randbytes() (GH-19797)
Victor Stinner [Wed, 29 Apr 2020 16:49:00 +0000 (18:49 +0200)] 
bpo-40286: Remove C implementation of Random.randbytes() (GH-19797)

Remove _random.Random.randbytes(): the C implementation of
randbytes(). Implement the method in Python to ease subclassing:
randbytes() now directly reuses getrandbits().

5 years agobpo-9216: Expose OpenSSL FIPS_mode() as _hashlib.get_fips_mode() (GH-19703)
Victor Stinner [Wed, 29 Apr 2020 16:04:22 +0000 (18:04 +0200)] 
bpo-9216: Expose OpenSSL FIPS_mode() as _hashlib.get_fips_mode() (GH-19703)

test.pythoninfo logs OpenSSL FIPS_mode() and Linux
/proc/sys/crypto/fips_enabled in a new "fips" section.

Co-Authored-By: Petr Viktorin <encukou@gmail.com>
5 years agoWhat's New in Python 3.9: Reorganize C API Changes (GH-19794)
Victor Stinner [Wed, 29 Apr 2020 15:57:25 +0000 (17:57 +0200)] 
What's New in Python 3.9: Reorganize C API Changes (GH-19794)

Move Build Changes and C API Changes to the end of the document.
Most Python users don't build Python themselves and don't use the C
API. Other changes:

* Add Build Changes section
* Add sub-sections to the C API Changes
* Sort modules in Improved Modules section: move nntplib after
  multiprocessing

5 years agobpo-40228: More robust frame.setlineno. (GH-19437)
Mark Shannon [Wed, 29 Apr 2020 15:49:45 +0000 (16:49 +0100)] 
bpo-40228: More robust frame.setlineno. (GH-19437)

More robust frame.setlineno. Makes no assumptions about source->bytecode translation.

5 years agobpo-40436: Fix code parsing gdb version (GH-19792)
Victor Stinner [Wed, 29 Apr 2020 15:11:48 +0000 (17:11 +0200)] 
bpo-40436: Fix code parsing gdb version (GH-19792)

test_gdb and test.pythoninfo now check gdb command exit code.