Commit Graph

21866 Commits

Author SHA1 Message Date
Miss Islington (bot) 66d7a5d58a bpo-34776: Fix dataclasses to support __future__ "annotations" mode (GH-9518) (#17532)
(cherry picked from commit d219cc4180)

Co-authored-by: Yury Selivanov <yury@magic.io>
2019-12-09 17:07:54 +01:00
Miss Islington (bot) a0078d9a33
bpo-39006: Fix asyncio when the ssl module is missing (GH-17524)
Fix asyncio when the ssl module is missing: only check for
ssl.SSLSocket instance if the ssl module is available.
(cherry picked from commit 82b4950b5e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-12-09 06:20:27 -08:00
Miss Islington (bot) 188d5ae6f0 bpo-38673: dont switch to ps2 if the line starts with comment or whitespace (GH-17421) (GH-17522)
https://bugs.python.org/issue38673
(cherry picked from commit 109fc2792a)

Co-authored-by: Batuhan Taşkaya <47358913+isidentical@users.noreply.github.com>
2019-12-09 06:38:36 -05:00
Miss Islington (bot) b9f4b49c6e
bpo-38547: Fix test_pty if the process is the session leader (GH-17519)
Fix test_pty: if the process is the session leader, closing the
master file descriptor raises a SIGHUP signal: simply ignore SIGHUP
when running the tests.
(cherry picked from commit a1838ec259)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-12-09 03:15:07 -08:00
Miss Islington (bot) 41973c99fd bpo-38669: patch.object now raises a helpful error (GH17511)
This means a clearer message is now shown when patch.object is called with two string arguments, rather than a class and a string argument.
(cherry picked from commit cd90a52983)

Co-authored-by: Elena Oat <oat.elena@gmail.com>
2019-12-09 06:59:23 +00:00
Miss Islington (bot) 9baa870c27
bpo-38979: fix ContextVar "__class_getitem__" method (GH-17497)
now contextvars.ContextVar "__class_getitem__" method returns ContextVar class, not None.

https://bugs.python.org/issue38979

Automerge-Triggered-By: @asvetlov
(cherry picked from commit 28c91631c2)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
2019-12-08 03:53:07 -08:00
Miss Islington (bot) a197f8aa74
[3.7] bpo-38820: OpenSSL 3.0.0 compatibility. (GH-17190) (GH-17500)
test_openssl_version now accepts version 3.0.0.

getpeercert() no longer returns IPv6 addresses with a trailing new line.

Signed-off-by: Christian Heimes <christian@python.org>


https://bugs.python.org/issue38820
(cherry picked from commit 2b7de6696b)


Co-authored-by: Christian Heimes <christian@python.org>


https://bugs.python.org/issue38820



Automerge-Triggered-By: @tiran
2019-12-07 09:20:43 -08:00
Miss Islington (bot) a85066df94
bpo-37404: Raising value error if an SSLSocket is passed to asyncio functions (GH-16457)
https://bugs.python.org/issue37404
(cherry picked from commit 892f9e0777)

Co-authored-by: idomic <michael.ido@gmail.com>
2019-12-07 04:45:07 -08:00
Andrew Svetlov 8ce85a31e6
[3.7] Make repr of C accelerated TaskWakeupMethWrapper the same as of pure Python version (GH-17484) (GH-17494)
(cherry picked from commit 969ae7aca8)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-12-07 13:46:18 +02:00
Miss Islington (bot) 5ba591fa2c
bpo-36820: Break unnecessary cycle in socket.py, codeop.py and dyld.py (GH-13135)
Break cycle generated when saving an exception in socket.py, codeop.py and dyld.py as they keep alive not only the exception but user objects through the ``__traceback__`` attribute.

https://bugs.python.org/issue36820

Automerge-Triggered-By: @pablogsal
(cherry picked from commit b64334cb93)

Co-authored-by: Mario Corchero <mcorcherojim@bloomberg.net>
2019-12-06 07:01:31 -08:00
Miss Islington (bot) 5044c889df
bpo-38965: Fix faulthandler._stack_overflow() on GCC 10 (GH-17467)
Use the "volatile" keyword to prevent tail call optimization
on any compiler, rather than relying on compiler specific pragma.
(cherry picked from commit 8b787964e0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-12-04 12:29:22 -08:00
Inada Naoki e0f148e663
bpo-33684: json.tool: Use utf-8 for infile and outfile. (GH-17460)
(cherry picked from commit 808769f3a4)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-12-04 19:26:22 +09:00
Miss Islington (bot) 87f2d261ee
bpo-38945: UU Encoding: Don't let newline in filename corrupt the output format (GH-17418)
(cherry picked from commit a62ad4730c)

Co-authored-by: Matthew Rollings <1211162+stealthcopter@users.noreply.github.com>
2019-12-02 14:43:15 -08:00
Inada Naoki e65b3fa9f1
bpo-26730: Fix SpooledTemporaryFile data corruption (GH-17400)
SpooledTemporaryFile.rollback() might cause data corruption
when it is in text mode.

Co-Authored-By: Serhiy Storchaka <storchaka@gmail.com>.
(cherry picked from commit ea9835c5d1)
2019-11-28 14:23:58 +09:00
Terry Jan Reedy 2fb971940b
[3.7] bpo-38862: IDLE Strip Trailing Whitespace fixes end newlines (GH-17366) (#17379)
Extra newlines are removed at the end of non-shell files. If the file only has newlines after stripping other trailing whitespace, all are removed, as is done by patchcheck.py.
(cherry picked from commit 6bf644ec82)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-11-26 20:12:56 -05:00
Miss Islington (bot) 07432c33a0
bpo-38686: fix HTTP Digest handling in request.py (GH-17045)
* fix HTTP Digest handling in request.py

There is a bug triggered when server replies to a request with `WWW-Authenticate: Digest` where `qop="auth,auth-int"` rather than mere `qop="auth"`. Having both `auth` and `auth-int` is legitimate according to the `qop-options` rule in §3.2.1 of [[https://www.ietf.org/rfc/rfc2617.txt|RFC 2617]]:
>      qop-options       = "qop" "=" <"> 1GH-qop-value <">
>      qop-value         = "auth" | "auth-int" | token
> **qop-options**: [...] If present, it is a quoted string **of one or more** tokens indicating the "quality of protection" values supported by the server.  The value `"auth"` indicates authentication; the value `"auth-int"` indicates authentication with integrity protection

This is description confirmed by the definition of the [//n//]`GH-`[//m//]//rule// extended-BNF pattern defined in §2.1 of [[https://www.ietf.org/rfc/rfc2616.txt|RFC 2616]] as 'a comma-separated list of //rule// with at least //n// and at most //m// items'.

When this reply is parsed by `get_authorization`, request.py only tests for identity with `'auth'`, failing to recognize it as one of the supported modes the server announced, and claims that `"qop 'auth,auth-int' is not supported"`.

* 📜🤖 Added by blurb_it.

* bpo-38686 review fix: remember why.

* fix trailing space in Lib/urllib/request.py

Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
(cherry picked from commit 14a89c4798)

Co-authored-by: PypeBros <PypeBros@users.noreply.github.com>
2019-11-22 15:38:37 -08:00
Miss Islington (bot) cb6085138a
bpo-38804: Fix REDoS in http.cookiejar (GH-17157)
The regex http.cookiejar.LOOSE_HTTP_DATE_RE was vulnerable to regular
expression denial of service (REDoS).

LOOSE_HTTP_DATE_RE.match is called when using http.cookiejar.CookieJar
to parse Set-Cookie headers returned by a server.
Processing a response from a malicious HTTP server can lead to extreme
CPU usage and execution will be blocked for a long time.

The regex contained multiple overlapping \s* capture groups.
Ignoring the ?-optional capture groups the regex could be simplified to

    \d+-\w+-\d+(\s*\s*\s*)$

Therefore, a long sequence of spaces can trigger bad performance.

Matching a malicious string such as

    LOOSE_HTTP_DATE_RE.match("1-c-1" + (" " * 2000) + "!")

caused catastrophic backtracking.

The fix removes ambiguity about which \s* should match a particular
space.

You can create a malicious server which responds with Set-Cookie headers
to attack all python programs which access it e.g.

    from http.server import BaseHTTPRequestHandler, HTTPServer

    def make_set_cookie_value(n_spaces):
        spaces = " " * n_spaces
        expiry = f"1-c-1{spaces}!"
        return f"b;Expires={expiry}"

    class Handler(BaseHTTPRequestHandler):
        def do_GET(self):
            self.log_request(204)
            self.send_response_only(204)  GH- Don't bother sending Server and Date
            n_spaces = (
                int(self.path[1:])  GH- Can GET e.g. /100 to test shorter sequences
                if len(self.path) > 1 else
                65506  GH- Max header line length 65536
            )
            value = make_set_cookie_value(n_spaces)
            for i in range(99):  GH- Not necessary, but we can have up to 100 header lines
                self.send_header("Set-Cookie", value)
            self.end_headers()

    if __name__ == "__main__":
        HTTPServer(("", 44020), Handler).serve_forever()

This server returns 99 Set-Cookie headers. Each has 65506 spaces.
Extracting the cookies will pretty much never complete.

Vulnerable client using the example at the bottom of
https://docs.python.org/3/library/http.cookiejar.html :

    import http.cookiejar, urllib.request
    cj = http.cookiejar.CookieJar()
    opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))
    r = opener.open("http://localhost:44020/")

The popular requests library was also vulnerable without any additional
options (as it uses http.cookiejar by default):

    import requests
    requests.get("http://localhost:44020/")

* Regression test for http.cookiejar REDoS

If we regress, this test will take a very long time.

* Improve performance of http.cookiejar.ISO_DATE_RE

A string like

"444444" + (" " * 2000) + "A"

could cause poor performance due to the 2 overlapping \s* groups,
although this is not as serious as the REDoS in LOOSE_HTTP_DATE_RE was.
(cherry picked from commit 1b779bfb85)

Co-authored-by: bcaller <bcaller@users.noreply.github.com>
2019-11-22 06:42:13 -08:00
Miss Islington (bot) 30e5bd8471
bpo-37838: get_type_hints for wrapped functions with forward reference (GH-17126)
https://bugs.python.org/issue37838
(cherry picked from commit 0aca3a3a1e)

Co-authored-by: benedwards14 <53377856+benedwards14@users.noreply.github.com>
2019-11-21 09:43:13 -08:00
Miss Islington (bot) ecb2afc1bc
bpo-38821: Fix crash in argparse when using gettext (GH-17192)
(cherry picked from commit be5c79e033)

Co-authored-by: Federico Bond <federicobond@gmail.com>
2019-11-20 05:48:20 -08:00
Miss Islington (bot) 755caaa753
bpo-38636: Fix IDLE tab toggle and file indent width (GH-17008)
These Format menu functions (default shortcuts Alt-T and Alt-U)
were mistakenly disabled in 3.7.5 and 3.8.0.
(cherry picked from commit b8462477bf)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-11-19 22:37:09 -08:00
Miss Islington (bot) 4ffc569b47
bpo-35409: Ignore GeneratorExit in async_gen_athrow_throw (GH-14755)
Ignore `GeneratorExit` exceptions when throwing an exception into the `aclose` coroutine of an asynchronous generator.

https://bugs.python.org/issue35409
(cherry picked from commit 8e0de2a480)

Co-authored-by: Vincent Michel <vxgmichel@gmail.com>
2019-11-19 06:12:12 -08:00
Miss Islington (bot) 2b928d9bf7
bpo-38809: Windows build scripts use python.exe from virtual envs (GH-17164)
https://bugs.python.org/issue38809
(cherry picked from commit ee703cbb41)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-11-18 09:53:14 -08:00
Miss Islington (bot) fe67a53540
bpo-38351: Modernize email examples from %-formatting to f-strings (GH-17162)
(cherry picked from commit e8acc865a3)

Co-authored-by: Andrey Doroschenko <dorosch.github.io@yandex.ru>
2019-11-15 01:14:44 -08:00
Miss Islington (bot) 87b4d3994e
bpo-38785: Prevent asyncio from crashing (GH-17144)
if parent `__init__` is not called from a constructor of object derived from `asyncio.Future`

https://bugs.python.org/issue38785
(cherry picked from commit dad6be5ffe)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-11-13 13:54:50 -08:00
Miss Islington (bot) 753d0c05b3
bpo-4630: Add cursor no-blink option for IDLE (GH-16960)
This immediately toggles shell, editor, and output windows, but does not affect other input widgets.
(cherry picked from commit 9c2844927d)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-11-12 23:37:07 -08:00
Benjamin Peterson b8b3e4377e
[3.7] closes bpo-27805: Ignore ESPIPE in initializing seek of append-mode files. (GH-17137)
This change, which follows the behavior of C stdio's fdopen and Python 2's file object, allows pipes to be opened in append mode..
(cherry picked from commit 74fa9f723f)
2019-11-12 15:34:43 -08:00
Miss Islington (bot) 177b12682c
bpo-26353: IDLE adds an unneeded newline when saving a shell window (GH-17103)
(cherry picked from commit c8b53dc3d8)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-11-12 03:13:32 -08:00
Miss Skeleton (bot) 72b874a2ac
bpo-38422: Clarify docstrings of pathlib suffix(es) (GH-16679)
Whenever I use `path.suffix` I have to check again whether it includes the dot or not. I decided to add it to the docstring so I won't have to keep checking.

https://bugs.python.org/issue38422

Automerge-Triggered-By: @pitrou
(cherry picked from commit 8d4fef4ee2)

Co-authored-by: Ram Rachum <ram@rachum.com>
2019-11-02 10:04:18 -07:00
Miss Skeleton (bot) f7d50f8f99
bpo-36993: Improve error reporting for zipfiles with bad zip64 extra data. (GH-14656)
(cherry picked from commit da6ce58dd5)

Co-authored-by: Daniel Hillier <daniel.hillier@gmail.com>
2019-10-29 00:43:37 -07:00
Miss Skeleton (bot) 379b55b526
bpo-38589: Fixes HTML Help shortcut when Windows is not installed to C drive (GH-16968)
(cherry picked from commit 0ac6137dd3)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-10-28 14:52:00 -07:00
Miss Skeleton (bot) 155a9dc129 bpo-38592 Add pt-br switcher to Python Docs website (GH-16924) (GH-16954)
(cherry picked from commit 85c6f8c65c)

Co-authored-by: Marco Rougeth <marco@rougeth.com>
2019-10-27 11:13:10 +01:00
Miss Skeleton (bot) ed2db3113d
bpo-38334: Fix seeking backward on an encrypted zipfile.ZipExtFile. (GH-16937)
Test by Daniel Hillier.
(cherry picked from commit 5c32af7522)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-27 01:41:27 -07:00
Miss Skeleton (bot) 849b1b9f6c
bpo-38598: Do not try to compile IDLE shell or output windows (GH-16939)
(cherry picked from commit e3f90b217a)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-10-26 18:32:11 -07:00
Serhiy Storchaka 91fc9cf43c
[3.7] bpo-38535: Fix positions for AST nodes for calls without arguments in decorators. (GH-16861). (GH-16930)
(cherry picked from commit 26ae9f6d3d)
2019-10-26 17:30:14 +03:00
Miss Skeleton (bot) 0160a70acb
bpo-33348: parse expressions after * and ** in lib2to3 (GH-6586)
These are valid even in python 2.7

https://bugs.python.org/issue33348

Automerge-Triggered-By: @gpshead
(cherry picked from commit 96b06aefe2)

Co-authored-by: Zsolt Dollenstein <zsol.zsol@gmail.com>
2019-10-23 23:36:26 -07:00
Miss Skeleton (bot) b102e4f052
bpo-37415: Fix stdatomic.h header check for ICC compiler (GH-16717)
Fix stdatomic.h header check for ICC compiler: the ICC implementation
lacks atomic_uintptr_t type which is needed by Python.

Test:

* atomic_int and atomic_uintptr_t types
* atomic_load_explicit() and atomic_store_explicit()
* memory_order_relaxed and memory_order_seq_cst constants

But don't test ATOMIC_VAR_INIT(): it's not used in Python.
(cherry picked from commit 028f7349a0)

Co-authored-by: Victor Stinner <vstinner@python.org>
2019-10-22 13:17:21 -07:00
Miss Skeleton (bot) 175abccbbf
bpo-31202: Preserve case of literal parts in Path.glob() on Windows. (GH-16860)
(cherry picked from commit 10ecbadb79)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-21 11:12:17 -07:00
Miss Skeleton (bot) 3dec84f40e
bpo-38540: Fix possible leak in PyArg_Parse for "esGH-" and "etGH-". (GH-16869)
(cherry picked from commit 5bc6a7c06e)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-10-21 01:56:50 -07:00
Miss Islington (bot) 82b5f6b16e
bpo-27657: Fix urlparse() with numeric paths (GH-661)
* bpo-27657: Fix urlparse() with numeric paths

Revert parsing decision from bpo-754016 in favor of the documented
consensus in bpo-16932 of how to treat strings without a // to
designate the netloc.

* bpo-22891: Remove urlsplit() optimization for 'http' prefixed inputs.
(cherry picked from commit 5a88d50ff0)

Co-authored-by: Tim Graham <timograham@gmail.com>
2019-10-18 06:24:28 -07:00
Victor Stinner 1bceb0e589
bpo-35998: Fix test_asyncio.test_start_tls_server_1() (GH-16815) (GH-16818)
main() is now responsible to send the ANSWER, rather than
ServerProto. main() now waits until it got the HELLO before sending
the ANSWER over the new transport.

Previously, there was a race condition between main() replacing the
protocol and the protocol sending the ANSWER once it gets the HELLO.

TLSv1.3 was disabled for the test: reenable it.

(cherry picked from commit fab4ef2df0)
2019-10-16 11:44:30 +02:00
Ned Deily e48589d265 Post release updates 2019-10-15 03:28:42 -04:00
Ned Deily 1f187714be Python 3.7.5
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEDZbfTUEQ5cQ/v7F/LTR+pqplQh0FAl2k+McACgkQLTR+pqpl
 Qh3v2xAAgF1LyLY/T9nqtWGsbnTLsFSINUpeLS9g2ccrxA2iBq8rs6BcQ6FhZpRS
 y1PHRnnEwqNYDvRyo9HmfAjUb2uqXDSEO6SbEkp38GkU1kh2Vubyp8DENF0M6UH3
 hOTWBEpXof9PTqXXM9nNf/D556HoBt31FJcyHV6SCteF8pbkmMdNM+kfuP1BP1RI
 LLYg/EvH21C/Y0Dutmgo62yt+2mOsJH8gqL14WP93fFRrnoW4TsgYqbQXUC3IaVV
 G6pp5EMWZ6s3M7rWSyNMSs00fV0Rh/CUJimUwk0JmmJdYdrmC0aUkXbMFOcmGS/C
 fK8YlwagB4R6RnHjEScoZlVoQSqQOMOJpEyIZYZ4rb4FqgTGS1R7weFbya7kAmma
 1x4WhN/U0OOi7G1btLyNis9yz4I1ho2PNIWnuozOqSJ04NMm6bGYsdHvWpawmQTg
 01Ndh5EhXYlIneFKkW2fewGqY/HrACNEXMS8VqC6Bgm8h+quUXyzOxsUB3ErP50+
 gGIDzBEajZg22Z+Ei3+bD0z2t6v7wfa3JiS52oQBfPTCDHXyHBDl6YQqcR3A5emR
 rPJp4ix0jo74KPq7+WOoBvriEaUsUzj/G6j8MvaTLIpr07Vn83dVyXPEFgkozFl5
 L/cSxDzoFTkuScsdLlb6bbpEBO9wo+7fnZApBt3WjdhsrtxDzMg=
 =Ro62
 -----END PGP SIGNATURE-----

Merge tag 'v3.7.5' into 3.7
2019-10-15 03:15:46 -04:00
Ned Deily 5c02a39a0b 3.7.5 2019-10-14 18:32:36 -04:00
Ned Deily 0365d51156 Fix some news entries for 3.7.5 final. 2019-10-14 18:00:26 -04:00
Abhilash Raj 2a405598bb [3.7] bpo-38449: Revert "bpo-22347: Update mimetypes.guess_type to allow oper parsing of URLs (GH-15685)" (GH-16724) (GH-16727)
Reverts GH-15687 which caused the issue.


https://bugs.python.org/issue22347

https://bugs.python.org/issue38449
2019-10-14 17:27:49 -04:00
Miss Islington (bot) 42b16b2a86 bpo-36953: Delay removal of ABCs from collections. (GH-13409)
Bump the removal to 3.9, indicate collections.abc available since 3.3,
replace version-changed directive to deprecated-removed.

https://bugs.python.org/issue36953
(cherry picked from commit eea47e0939)

Co-authored-by: Matthias Bussonnier <mbussonnier@ucmerced.edu>
2019-10-14 17:04:26 -04:00
Ricardo Bánffy ae41f629e1 [3.7] bpo-38294: Add list of no-longer-escaped chars to re.escape documentation. (GH-16442) (GH-16647)
Prior to 3.7, re.escape escaped many characters that don't have
special meaning in Python, but that use to require escaping in other
tools and languages. This commit aims to make it clear which characters
were, but are no longer escaped.
(cherry picked from commit 15ae75d660)
2019-10-14 17:00:49 -04:00
Miss Islington (bot) ab22c8bc48 bpo-38344: Fix syntax in activate.bat (GH-16533)
(cherry picked from commit e310af9e29)

Co-authored-by: James Abel <j@abel.co>
2019-10-14 16:56:12 -04:00
Abhilash Raj 164bee296a [3.7] bpo-38449: Revert "bpo-22347: Update mimetypes.guess_type to allow oper parsing of URLs (GH-15685)" (GH-16724) (GH-16727)
Reverts GH-15687 which caused the issue.


https://bugs.python.org/issue22347

https://bugs.python.org/issue38449
2019-10-12 11:50:03 -07:00
Miss Islington (bot) febe359559
bpo-38332: Catch KeyError from unknown cte in encoded-word. (GH-16503)
KeyError should cause a failure in parsing the encoded word and should be caught and raised as a _InvalidEWError instead.
(cherry picked from commit 65dcc8a8dc)

Co-authored-by: Andrei Troie <andreitroie90@gmail.com>
2019-10-12 10:02:23 -07:00