]> git.ipfire.org Git - thirdparty/Python/cpython.git/log
thirdparty/Python/cpython.git
4 years agobpo-42604: always set EXT_SUFFIX=${SOABI}${SHLIB_SUFFIX} when using configure (GH...
Matti Picus [Sun, 20 Dec 2020 02:56:57 +0000 (04:56 +0200)] 
bpo-42604: always set EXT_SUFFIX=${SOABI}${SHLIB_SUFFIX} when using configure (GH-23708)

Now all platforms use a value for the "EXT_SUFFIX" build variable derived
from SOABI (for instance in FreeBSD, "EXT_SUFFIX" is now ".cpython-310d.so"
instead of ".so"). Previously only Linux, Mac and VxWorks were using a value
for "EXT_SUFFIX" that included "SOABI".

Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
4 years agobpo-41724: Explain when the conversion is not possible with detect_types enabled...
sblondon [Sat, 19 Dec 2020 22:52:39 +0000 (23:52 +0100)] 
bpo-41724: Explain when the conversion is not possible with detect_types enabled (GH-23855)

* Explain when the conversion is not possible with detect_types enabled

4 years ago[doc] Mention with and except clauses in globals() (GH-13232)
Andre Delfino [Sat, 19 Dec 2020 15:48:06 +0000 (12:48 -0300)] 
[doc] Mention with and except clauses in globals() (GH-13232)

4 years agobpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781)
Serhiy Storchaka [Sat, 19 Dec 2020 10:17:08 +0000 (12:17 +0200)] 
bpo-42630: Improve error reporting in Tkinter for absent default root (GH-23781)

* Tkinter functions and constructors which need a default root window
  raise now RuntimeError with descriptive message instead of obscure
  AttributeError or NameError if it is not created yet or cannot
  be created automatically.

* Add tests for all functions which use default root window.

* Fix import in the pynche script.

4 years agobpo-42470: Do not warn on sequences which are also sets in random.sample() (GH-23665)
masklinn [Sat, 19 Dec 2020 04:33:36 +0000 (05:33 +0100)] 
bpo-42470: Do not warn on sequences which are also sets in random.sample() (GH-23665)

4 years agoFixed typo in itertools documentation (GH-23816)
Casper Smet [Sat, 19 Dec 2020 04:28:21 +0000 (05:28 +0100)] 
Fixed typo in itertools documentation (GH-23816)

4 years agobpo-42559: Not that getrandbits() is non-negative. (GH-23843)
Raymond Hettinger [Sat, 19 Dec 2020 01:03:10 +0000 (17:03 -0800)] 
bpo-42559: Not that getrandbits() is non-negative. (GH-23843)

4 years agobpo-34805: Guarantee that __subclasses__() is in definition order. (GH-23844)
Raymond Hettinger [Sat, 19 Dec 2020 00:53:50 +0000 (16:53 -0800)] 
bpo-34805:  Guarantee that __subclasses__() is in definition order. (GH-23844)

4 years agobpo-24792: Fix zipimporter masking the cause of import errors (GH-22204)
Irit Katriel [Sat, 19 Dec 2020 00:09:54 +0000 (00:09 +0000)] 
bpo-24792: Fix zipimporter masking the cause of import errors (GH-22204)

zipimport's _unmarshal_code swallows import errors and then _get_module_code doesn't know the cause of the error, and returns the generic, and sometimes incorrect, 'could not find...'.

Automerge-Triggered-By: GH:brettcannon
4 years agobpo-36769: Document that fnmatch.filter supports any kind of iterable (#13039)
Andre Delfino [Fri, 18 Dec 2020 19:10:20 +0000 (16:10 -0300)] 
bpo-36769: Document that fnmatch.filter supports any kind of iterable (#13039)

4 years agobpo-34398: Allow glossary results to show up on search page (GH-8773)
Ammar Askar [Fri, 18 Dec 2020 19:00:51 +0000 (14:00 -0500)] 
bpo-34398: Allow glossary results to show up on search page (GH-8773)

4 years agobpo-42675: Document collections.abc.Callable changes (GH-23839)
kj [Fri, 18 Dec 2020 17:39:26 +0000 (01:39 +0800)] 
bpo-42675: Document collections.abc.Callable changes (GH-23839)

4 years agobpo-41891: ensure asyncio.wait_for waits for task completion (#22461)
Richard Kojedzinszky [Fri, 18 Dec 2020 17:26:04 +0000 (18:26 +0100)] 
bpo-41891: ensure asyncio.wait_for waits for task completion (#22461)

4 years agobpo-40956: Fix sqlite3 AC code (GH-23837)
Dong-hee Na [Fri, 18 Dec 2020 15:41:33 +0000 (00:41 +0900)] 
bpo-40956: Fix sqlite3 AC code (GH-23837)

4 years agobpo-40956: Convert _sqlite3.Connection to Argument Clinic (GH-23341)
Erlend Egeberg Aasland [Fri, 18 Dec 2020 14:25:35 +0000 (15:25 +0100)] 
bpo-40956: Convert _sqlite3.Connection to Argument Clinic (GH-23341)

4 years agobpo-17140: Document multiprocessing's ThreadPool (GH-23812)
Matt Wozniski [Fri, 18 Dec 2020 13:05:46 +0000 (08:05 -0500)] 
bpo-17140: Document multiprocessing's ThreadPool (GH-23812)

Up until now, the `multiprocessing.pool.ThreadPool` class has gone
undocumented, despite being a public class in multiprocessing that is
included in `multiprocessing.pool.__all__`.

4 years agobpo-42238: Check Misc/NEWS.d/next/ for reStructuredText issues. (GH-23802)
Julien Palard [Fri, 18 Dec 2020 09:48:08 +0000 (10:48 +0100)] 
bpo-42238: Check Misc/NEWS.d/next/ for reStructuredText issues. (GH-23802)

4 years agobpo-39096: Format specification documentation fixes for numeric types (GH-23575)
Mark Dickinson [Fri, 18 Dec 2020 09:24:06 +0000 (09:24 +0000)] 
bpo-39096: Format specification documentation fixes for numeric types (GH-23575)

4 years agobpo-1635741: Port _thread to multiphase init (GH-23811)
Victor Stinner [Fri, 18 Dec 2020 00:39:00 +0000 (01:39 +0100)] 
bpo-1635741: Port _thread to multiphase init (GH-23811)

Port the _thread extension module to the multiphase initialization
API (PEP 489) and convert its static types to heap types.

Add a traverse function to the lock type, so the garbage collector
can break reference cycles.

4 years agobpo-42199: Fix bytecode_helper assertNotInBytecode (#23031)
Max Bernstein [Fri, 18 Dec 2020 00:30:29 +0000 (16:30 -0800)] 
bpo-42199: Fix bytecode_helper assertNotInBytecode (#23031)

* bpo-42199: Fix bytecode_helper assertNotInBytecode

Add tests.

* 📜🤖 Added by blurb_it.

Co-authored-by: Dino Viehland <dinoviehland@fb.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
4 years agobpo-42670: Fix a missing word in the itertools.product() docs (GH-23823)
Zackery Spytz [Thu, 17 Dec 2020 20:24:43 +0000 (13:24 -0700)] 
bpo-42670: Fix a missing word in the itertools.product() docs (GH-23823)

4 years agobpo-31904: posixpath.expanduser() handles None user home on VxWorks (GH-23530)
pxinwr [Thu, 17 Dec 2020 19:22:29 +0000 (03:22 +0800)] 
bpo-31904: posixpath.expanduser() handles None user home on VxWorks (GH-23530)

4 years ago[doc] Fix a few margins due to bad markup (GH-23619)
Andre Delfino [Thu, 17 Dec 2020 17:25:55 +0000 (14:25 -0300)] 
[doc] Fix a few margins due to bad markup (GH-23619)

4 years agobpo-42246: Make sure that `f_lasti`, and thus `f_lineno`, is set correctly after...
Mark Shannon [Thu, 17 Dec 2020 13:55:28 +0000 (13:55 +0000)] 
bpo-42246: Make sure that `f_lasti`, and thus `f_lineno`, is set correctly after raising or reraising an exception (GH-23803)

* Ensure that f_lasti is set correctly after an exception is raised to conform to PEP 626.

* Update importlib

* Add NEWS.

4 years agobpo-26564: fix obsolete comment in traceback.c (GH-23819)
Irit Katriel [Thu, 17 Dec 2020 12:33:07 +0000 (12:33 +0000)] 
bpo-26564: fix obsolete comment in traceback.c (GH-23819)

4 years agobpo-31904: Skip some asyncio tests on VxWorks (#23815)
pxinwr [Thu, 17 Dec 2020 10:04:47 +0000 (18:04 +0800)] 
bpo-31904: Skip some asyncio tests on VxWorks (#23815)

4 years ago[doc] Fix erroneous backslashes in signatures and names (GH-23658)
Andre Delfino [Thu, 17 Dec 2020 01:37:28 +0000 (22:37 -0300)] 
[doc] Fix erroneous backslashes in signatures and names (GH-23658)

The issue being resolved is shown in the 3.10 docs (if you select docs for older versions you won't see a visual glitch).

The newer sphinx version that produces the 3.10 docs doesn't treat the backslash to escape things in some situations it previously did.

4 years agoCorrect referenced RFC number in cgi module (GH-22827)
Mike Lei [Thu, 17 Dec 2020 01:34:19 +0000 (01:34 +0000)] 
Correct referenced RFC number in cgi module (GH-22827)

The quoted sentence can be found from the last paragraph of RFC 2046, Section 5.1, while the content of RFC 2026 is unrelated to this module.

4 years agoFix indentation for get_stats_profile() docs (GH-23618)
Matthew Suozzo [Wed, 16 Dec 2020 23:17:22 +0000 (18:17 -0500)] 
Fix indentation for get_stats_profile() docs (GH-23618)

The existing method is indented one too many times which
makes it look like a sub-method of print_callees().

4 years agobpo-37961: Fix regression in tracemalloc.Traceback.__repr__ (GH-23805)
Daniel Hahler [Wed, 16 Dec 2020 21:38:32 +0000 (22:38 +0100)] 
bpo-37961: Fix regression in tracemalloc.Traceback.__repr__ (GH-23805)

Regression in 8d59eb1b66c51b2b918da9881c57d07d08df43b7.

4 years agobpo-38323: Add guard clauses in MultiLoopChildWatcher. (#22756)
Chris Jerdonek [Wed, 16 Dec 2020 17:50:25 +0000 (09:50 -0800)] 
bpo-38323: Add guard clauses in MultiLoopChildWatcher. (#22756)

This is a trivial refactor in preparation for a fix for bpo-38323.

4 years agobpo-23915: update and elucidate documentation of with_traceback (GH-23680)
Irit Katriel [Wed, 16 Dec 2020 16:03:32 +0000 (16:03 +0000)] 
bpo-23915: update and elucidate documentation of with_traceback (GH-23680)

4 years agoClarify eval() doc from library/functions. (GH-22700)
Antoine [Wed, 16 Dec 2020 15:45:19 +0000 (16:45 +0100)] 
Clarify eval() doc from library/functions. (GH-22700)

4 years agobpo-40686: Fix compiler warnings on _zoneinfo.c (GH-23614)
Victor Stinner [Wed, 16 Dec 2020 15:26:15 +0000 (16:26 +0100)] 
bpo-40686: Fix compiler warnings on _zoneinfo.c (GH-23614)

"uint8_t day" is unsigned and so "day < 0" test is always true.
Remove the test to fix the following warnings on Windows:

modules\_zoneinfo.c(1224): warning C4068: unknown pragma
modules\_zoneinfo.c(1225): warning C4068: unknown pragma
modules\_zoneinfo.c(1227): warning C4068: unknown pragma

4 years agoFix reStructuredText typo in NEWS.d. (GH-23800)
Julien Palard [Wed, 16 Dec 2020 15:22:19 +0000 (16:22 +0100)] 
Fix reStructuredText typo in NEWS.d. (GH-23800)

4 years agoAdd symbols of the stable ABI to python3dll.c (GH-23598)
Victor Stinner [Wed, 16 Dec 2020 14:08:23 +0000 (15:08 +0100)] 
Add symbols of the stable ABI to python3dll.c (GH-23598)

Add the following symbols to python3dll.c:

* PyFrame_GetCode (bpo-40421)
* PyFrame_GetLineNumber (bpo-40421)
* PyModule_AddObjectRef (bpo-1635741)
* PyObject_CallNoArgs (bpo-37194)
* PyThreadState_GetFrame (bpo-39947)
* PyThreadState_GetID (bpo-39947)
* PyThreadState_GetInterpreter (bpo-39947)

4 years agobpo-42645: Make sure that return/break/continue are only traced once when exiting...
Mark Shannon [Wed, 16 Dec 2020 13:07:01 +0000 (13:07 +0000)] 
bpo-42645: Make sure that return/break/continue are only traced once when exiting via a finally block. (GH-23780)

* Make sure that return/break/continue are only traced once when exiting via a finally block.

* Add test for return in try-finally.

* Update importlib

4 years agobpo-42615: Delete redundant jump instructions that only bypass empty blocks (GH-23733)
Om G [Wed, 16 Dec 2020 12:18:05 +0000 (17:48 +0530)] 
bpo-42615: Delete redundant jump instructions that only bypass empty blocks (GH-23733)

* Delete jump instructions that bypass empty blocks

* Add news entry

* Explicitly check for unconditional jump opcodes

Using the is_jump function results in the inclusion of instructions like
returns for which this optimization is not really valid. So, instead
explicitly check that the instruction is an unconditional jump.

* Handle conditional jumps, delete jumps gracefully

* Ensure b_nofallthrough and b_reachable are valid

* Add test for redundant jumps

* Regenerate importlib.h and edit Misc/ACKS

* Fix bad whitespace

4 years agobpo-1635741: Refactor _threadmodule.c (GH-23793)
Victor Stinner [Wed, 16 Dec 2020 11:20:33 +0000 (12:20 +0100)] 
bpo-1635741: Refactor _threadmodule.c (GH-23793)

* Fix ExceptHookArgsType name: "_thread.ExceptHookArgs", instead of
  "_thread._ExceptHookArgs".
* PyInit__thread() no longer intializes interp->num_threads to 0:
  it is already done in PyInterpreterState_New().
* Use PyModule_AddType(), Py_NewRef() and Py_XNewRef().
* Replace str_dict variable with _Py_IDENTIFIER(__dict__).
* Remove assert(Py_IS_TYPE(obj, &Locktype)) from release_sentinel()
  to avoid having to retrive the type from this callback.
* Add thread_bootstate_free()
* Rename t_bootstrap() to thread_run()
* bootstate structure: rename keyw member to kwargs

4 years agobpo-42613: Fix freeze.py config directory (GH-23792)
Victor Stinner [Wed, 16 Dec 2020 11:12:36 +0000 (12:12 +0100)] 
bpo-42613: Fix freeze.py config directory (GH-23792)

Fix freeze.py tool to use the prope config and library directories.

4 years agobpo-40364: asyncio uses os.waitstatus_to_exitcode() (GH-23798)
Victor Stinner [Wed, 16 Dec 2020 11:11:24 +0000 (12:11 +0100)] 
bpo-40364: asyncio uses os.waitstatus_to_exitcode() (GH-23798)

test_unix_events.py no longer checks if waitstatus_to_exitcode() mock
has been called or not to make the test more functional, rather than
checking the exact implementation.

4 years agobpo-19733: Re-enable tests for -image option in Tkinter (GH-23785)
Serhiy Storchaka [Wed, 16 Dec 2020 10:31:49 +0000 (12:31 +0200)] 
bpo-19733: Re-enable tests for -image option in Tkinter (GH-23785)

4 years agobpo-41804: Enhance test_epoll.test_control_and_wait() (GH-23795)
Victor Stinner [Wed, 16 Dec 2020 10:16:25 +0000 (11:16 +0100)] 
bpo-41804: Enhance test_epoll.test_control_and_wait() (GH-23795)

Use shorter timeout and replace send() with sendall().

4 years agobpo-42644: Validate values in logging.disable() (#23786)
Matthias Bussonnier [Wed, 16 Dec 2020 09:43:39 +0000 (01:43 -0800)] 
bpo-42644: Validate values in logging.disable() (#23786)

* bpo-42644: Validate values in logging.disable()

Technically make the value of manager a property that checks and convert
values assigned to it properly. This has the side effect of making
`logging.disable` also accept strings representing the various level of
warnings.

We want to validate the type of the disable attribute at assignment
time, as it is later compared to other levels when emitting warnings and
would generate a `TypeError: '>=' not supported between ....` in a
different part of the code base, which can make it difficult to track
down.

When assigned an incorrect value; it will raise a TypeError when the
wrong type, or ValueError if an invalid str.

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
4 years agobpo-42179: Clarify exception chaining (GH-23160)
Vladimir [Wed, 16 Dec 2020 02:47:26 +0000 (18:47 -0800)] 
bpo-42179: Clarify exception chaining (GH-23160)

* Update errors.rst

Clarify exception chaining behaviour and give a reference to the library documentation.

* Update errors.rst

Wording

* Update errors.rst

Spelling

* Update errors.rst

Remove mentioning of special attributes as folks think it's too much for beginners.

4 years agoUpdate Stale action message (GH-23791)
Mariatta [Wed, 16 Dec 2020 02:36:33 +0000 (18:36 -0800)] 
Update Stale action message (GH-23791)

We don't close PRs after it becomes stale.

4 years agobpo-42090: zipfile.Path.joinpath now accepts multiple arguments (GH-22976)
Jason R. Coombs [Wed, 16 Dec 2020 02:12:54 +0000 (21:12 -0500)] 
bpo-42090: zipfile.Path.joinpath now accepts multiple arguments (GH-22976)

Automerge-Triggered-By: GH:jaraco
4 years agobpo-31904: Skip os.path.expanduser() tests on VxWorks (GH-23776)
pxinwr [Tue, 15 Dec 2020 21:24:00 +0000 (05:24 +0800)] 
bpo-31904: Skip os.path.expanduser() tests on VxWorks (GH-23776)

4 years agobpo-31904: Skip some tests of changing owner in _test_all_chown_common() on VxWorks...
pxinwr [Tue, 15 Dec 2020 21:21:53 +0000 (05:21 +0800)] 
bpo-31904: Skip some tests of changing owner in _test_all_chown_common() on VxWorks (GH-23716)

4 years agobpo-31904: Disable os.popen and popen test cases on VxWorks (GH-21687)
pxinwr [Tue, 15 Dec 2020 21:20:07 +0000 (05:20 +0800)] 
bpo-31904: Disable os.popen and popen test cases on VxWorks (GH-21687)

4 years agoAdding "stale" GitHub Action (GH-21247)
Mariatta [Tue, 15 Dec 2020 19:58:43 +0000 (11:58 -0800)] 
Adding "stale" GitHub Action (GH-21247)

Adding "stale" GitHub Action

Added the "stale" GitHub action to the CPython repo.
PR's older than 30 days will be labeled as stale using the "stale-pr" label.

Closes https://github.com/python/core-workflow/issues/372

Co-authored-by: Brett Cannon <brett@python.org>
4 years agobpo-40219: Lowered ttk LabeledScale dummy (GH-21467)
E-Paine [Tue, 15 Dec 2020 19:42:55 +0000 (19:42 +0000)] 
bpo-40219: Lowered ttk LabeledScale dummy (GH-21467)

4 years agoLet dependabot create PRs against the maintenance branches (GH-22992)
Mariatta [Tue, 15 Dec 2020 19:04:55 +0000 (11:04 -0800)] 
Let dependabot create PRs against the maintenance branches (GH-22992)

With this, we don't have to manually trigger backport whenever there is update to GitHub Actions dependencies.

4 years agoUpdate stable ABI script for MacOS and update list of exported symbols (GH-23783)
Pablo Galindo [Tue, 15 Dec 2020 18:16:13 +0000 (18:16 +0000)] 
Update stable ABI script for MacOS and update list of exported symbols (GH-23783)

4 years agobpo-42641: Enhance test_select.test_select() (GH-23782)
Victor Stinner [Tue, 15 Dec 2020 17:06:36 +0000 (18:06 +0100)] 
bpo-42641: Enhance test_select.test_select() (GH-23782)

Enhance test_select.test_select(): it now takes 500 ms rather than 10
seconds.

* Use Python rather than a shell as the child process to make the
  test more portable.
* Use a sleep of 50 ms per line rather than 1 second.
* Use subprocess.Popen rather than os.popen().

4 years agobpo-36675: Doc: Reveal doctest directives (GH-23620)
Julien Palard [Tue, 15 Dec 2020 16:23:03 +0000 (17:23 +0100)] 
bpo-36675: Doc: Reveal doctest directives (GH-23620)

4 years agobpo-42639: atexit._run_exitfuncs() uses sys.unraisablehook (GH-23779)
Victor Stinner [Tue, 15 Dec 2020 16:12:02 +0000 (17:12 +0100)] 
bpo-42639: atexit._run_exitfuncs() uses sys.unraisablehook (GH-23779)

atexit._run_exitfuncs() now logs callback exceptions using
sys.unraisablehook, rather than logging them directly into
sys.stderr and raising the last exception.

Run GeneralTest of test_atexit in a subprocess since it calls
atexit._clear() which clears all atexit callbacks.

_PyAtExit_Fini() sets state->callbacks to NULL.

4 years agobpo-32381: pymain_run_file() uses PySys_FormatStderr() (GH-23778)
Victor Stinner [Tue, 15 Dec 2020 15:25:27 +0000 (16:25 +0100)] 
bpo-32381: pymain_run_file() uses PySys_FormatStderr() (GH-23778)

If config->run_filename doesn't exist, log the error into sys.stderr
using "%R" format, to escape properly unencodable characters (usually
with backslashreplace).

4 years agobpo-42639: Add script_helper.run_test_script() (GH-23777)
Victor Stinner [Tue, 15 Dec 2020 15:08:16 +0000 (16:08 +0100)] 
bpo-42639: Add script_helper.run_test_script() (GH-23777)

* Add run_test_script() function to test.support.script_helper.
* Rename Lib/test/eintrdata/eintr_tester.py to
  Lib/test/_test_eintr.py.
* test_eintr.py uses run_test_script().

4 years agobpo-14935: Remove static state from the _csv module (GH-23224)
Petr Viktorin [Tue, 15 Dec 2020 14:14:35 +0000 (15:14 +0100)] 
bpo-14935: Remove static state from the _csv module (GH-23224)

Uses code from: https://github.com/python/cpython/pull/16078

Co-authored-by: Marcel Plch <gmarcel.plch@gmail.com>
Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
Co-authored-by: Hai Shi <shihai1992@gmail.com>
4 years agobpo-42639: Move atexit state to PyInterpreterState (GH-23763)
Victor Stinner [Tue, 15 Dec 2020 13:34:19 +0000 (14:34 +0100)] 
bpo-42639: Move atexit state to PyInterpreterState (GH-23763)

* Add _PyAtExit_Call() function and remove pyexitfunc and
  pyexitmodule members of PyInterpreterState. The function
  logs atexit callback errors using _PyErr_WriteUnraisableMsg().
* Add _PyAtExit_Init() and _PyAtExit_Fini() functions.
* Remove traverse, clear and free functions of the atexit module.

Co-authored-by: Dong-hee Na <donghee.na@python.org>
4 years agobpo-42246: Remove DO_NOT_EMIT_BYTECODE macros, so that while loops and if statements...
Mark Shannon [Tue, 15 Dec 2020 11:07:50 +0000 (11:07 +0000)] 
bpo-42246: Remove DO_NOT_EMIT_BYTECODE macros, so that while loops and if statements conform to PEP 626. (GH-23743)

4 years agobpo-33610: Edit idlelib.codecontext (GH-23773)
Terry Jan Reedy [Tue, 15 Dec 2020 05:24:01 +0000 (00:24 -0500)] 
bpo-33610: Edit idlelib.codecontext (GH-23773)

Add sentence to module docstring and import tkinter items.

4 years agobpo-31904: Enable libpython3.so shared library for VxWorks (GH-23741)
pxinwr [Mon, 14 Dec 2020 22:14:43 +0000 (06:14 +0800)] 
bpo-31904: Enable libpython3.so shared library for VxWorks (GH-23741)

4 years agobpo-42639: atexit now logs callbacks exceptions (GH-23771)
Victor Stinner [Mon, 14 Dec 2020 22:07:54 +0000 (23:07 +0100)] 
bpo-42639: atexit now logs callbacks exceptions (GH-23771)

At Python exit, if a callback registered with atexit.register()
fails, its exception is now logged. Previously, only some exceptions
were logged, and the last exception was always silently ignored.

Add _PyAtExit_Call() function and remove
PyInterpreterState.atexit_func member. call_py_exitfuncs() now calls
directly _PyAtExit_Call().

The atexit module must now always be built as a built-in module.

4 years agobpo-42639: Cleanup atexitmodule.c (GH-23770)
Victor Stinner [Mon, 14 Dec 2020 21:40:40 +0000 (22:40 +0100)] 
bpo-42639: Cleanup atexitmodule.c (GH-23770)

* Rename "atexitmodule_state" to "struct atexit_state".
* Rename "modstate" to "state".
* Rename "self" parameter to "module".
* test_atexit uses textwrap.dedent().
* Remove _Py_PyAtExit() function: inline it into atexit_exec().
* PyInterpreterState: rename pyexitfunc to atexit_func, rename
  pyexitmodule to atexit_module.

4 years agobpo-41877: Check for misspelled speccing arguments (GH-23737)
vabr-g [Mon, 14 Dec 2020 18:30:09 +0000 (19:30 +0100)] 
bpo-41877: Check for misspelled speccing arguments (GH-23737)

patch, patch.object and create_autospec silently ignore misspelled
arguments such as autospect, auto_spec and set_spec. This can lead
to tests failing to check what they are supposed to check.

This change adds a check causing a RuntimeError if the above
functions get any of the above misspellings as arguments. It also
adds a new argument, "unsafe", which can be set to True to disable
this check.

Also add "!r" to format specifiers in added error messages.

4 years agobpo-36541: Add lib2to3 grammar PEP-570 pos-only arg parsing (GH-23759)
Gregory P. Smith [Mon, 14 Dec 2020 17:10:10 +0000 (09:10 -0800)] 
bpo-36541: Add lib2to3 grammar PEP-570 pos-only arg parsing (GH-23759)

Add positional only args support to lib2to3 pgen2.

This adds 3.8's PEP-570 support to lib2to3's pgen2.  lib2to3, while
being deprecated is still used by things to parse all versions of Python
code today.  We need it to support parsing modern 3.8 and 3.9 constructs.

Also add tests for complex *expr and **expr's.

4 years agobpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious...
Mark Shannon [Mon, 14 Dec 2020 11:28:39 +0000 (11:28 +0000)] 
bpo-42635: Mark JUMP_ABSOLUTE at end of 'for' loop as artificial to avoid spurious line events. (GH-23761)

4 years agoDon't generate spurious line number in try-except-finally. (#23760)
Mark Shannon [Mon, 14 Dec 2020 10:19:10 +0000 (10:19 +0000)] 
Don't generate spurious line number in try-except-finally. (#23760)

4 years agobpo-42598: Fix implicit function declarations in configure (GH-23690)
Joshua Root [Sun, 13 Dec 2020 20:56:34 +0000 (07:56 +1100)] 
bpo-42598: Fix implicit function declarations in configure (GH-23690)

This is invalid in C99 and later and is an error with some compilers
(e.g. clang in Xcode 12), and can thus cause configure checks to
produce incorrect results.

4 years agobpo-42195: Ensure consistency of Callable's __args__ in collections.abc and typing...
kj [Sun, 13 Dec 2020 18:38:24 +0000 (02:38 +0800)] 
bpo-42195: Ensure consistency of Callable's __args__ in collections.abc and typing (GH-23060)

4 years agobpo-30858: Improve error location for expressions with assignments (GH-23753)
Pablo Galindo [Sun, 13 Dec 2020 16:46:48 +0000 (16:46 +0000)] 
bpo-30858: Improve error location for expressions with assignments (GH-23753)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
4 years agoAdd two spaces around equal sign (#23719)
sblondon [Sun, 13 Dec 2020 05:27:22 +0000 (06:27 +0100)] 
Add two spaces around equal sign (#23719)

Fit to PEP8 coding style

4 years agobpo-39717: [tarfile] update nested exception raising (GH-23739)
Ethan Furman [Sat, 12 Dec 2020 21:26:44 +0000 (13:26 -0800)] 
bpo-39717: [tarfile] update nested exception raising (GH-23739)

- `from None` if the new exception uses, or doesn't need, the previous one
- `from e` if the previous exception is still relevant

4 years agobpo-41879: Doc: Fix description of async for statement (GH-23548)
Nick Gaya [Fri, 11 Dec 2020 08:27:35 +0000 (00:27 -0800)] 
bpo-41879: Doc: Fix description of async for statement (GH-23548)

Fix the wording in the documentation of `async for` to correctly describe asynchronous iterables.  This fix is relevant for version 3.7 onward.

4 years agobpo-42059: Fix required/optional keys for TypedDict(..., total=False) (GH-22736)
Alex Grönholm [Thu, 10 Dec 2020 21:49:05 +0000 (23:49 +0200)] 
bpo-42059: Fix required/optional keys for TypedDict(..., total=False) (GH-22736)

4 years agobpo-34750: [Enum] add `_EnumDict.update()` support (GH-23725)
Ethan Furman [Thu, 10 Dec 2020 21:07:00 +0000 (13:07 -0800)] 
bpo-34750: [Enum] add `_EnumDict.update()` support (GH-23725)

This allows easier Enum construction in unusual cases, such as including dynamic member definitions into a class definition:

# created dynamically
foo_defines = {'FOO_CAT': 'aloof', 'BAR_DOG': 'friendly', 'FOO_HORSE': 'big'}

class Foo(Enum):
    vars().update({
            k: v
            for k, v in foo_defines.items()
            if k.startswith('FOO_')
            })
    def upper(self):
        # example method
        return self.value.upper()

4 years agobpo-42385: [Enum] add `_generate_next_value_` to StrEnum (GH-23735)
Ethan Furman [Thu, 10 Dec 2020 20:20:06 +0000 (12:20 -0800)] 
bpo-42385: [Enum] add `_generate_next_value_` to StrEnum (GH-23735)

The default for auto() is to return an integer, which doesn't work for `StrEnum`.  The new `_generate_next_value_` for `StrEnum` returns the member name, lower cased.

4 years agobpo-41877: Improve docs for assert misspellings check in mock (GH-23729)
vabr-g [Thu, 10 Dec 2020 18:35:28 +0000 (19:35 +0100)] 
bpo-41877: Improve docs for assert misspellings check in mock (GH-23729)

This is a follow-up to
https://github.com/python/cpython/commit/4662fa9bfe4a849fe87bfb321d8ef0956c89a772.
That original commit expanded guards against misspelling assertions on
mocks. This follow-up updates the documentation and improves the error
message by pointing out the potential cause and solution.

Automerge-Triggered-By: GH:gpshead
4 years agobpo-42591: Export missing Py_FrozenMain() symbol (GH-23730)
Victor Stinner [Thu, 10 Dec 2020 17:39:17 +0000 (18:39 +0100)] 
bpo-42591: Export missing Py_FrozenMain() symbol (GH-23730)

Export the Py_FrozenMain() function: fix a Python 3.9.0 regression.
Python 3.9 uses -fvisibility=hidden and the function was not exported
explicitly and so not exported.

Add also Py_FrozenMain to the stable ABI on Windows.

4 years agobpo-42517: [Enum] do not convert private names into members (GH-23722)
Ethan Furman [Thu, 10 Dec 2020 01:12:11 +0000 (17:12 -0800)] 
bpo-42517: [Enum] do not convert private names into members (GH-23722)

private names, such as `_Color__hue` and `_Color__hue_` are now normal attributes, and do not become members nor raise exceptions

4 years agobpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)
Ethan Furman [Thu, 10 Dec 2020 00:41:22 +0000 (16:41 -0800)] 
bpo-42567: [Enum] call __init_subclass__ after members are added (GH-23714)

When creating an Enum, type.__new__ calls __init_subclass__, but at that point the members have not been added.

This patch suppresses the initial call, then manually calls the ancestor __init_subclass__ before returning the new Enum class.

4 years ago[doc] Link to issue regarding logging.disable level param default value (GH-23726)
Andre Delfino [Wed, 9 Dec 2020 23:37:39 +0000 (20:37 -0300)] 
[doc] Link to issue regarding logging.disable level param default value (GH-23726)

4 years ago[doc] Document logging.basicConfig default format (GH-23710)
Andre Delfino [Wed, 9 Dec 2020 21:56:17 +0000 (18:56 -0300)] 
[doc] Document logging.basicConfig default format (GH-23710)

Automerge-Triggered-By: GH:vsajip
4 years agobpo-31904: Define THREAD_STACK_SIZE for VxWorks (GH-23718)
pxinwr [Wed, 9 Dec 2020 21:47:28 +0000 (05:47 +0800)] 
bpo-31904: Define THREAD_STACK_SIZE for VxWorks (GH-23718)

4 years agobpo-32381: Add _PyRun_AnyFileObject() (GH-23723)
Victor Stinner [Wed, 9 Dec 2020 21:37:27 +0000 (22:37 +0100)] 
bpo-32381: Add _PyRun_AnyFileObject() (GH-23723)

pymain_run_file() no longer encodes the filename: pass the filename
as an object to the new _PyRun_AnyFileObject() function.

Add new private functions:

* _PyRun_AnyFileObject()
* _PyRun_InteractiveLoopObject()
* _Py_FdIsInteractive()

4 years agobpo-32381: Remove unused _Py_fopen() function (GH-23711)
Victor Stinner [Wed, 9 Dec 2020 19:54:31 +0000 (20:54 +0100)] 
bpo-32381: Remove unused _Py_fopen() function (GH-23711)

Remove the private _Py_fopen() function which is no longer needed.
Use _Py_wfopen() or _Py_fopen_obj() instead.

4 years agobpo-32381: Add _PyRun_SimpleFileObject() (GH-23709)
Victor Stinner [Tue, 8 Dec 2020 23:32:54 +0000 (00:32 +0100)] 
bpo-32381: Add _PyRun_SimpleFileObject() (GH-23709)

pymain_run_startup() now pass the filename as a Python object to
_PyRun_SimpleFileObject().

4 years agobpo-41439: Skip test_ssl and test_uuid tests if fork() is not supported (GH-21684)
pxinwr [Tue, 8 Dec 2020 23:20:19 +0000 (07:20 +0800)] 
bpo-41439: Skip test_ssl and test_uuid tests if fork() is not supported (GH-21684)

4 years agobpo-41443: Add more attribute checking in test_posix (GH-21688)
pxinwr [Tue, 8 Dec 2020 23:18:37 +0000 (07:18 +0800)] 
bpo-41443:  Add more attribute checking in test_posix (GH-21688)

4 years agobpo-35134: Add Include/cpython/pythonrun.h file (GH-23701)
Victor Stinner [Tue, 8 Dec 2020 22:51:54 +0000 (23:51 +0100)] 
bpo-35134: Add Include/cpython/pythonrun.h file (GH-23701)

Py_CompileString() is now always declared as a function by
Include/pythonrun.h. It is overriden with a macro in
Include/cpython/pythonrun.h.

4 years agobpo-32381: Rewrite PyErr_ProgramText() (GH-23700)
Victor Stinner [Tue, 8 Dec 2020 22:51:26 +0000 (23:51 +0100)] 
bpo-32381: Rewrite PyErr_ProgramText() (GH-23700)

PyErr_ProgramText() now calls PyErr_ProgramTextObject().

4 years ago[Enum] reformat and add doc strings (GH-23705)
Ethan Furman [Tue, 8 Dec 2020 20:26:56 +0000 (12:26 -0800)] 
[Enum] reformat and add doc strings (GH-23705)

4 years agobpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497)
Ethan Furman [Tue, 8 Dec 2020 19:14:10 +0000 (11:14 -0800)] 
bpo-41907: [Enum] fix format() behavior for IntFlag (GH-22497)

4 years agobpo-42111: Make the xxlimited module an example of best extension module practices...
Petr Viktorin [Tue, 8 Dec 2020 16:36:53 +0000 (17:36 +0100)] 
bpo-42111: Make the xxlimited module an example of best extension module practices (GH-23226)

- Copy existing xxlimited to xxlimited53 (named for the limited API version it uses)
- Build both modules, both in debug and release
- Test both modules

4 years ago bpo-41910: move news entry (GH-23695)
Terry Jan Reedy [Tue, 8 Dec 2020 15:29:49 +0000 (10:29 -0500)] 
 bpo-41910: move news entry  (GH-23695)

4 years agobpo-42599: Remove useless PyModule_GetWarningsModule() (GH-23691)
Hai Shi [Tue, 8 Dec 2020 14:42:42 +0000 (22:42 +0800)] 
bpo-42599: Remove useless PyModule_GetWarningsModule() (GH-23691)

Removed PyModule_GetWarningsModule() which is useless due to
the _warnings module was converted to a builtin module in 2.6.

4 years agobpo-32381: Fix PyRun_SimpleFileExFlags() encoding (GH-23642)
Victor Stinner [Tue, 8 Dec 2020 13:38:08 +0000 (14:38 +0100)] 
bpo-32381: Fix PyRun_SimpleFileExFlags() encoding (GH-23642)

Fix encoding name when running a ".pyc" file on Windows:
PyRun_SimpleFileExFlags() now uses the correct encoding to decode the
filename.

* Add pyrun_file() subfunction.
* Add pyrun_simple_file() subfunction.
* PyRun_SimpleFileExFlags() now calls _Py_fopen_obj() rather than
  _Py_fopen().

4 years agoPost 3.10.0a3
Pablo Galindo [Tue, 8 Dec 2020 02:31:04 +0000 (02:31 +0000)] 
Post 3.10.0a3