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

5 years agobpo-40334: Catch E_EOF error, when the tokenizer returns ERRORTOKEN (GH-19743)
Lysandros Nikolaou [Tue, 28 Apr 2020 00:23:35 +0000 (03:23 +0300)] 
bpo-40334: Catch E_EOF error, when the tokenizer returns ERRORTOKEN (GH-19743)

An E_EOF error was only being caught after the parser exited before this commit. There are some cases though, where the tokenizer returns ERRORTOKEN *and* has set an E_EOF error (like when EOF directly follows a line continuation character) which weren't correctly handled before.

5 years agoPython 3.9.0a6 v3.9.0a6
Łukasz Langa [Mon, 27 Apr 2020 20:44:04 +0000 (22:44 +0200)] 
Python 3.9.0a6

5 years agobpo-39995: Split test_concurrent_futures.test_crash() into sub-tests (GH-19739)
Victor Stinner [Mon, 27 Apr 2020 19:36:51 +0000 (21:36 +0200)] 
bpo-39995: Split test_concurrent_futures.test_crash() into sub-tests (GH-19739)

Now only test_error_during_result_unpickle_in_result_handler()
captures and ignores sys.stderr in the test process.

Tools like test.bisect_cmd don't support subTest() but only
work with the granularity of one method.

Remove unused ExecutorDeadlockTest._sleep_id() method.

5 years agobpo-30966: concurrent.futures.Process.shutdown() closes queue (GH-19738)
Victor Stinner [Mon, 27 Apr 2020 18:53:37 +0000 (20:53 +0200)] 
bpo-30966: concurrent.futures.Process.shutdown() closes queue (GH-19738)

Process.shutdown(wait=True) of concurrent.futures now closes
explicitly the result queue.

5 years agobpo-40334: Support PyPARSE_DONT_IMPLY_DEDENT in the new parser (GH-19736)
Pablo Galindo [Mon, 27 Apr 2020 17:35:58 +0000 (18:35 +0100)] 
bpo-40334: Support PyPARSE_DONT_IMPLY_DEDENT in the new parser (GH-19736)

5 years agobpo-40334: Support CO_FUTURE_BARRY_AS_BDFL in the new parser (GH-19721)
Pablo Galindo [Mon, 27 Apr 2020 17:02:07 +0000 (18:02 +0100)] 
bpo-40334: Support CO_FUTURE_BARRY_AS_BDFL in the new parser (GH-19721)

This commit also allows to pass flags to the new parser in all interfaces and fixes a bug in the parser generator that was causing to inline rules with actions, making them disappear.

5 years agobpo-30966: Add multiprocessing.SimpleQueue.close() (GH-19735)
Victor Stinner [Mon, 27 Apr 2020 16:11:10 +0000 (18:11 +0200)] 
bpo-30966: Add multiprocessing.SimpleQueue.close() (GH-19735)

Add a new close() method to multiprocessing.SimpleQueue to explicitly
close the queue.

Automerge-Triggered-By: @pitrou
5 years agobpo-40375: Implement imaplib.IMAP4.unselect (GH-19712)
Dong-hee Na [Mon, 27 Apr 2020 14:52:55 +0000 (23:52 +0900)] 
bpo-40375: Implement imaplib.IMAP4.unselect (GH-19712)

5 years agobpo-40217: Clean code in PyType_FromSpec_Alloc and add NEWS entry (GH-19733)
Pablo Galindo [Mon, 27 Apr 2020 14:24:31 +0000 (15:24 +0100)] 
bpo-40217: Clean code in PyType_FromSpec_Alloc and add NEWS entry (GH-19733)

5 years agobpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types...
Pablo Galindo [Mon, 27 Apr 2020 12:22:19 +0000 (13:22 +0100)] 
bpo-40217: Ensure Py_VISIT(Py_TYPE(self)) is always called for PyType_FromSpec types (GH-19414)

5 years agoAdd files in tests/test_peg_generator to the install target lists (GH-19723)
Pablo Galindo [Mon, 27 Apr 2020 10:18:04 +0000 (11:18 +0100)] 
Add files in tests/test_peg_generator to the install target lists (GH-19723)

Update the "Makefile.pre.in" template and the "PCbuild/lib.pyproj" with the files in "Lib/test/test/test_peg_generator" so they get correctly installed along the rest of the standard library.

5 years agobpo-40398: Fix typing.get_args() for special generic aliases. (GH-19720)
Serhiy Storchaka [Mon, 27 Apr 2020 07:27:21 +0000 (10:27 +0300)] 
bpo-40398: Fix typing.get_args() for special generic aliases. (GH-19720)

5 years agobpo-40348: Fix typos in the programming FAQ (GH-19729)
Zackery Spytz [Mon, 27 Apr 2020 03:23:52 +0000 (21:23 -0600)] 
bpo-40348: Fix typos in the programming FAQ (GH-19729)

5 years agobpo-38387: Formally document PyDoc_STRVAR and PyDoc_STR macros (GH-16607)
Brad Solomon [Mon, 27 Apr 2020 02:31:44 +0000 (22:31 -0400)] 
bpo-38387: Formally document PyDoc_STRVAR and PyDoc_STR macros (GH-16607)

Adds a short description of `PyDoc_STRVAR` and `PyDoc_STR` to "Useful macros" section of C-API docs.

Currently, there is [one lone mention](https://docs.python.org/3/c-api/module.html?highlight=pydoc_strvar#c.PyModuleDef) in the C-API reference, despite the fact that `PyDoc_STRVAR` is ubiquitous to `Modules/`.

Additionally, this properly uses `c:macro` within `Doc/c-api/module.rst` to link.

5 years agobpo-40401: Remove duplicate pyhash.h include from pythoncore.vcxproj (GH-19725)
Ammar Askar [Mon, 27 Apr 2020 02:08:17 +0000 (19:08 -0700)] 
bpo-40401: Remove duplicate pyhash.h include from pythoncore.vcxproj (GH-19725)

5 years agobpo-40387: Improve queue join() example. (GH-19724)
Raymond Hettinger [Mon, 27 Apr 2020 01:11:27 +0000 (18:11 -0700)] 
bpo-40387: Improve queue join() example. (GH-19724)

5 years agobpo-40396: Support GenericAlias in the typing functions. (GH-19718)
Serhiy Storchaka [Sun, 26 Apr 2020 18:21:08 +0000 (21:21 +0300)] 
bpo-40396: Support GenericAlias in the typing functions. (GH-19718)

5 years agoFix typo in Lib/typing.py (GH-19717)
Nickolena Fisher [Sun, 26 Apr 2020 17:49:11 +0000 (12:49 -0500)] 
Fix typo in Lib/typing.py (GH-19717)

5 years agoFix typo in object.__format__ docs (GH-19504)
Heshy Roskes [Sun, 26 Apr 2020 01:57:09 +0000 (21:57 -0400)] 
Fix typo in object.__format__ docs (GH-19504)

5 years agobpo-40275: Avoid importing logging in test.support (GH-19601)
Serhiy Storchaka [Sat, 25 Apr 2020 08:35:18 +0000 (11:35 +0300)] 
bpo-40275: Avoid importing logging in test.support (GH-19601)

Import logging lazily in assertLogs() in unittest.
Move TestHandler from test.support to logging_helper.

5 years agobpo-40275: Avoid importing socket in test.support (GH-19603)
Serhiy Storchaka [Sat, 25 Apr 2020 07:06:29 +0000 (10:06 +0300)] 
bpo-40275: Avoid importing socket in test.support (GH-19603)

* Move socket related functions from test.support to socket_helper.
* Import socket, nntplib and urllib.error lazily in transient_internet().
* Remove importing multiprocess.

5 years agobpo-40275: Avoid importing asyncio in test.support (GH-19600)
Serhiy Storchaka [Sat, 25 Apr 2020 07:04:10 +0000 (10:04 +0300)] 
bpo-40275: Avoid importing asyncio in test.support (GH-19600)

* Import asyncio lazily in unittest (only when IsolatedAsyncioTestCase is used).
* Import asyncio.events lazily in test.support.