Commit Graph

106881 Commits

Author SHA1 Message Date
Kyle Stanley 8ec7cb53f0
bpo-40115: Fix refleak in test_asyncio.test_run_in_executor_cancel() (GH-19282)
Call explicitly self.loop.shutdown_default_executor().
2020-04-02 04:46:44 +02:00
Victor Stinner e7c98f08e2
bpo-40094: Fix which.py script exit code (GH-19286)
It now uses os.waitstatus_to_exitcode() to convert os.system() exit
status into an exit code.
2020-04-02 03:42:47 +02:00
Victor Stinner 9a679a0e47
bpo-40094: CGIHTTPRequestHandler logs exit code (GH-19285)
CGIHTTPRequestHandler of http.server now logs the CGI script exit
code, rather than the CGI script exit status of os.waitpid().

For example, if the script is killed by signal 11, it now logs:
"CGI script exit code -11."
2020-04-02 03:42:05 +02:00
Dong-hee Na e27916b1fc
bpo-37207: Use PEP 590 vectorcall to speed up dict() (GH-19280) 2020-04-02 02:55:43 +02:00
Victor Stinner 224e1c34d6
bpo-40146: Update OpenSSL to 1.1.1f in Azure Pipelines (GH-19288) 2020-04-02 02:53:33 +02:00
Victor Stinner 0b297d4ff1
bpo-39503: CVE-2020-8492: Fix AbstractBasicAuthHandler (GH-18284)
The AbstractBasicAuthHandler class of the urllib.request module uses
an inefficient regular expression which can be exploited by an
attacker to cause a denial of service. Fix the regex to prevent the
catastrophic backtracking. Vulnerability reported by Ben Caller
and Matt Schwager.

AbstractBasicAuthHandler of urllib.request now parses all
WWW-Authenticate HTTP headers and accepts multiple challenges per
header: use the realm of the first Basic challenge.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>
2020-04-02 02:52:20 +02:00
Victor Stinner d57cf55736
bpo-40094: mailcap.test() uses waitstatus_to_exitcode() (GH-19287)
mailcap.test() now uses os.waitstatus_to_exitcode() to convert
os.system() exit status into an exit code.
2020-04-02 02:00:06 +02:00
Pablo Galindo 168660b547
bpo-40141: Add line and column information to ast.keyword nodes (GH-19283) 2020-04-02 00:47:39 +01:00
Victor Stinner 65a796e527
bpo-40094: Add os.waitstatus_to_exitcode() (GH-19201)
Add os.waitstatus_to_exitcode() function to convert a wait status to an
exitcode.

Suggest waitstatus_to_exitcode() usage in the documentation when
appropriate.

Use waitstatus_to_exitcode() in:

* multiprocessing, os, subprocess and _bootsubprocess modules;
* test.support.wait_process();
* setup.py: run_command();
* and many tests.
2020-04-01 18:49:29 +02:00
Arnon Yaari 5dd836030e
bpo-38527: fix configure script for Solaris (GH-16845)
On Solaris, the regular "grep" command may be an old version that fails to search a binary file. We need to use the correct command (ggrep, in our case), which is found by the configure script earlier.

Automerge-Triggered-By: @pablogsal
2020-04-01 08:19:09 -07:00
Paulo Henrique Silva eacc074395
bpo-40071: Fix potential crash in _functoolsmodule.c (GH-19273)
Changes on 7dd549eb08 made _functools compatible with
PEP-489 and we could have multiple modules instances loaded.

But, right now there is no way to make `kwd_mark` global into
a per module instance variable. kwd_mark is used on lru_cache_new
which does not have a reference to a PyModule*, necessary to use
PyModule_GetState.

PEP-573 will solve this problem and will allow us to move the global
state to per-module data and properly clear the state when unloading
a module instance.

This change temporarily disable cleaning of kwd_mark to avoid NULL
pointer dereference if we clear kwd_mark and other module instances
still alive use it.
2020-04-01 17:06:21 +02:00
Barney Gale 00002e6d8b
bpo-39682: make `pathlib.Path` immutable by removing (undocumented) support for "closing" a path by using it as a context manager (GH-18846)
Support for using a path as a context manager remains, and is now a no-op.
2020-04-01 16:10:51 +02:00
Zackery Spytz 975ac326ff
bpo-33262: Deprecate passing None for `s` to shlex.split() (GH-6514)
* bpo-33262: Deprecate passing None for `s` to shlex.split()

This reads the string to split from standard input.

* Update What's New.

* Fix shlex.rst
2020-04-01 09:58:55 -04:00
Victor Stinner 7c72383f95
bpo-40094: Enhance os.WIFEXITED documentation (GH-19244) 2020-04-01 15:48:05 +02:00
Serhiy Storchaka 17b4733f2f
bpo-40130: _PyUnicode_AsKind() should not be exported. (GH-19265)
Make it a static function, and pass known attributes
(kind, data, length) instead of the PyUnicode object.
2020-04-01 15:41:49 +03:00
Steve Dower 3ef4a7e5a7
bpo-40121: Fix exception type in test (GH-19267) 2020-04-01 09:38:26 +01:00
Pablo Galindo 6eb9619c88
Handle when IOCTL_VM_SOCKETS_GET_LOCAL_CID does not exist in "socket" (GH-19270)
Running `test_socket` or anything that depends on it (like python -m
test.pythoninfo) crashes if IOCTL_VM_SOCKETS_GET_LOCAL_CID does not
exist in the socket module.

Automerge-Triggered-By: @pablogsal
2020-03-31 17:48:37 -07:00
Victor Stinner afeaea2d6e
bpo-40094: Add missing import to wait_process() (GH-19268) 2020-04-01 02:26:19 +02:00
Victor Stinner 6b982c22e5
bpo-40094: Add run_command() to setup.py (GH-19266) 2020-04-01 01:10:07 +02:00
Victor Stinner 16d75675d2
bpo-31160: Fix race condition in test_os.PtyTests (GH-19263)
bpo-31160, bpo-40094: Wait until the process completes before closing
the PTY to prevent sending SIGHUP to the child process.
2020-04-01 00:27:18 +02:00
Victor Stinner 40bfdb1594
bpo-40094: Add _bootsubprocess._waitstatus_to_exitcode (GH-19264)
* Add _waitstatus_to_exitcode() helper function to _bootsubprocess.
* Enhance check_output() error message if the command fails.

_bootsubprocess no longer handles WIFSTOPPED() case: it now raises a
ValueError.
2020-03-31 23:45:13 +02:00
Serhiy Storchaka 2c003eff8f
bpo-39943: Clean up marshal.c. (GH-19236)
* Add consts.
* Remove redundant casts and checks.
* Use concrete C API macros.
* Avoid raising and silencing OverflowError for ints.
2020-03-31 23:23:21 +03:00
Victor Stinner a9f9687a7c
bpo-40094: Enhance threading tests (GH-19260)
* Rewrite test_thread.test_forkinthread() to use
  support.wait_process() and wait for the child process in the main
  thread, not in the spawned thread.
* test_threading now uses support.wait_process() and checks the child
  process exit code to detect crashes.
2020-03-31 21:49:44 +02:00
Victor Stinner 27c6231f58
bpo-40094: Enhance fork and wait tests (GH-19259)
* test_fork1: remove duplicated wait_impl() method: reuse
  fork_wait.py implementation instead.
* Use exit code different than 0 to ensure that we executed the
  expected code path.
2020-03-31 21:46:40 +02:00
Victor Stinner 278c1e159c
bpo-40094: Add test.support.wait_process() (GH-19254)
Moreover, the following tests now check the child process exit code:

* test_os.PtyTests
* test_mailbox.test_lock_conflict()
* test_tempfile.test_process_awareness()
* test_uuid.testIssue8621()
* multiprocessing resource tracker tests
2020-03-31 20:08:12 +02:00
Victor Stinner 400e1dbcad
Document most common signals (GH-19245)
Document individual signals (only the most common signals):
description, default action, availability.
2020-03-31 19:13:10 +02:00
Benjamin Peterson cd16661f90
closes bpo-40125: Update multissltests.py to use OpenSSL 1.1.1f. (GH-19248) 2020-03-31 10:49:56 -05:00
Victor Stinner 01e743d704
bpo-40003: test.bisect_cmd copies Python options (GH-19246)
test.bisect_cmd now copies Python command line options like -O or -W.
Moreover, emit a warning if test.bisect_cmd is used with
-w/--verbose2 option.
2020-03-31 17:25:56 +02:00
Victor Stinner 8d84adcd73
bpo-32591: _PyErr_WarnUnawaitedCoroutine() sets source (GH-19247)
The _PyErr_WarnUnawaitedCoroutine() fallback now also sets the
coroutine object as the source of the warning, as done by the Python
implementation warnings._warn_unawaited_coroutine().

Moreover, don't truncate the coroutine name: Python supports
arbitrary string length to format the message.
2020-03-31 17:25:12 +02:00
Dong-hee Na 5be8241392
bpo-1635741: Port math module to multiphase initialization (GH-19243) 2020-03-31 16:33:22 +02:00
Dong-hee Na 1cb763b880
bpo-1635741: Port _uuid module to multiphase initialization (GH-19242) 2020-03-31 14:43:47 +02:00
Steve Dower 63ba5cccf4
bpo-40121: Fixes audit event raised on creating a new socket (GH-19238) 2020-03-31 12:38:53 +01:00
Pablo Galindo ef67512b40
bpo-40108: Improve the error message in runpy when importing a module that includes the extension (GH-19239) 2020-03-31 12:23:55 +01:00
Mathieu Dupuy c49016e67c
fix comma location in various places (GH-19233) 2020-03-30 14:28:25 -07:00
Alexander Riccio 51e3e450fb
bpo-40020: Fix realloc leak on failure in growable_comment_array_add (GH-19083)
Fix a leak and subsequent crash in parsetok.c caused by realloc misuse on a rare codepath. 

Realloc returns a null pointer on failure, and then growable_comment_array_deallocate crashes later when it dereferences it.
2020-03-30 23:15:59 +02:00
Andy Lester fc2d8d62af
bpo-39943: Remove unnecessary casts in import.c that remove constness (GH-19209) 2020-03-30 13:19:14 -07:00
Curtis Bucher 0c5ad54997
Fix bug in test_collections.py (#19221)
Test in TestChainMap() line 257 did not properly check union behavior.
2020-03-30 09:50:57 -07:00
Zackery Spytz 676b105111
bpo-8901: Windows registry path is now ignored with the -E option (GH-18169) 2020-03-30 17:04:45 +01:00
Dong-hee Na 53e4c91725
bpo-40077: Convert _abc module to use PyType_FromSpec() (GH-19202)
Replace statically allocated types with heap allocated types:
use PyType_FromSpec().

Add a module state to store the _abc_data_type.
Add traverse, clear and free functions to the module.
2020-03-30 16:35:38 +02:00
Petr Viktorin ce105541f8
bpo-37207: Use vectorcall for list() (GH-18928)
Speed up calls to list() by using the PEP 590 vectorcall
calling convention. Patch by Mark Shannon.

Co-authored-by: Mark Shannon <mark@hotpy.org>
Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-03-30 14:16:16 +02:00
Ashwin Ramaswami 614f17211c
bpo-39073: validate Address parts to disallow CRLF (#19007)
Disallow CR or LF in email.headerregistry.Address arguments to guard against header injection attacks.
2020-03-29 20:38:41 -04:00
Batuhan Taşkaya 0003c2dc1d
bpo-40096: Support __attribute__((__noreturn__)) on xlc (GH-19204) 2020-03-29 16:52:32 +01:00
Dong-hee Na 016bdd519d
bpo-40024: Update _elementtree to use PyModule_AddType() (GH-19205) 2020-03-29 16:12:11 +02:00
Terry Jan Reedy 34a49aa3e4
bpo-38002: Use False/True for IDLE pyshell bools (GH-19203)
Change 0/1 assignments to 'executing', 'canceled', 'reading', 'endoffile'.
These are not used outside of pyshell. Other bools already use False/True.
Add comment about int needed for Windows call.
Remove self.more, unused in idlelib and code.InteractiveInterpreter.
The latter uses 'more' as a local.
2020-03-28 12:51:21 -04:00
Furkan Önder 34b0598295
bpo-40086: Update/fix test_etree test case in test_typing (GH-19189) 2020-03-28 12:32:36 +00:00
Miro Hrončok 6467134307
bpo-36543: What's new: Document how to replace xml.etree.cElementTree (GH-19188) 2020-03-27 21:59:02 +02:00
Kyle Stanley b61b818d91
bpo-39812: Remove daemon threads in concurrent.futures (GH-19149)
Remove daemon threads from :mod:`concurrent.futures` by adding
an internal `threading._register_atexit()`, which calls registered functions
prior to joining all non-daemon threads. This allows for compatibility
with subinterpreters, which don't support daemon threads.
2020-03-27 20:31:22 +01:00
Javad Mokhtari 5f9c131c09
bpo-40045: Make "dunder" method documentation easier to locate (#19153)
* issue 40045

* Update lexical_analysis.rst

Make "dunder" method documentation easier(GH-19153)

Co-authored-by: Joannah Nanjekye <33177550+nanjekyejoannah@users.noreply.github.com>
2020-03-27 16:02:51 -03:00
Victor Stinner d8ff44ce4c
bpo-40089: Fix threading._after_fork() (GH-19191)
If fork was not called by a thread spawned by threading.Thread,
threading._after_fork() now creates a _MainThread instance for
_main_thread, instead of a _DummyThread instance.
2020-03-27 17:50:42 +01:00
Ammar Askar 5a58c5280b
bpo-38237: Use divmod for positional arguments whatsnew example (GH-19171) 2020-03-27 16:37:43 +00:00