]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
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.

5 years agobpo-40428: Cleanup free list part of C API Changes doc (GH-19793)
Victor Stinner [Wed, 29 Apr 2020 14:56:30 +0000 (16:56 +0200)] 
bpo-40428: Cleanup free list part of C API Changes doc (GH-19793)

5 years agoAdd missing sys import to socket_helper.py (GH-19791)
Pablo Galindo [Wed, 29 Apr 2020 11:32:31 +0000 (12:32 +0100)] 
Add missing sys import to socket_helper.py (GH-19791)

5 years agobpo-40334: refactor and cleanup for the PEG generators (GH-19775)
Pablo Galindo [Wed, 29 Apr 2020 09:42:21 +0000 (10:42 +0100)] 
bpo-40334: refactor and cleanup for the PEG generators (GH-19775)

5 years agobpo-40432 Fix MSBuild project for Pegen grammars (#GH-9785)
Anthony Shaw [Wed, 29 Apr 2020 09:09:09 +0000 (19:09 +1000)] 
bpo-40432 Fix MSBuild project for Pegen grammars (#GH-9785)

* Update the source path of the pegen target within the Windows regen project.
Change the path to Windows path formats.

* Use the more reliable SetEnv task for Cpp Projects in MSBuild.

5 years agobpo-40275: Move transient_internet from test.support to socket_helper (GH-19711)
Serhiy Storchaka [Wed, 29 Apr 2020 07:36:20 +0000 (10:36 +0300)] 
bpo-40275: Move transient_internet from test.support to socket_helper (GH-19711)

5 years agobpo-40428: Remove references to Py*_ClearFreeList in the docs (GH-19783)
Zackery Spytz [Wed, 29 Apr 2020 02:41:56 +0000 (20:41 -0600)] 
bpo-40428: Remove references to Py*_ClearFreeList in the docs (GH-19783)

They were removed from the C API in commit
ae00a5a88534fd45939f86c12e038da9fa6f9ed6.

5 years agobpo-40334: Disallow invalid single statements in the new parser (GH-19774)
Lysandros Nikolaou [Wed, 29 Apr 2020 01:42:27 +0000 (04:42 +0300)] 
bpo-40334: Disallow invalid single statements in the new parser (GH-19774)

After parsing is done in single statement mode, the tokenizer buffer has to be checked for additional lines and a `SyntaxError` must be raised, in case there are any.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
5 years agobpo-39995: Fix concurrent.futures _ThreadWakeup (GH-19760)
Victor Stinner [Wed, 29 Apr 2020 01:32:06 +0000 (03:32 +0200)] 
bpo-39995: Fix concurrent.futures _ThreadWakeup (GH-19760)

Fix a race condition in concurrent.futures._ThreadWakeup: access to
_ThreadWakeup is now protected with the shutdown lock.

5 years agobpo-40421: Add PyFrame_GetBack() function (GH-19765)
Victor Stinner [Wed, 29 Apr 2020 01:28:46 +0000 (03:28 +0200)] 
bpo-40421: Add PyFrame_GetBack() function (GH-19765)

New PyFrame_GetBack() function: get the frame next outer frame.

Replace frame->f_back with PyFrame_GetBack(frame) in most code but
frameobject.c, ceval.c and genobject.c.

5 years agobpo-40275: Move requires_hashdigest() to test.support.hashlib_helper (GH-19716)
Hai Shi [Wed, 29 Apr 2020 01:11:29 +0000 (09:11 +0800)] 
bpo-40275: Move requires_hashdigest() to test.support.hashlib_helper (GH-19716)

Add a new test.support.hashlib_helper submodule.

5 years agobpo-40334: Explicitly cast to int in pegen.c to fix a compiler warning (GH-19779)
Pablo Galindo [Wed, 29 Apr 2020 01:04:06 +0000 (02:04 +0100)] 
bpo-40334: Explicitly cast to int in pegen.c to fix a compiler warning (GH-19779)

5 years agobpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)
Victor Stinner [Wed, 29 Apr 2020 01:01:43 +0000 (03:01 +0200)] 
bpo-40429: PyThreadState_GetFrame() returns a strong ref (GH-19781)

The PyThreadState_GetFrame() function now returns a strong reference
to the frame.

5 years agobpo-40334: Fix shifting of nested f-strings in the new parser (GH-19771)
Lysandros Nikolaou [Wed, 29 Apr 2020 00:43:50 +0000 (03:43 +0300)] 
bpo-40334: Fix shifting of nested f-strings in the new parser (GH-19771)

`JoinedStr`s and `FormattedValue also needs to be shifted, in order to correctly compute the location information of nested f-strings.

5 years agobpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)
Victor Stinner [Wed, 29 Apr 2020 00:29:20 +0000 (02:29 +0200)] 
bpo-40428: Remove PyTuple_ClearFreeList() function (GH-19769)

Remove the following function from the C API:

* PyAsyncGen_ClearFreeLists()
* PyContext_ClearFreeList()
* PyDict_ClearFreeList()
* PyFloat_ClearFreeList()
* PyFrame_ClearFreeList()
* PyList_ClearFreeList()
* PySet_ClearFreeList()
* PyTuple_ClearFreeList()

Make these functions private, move them to the internal C API and
change their return type to void.

Call explicitly PyGC_Collect() to free all free lists.

Note: PySet_ClearFreeList() did nothing.

5 years agobpo-40429: Refactor super_init() (GH-19776)
Victor Stinner [Wed, 29 Apr 2020 00:28:23 +0000 (02:28 +0200)] 
bpo-40429: Refactor super_init() (GH-19776)

Add super_init_without_args() sub-function. Hold a strong reference
to the frame code object while calling super_init_without_args().

5 years agobpo-38880: List interpreters associated with a channel end (GH-17323)
Lewis Gaul [Wed, 29 Apr 2020 00:18:42 +0000 (01:18 +0100)] 
bpo-38880: List interpreters associated with a channel end (GH-17323)

This PR adds the functionality requested by https://github.com/ericsnowcurrently/multi-core-python/issues/52.

Automerge-Triggered-By: @ericsnowcurrently
5 years agobpo-40431: Fix syntax typo in turtledemo (GH-19777)
Miro Hrončok [Wed, 29 Apr 2020 00:00:07 +0000 (02:00 +0200)] 
bpo-40431: Fix syntax typo in turtledemo (GH-19777)

***   File "/usr/lib64/python3.9/turtledemo/__main__.py", line 275
        bg="#d00" if clear == NORMAL else"#fca")
                                        ^
    SyntaxError: invalid string prefix

5 years agobpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)
Victor Stinner [Tue, 28 Apr 2020 23:28:13 +0000 (01:28 +0200)] 
bpo-40429: PyFrame_GetCode() now returns a strong reference (GH-19773)

5 years agobpo-32604: Add support for a "default" arg in channel_recv(). (GH-19770)
Eric Snow [Tue, 28 Apr 2020 23:11:32 +0000 (17:11 -0600)] 
bpo-32604: Add support for a "default" arg in channel_recv(). (GH-19770)

This allows the caller to avoid creation of an exception when the channel is empty (just like `dict.get()` works).  `ChannelEmptyError` is still raised if no default is provided.

Automerge-Triggered-By: @ericsnowcurrently
5 years agobpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)
Victor Stinner [Tue, 28 Apr 2020 22:56:58 +0000 (00:56 +0200)] 
bpo-40429: PyFrame_GetCode() result cannot be NULL (GH-19772)

Add frame_nslots() to factorize duplicate code.

5 years agobpo-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic methods...
Karthikeyan Singaravelan [Tue, 28 Apr 2020 19:22:31 +0000 (00:52 +0530)] 
bpo-39966: Revert "bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock" (GH-19734)

* Revert "bpo-25597: Ensure wraps' return value is used for magic methods in MagicMock (#16029)"

This reverts commit 72b1004657e60c900e4cd031b2635b587f4b280e.

5 years agobpo-40025: Require _generate_next_value_ to be defined before members (GH-19098)
Ethan Onstott [Tue, 28 Apr 2020 17:20:55 +0000 (13:20 -0400)] 
bpo-40025: Require _generate_next_value_ to be defined before members (GH-19098)

require `_generate_next_value_` to be defined before members

5 years agobpo-40421: Add PyFrame_GetCode() function (GH-19757)
Victor Stinner [Tue, 28 Apr 2020 17:01:31 +0000 (19:01 +0200)] 
bpo-40421: Add PyFrame_GetCode() function (GH-19757)

PyFrame_GetCode(frame): return a borrowed reference to the frame
code.

Replace frame->f_code with PyFrame_GetCode(frame) in most code,
except in frameobject.c, genobject.c and ceval.c.

Also add PyFrame_GetLineNumber() to the limited C API.

5 years agobpo-40421: Add Include/cpython/code.h header file (GH-19756)
Victor Stinner [Tue, 28 Apr 2020 15:07:12 +0000 (17:07 +0200)] 
bpo-40421: Add Include/cpython/code.h header file (GH-19756)

bpo-35134, bpo-40421: Add Include/cpython/code.h header file.

code.h now defines PyCodeObject type in the limited C API. It is now
included by Python.h.

Give a name to the PyCodeObject structure: it is now called
"struct PyCodeObject". So it becomes possible to define PyCodeObject
as "struct PyCodeObject" in the limited C API without defining the
structure.

5 years agobpo-40421: Add pyframe.h header file (GH-19755)
Victor Stinner [Tue, 28 Apr 2020 14:32:48 +0000 (16:32 +0200)] 
bpo-40421: Add pyframe.h header file (GH-19755)

Add a new separated pyframe.h header file of the PyFrame public C
API: it is included by Python.h.

Add PyFrame_GetLineNumber() to the limited C API.

Replace "struct _frame" with "PyFrameObject" in header files.
PyFrameObject is now defined as struct _frame by pyframe.h which is
included early enough in Python.h.

5 years agoPost 3.9.0a6
Łukasz Langa [Tue, 28 Apr 2020 14:28:10 +0000 (16:28 +0200)] 
Post 3.9.0a6

5 years agoMerge tag 'v3.9.0a6'
Łukasz Langa [Tue, 28 Apr 2020 14:27:46 +0000 (16:27 +0200)] 
Merge tag 'v3.9.0a6'

5 years agobpo-40334: Refactor peg_generator to receive a Tokens file when building c code ...
Pablo Galindo [Tue, 28 Apr 2020 12:11:55 +0000 (13:11 +0100)] 
bpo-40334: Refactor peg_generator to receive a Tokens file when building c code (GH-19745)

5 years agobpo-40334: Don't skip test_parser:test_trigget_memory_error (GH-19744)
Lysandros Nikolaou [Tue, 28 Apr 2020 00:24:50 +0000 (03:24 +0300)] 
bpo-40334: Don't skip test_parser:test_trigget_memory_error (GH-19744)

This test has been changed to always use the old parser, so no need for it to be skipped.