Commit Graph

43929 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) 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
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
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
Miss Islington (bot) 1f4f28cbf3
bpo-38815: Accept TLSv3 default in min max test (GH-NNNN) (GH-17437)
Make ssl tests less strict and also accept TLSv3 as the default maximum
version. This change unbreaks test_min_max_version on Fedora 32.

https://bugs.python.org/issue38815
(cherry picked from commit 34864d1cff)

Co-authored-by: torsava <torsava@redhat.com>
2019-12-02 08:35:50 -08:00
Miss Islington (bot) 926eabb6b4
bpo-38449: Add URL delimiters test cases (GH-16729)
* bpo-38449: Add tricky test cases

* bpo-38449: Reflect codereview
(cherry picked from commit 2fe4c48917)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-12-01 15:23:32 -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) d4d79209e6 bpo-22367: Update test_fcntl.py for spawn process mode (GH-17154) (GH-17253)
(cherry picked from commit 9960230f76)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-11-22 15:15:42 +01:00
Miss Islington (bot) 91c15a542c [3.7] bpo-16576: Add checks for bitfields passed by value to functions. (GH-17097) (GH-17224)
(cherry picked from commit 106271568c)
2019-11-21 21:47:22 +00: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) 5469bc0ea7
Fix typo in Lib/socketserver.py (GH-17024)
changed 'This is bad class design, but save some typing'
into 'This is bad class design, but saves some typing'.
(cherry picked from commit d0acdfcf34)

Co-authored-by: Jason (Perry) Taylor <jtaylor@seek.com.au>
2019-11-16 10:32:37 -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
Serhiy Storchaka 42b619ac9a
[3.7] bpo-38738: Fix formatting of True and False. (GH-17083) (GH-17128)
* "Return true/false" is replaced with "Return ``True``/``False``"
  if the function actually returns a bool.
* Fixed formatting of some True and False literals (now in monospace).
* Replaced "True/False" with "true/false" if it can be not only bool.
* Replaced some 1/0 with True/False if it corresponds the code.
* "Returns <bool>" is replaced with "Return <bool>".
(cherry picked from commit 138ccbb022)
2019-11-12 20:07:20 +02: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 Islington (bot) 832341a071
[3.8] bpo-37309: idlelib/NEWS.txt - add missing period. (GH-17115)
(cherry picked from commit 8341a4d918)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-11-12 02:21:06 -08:00
Miss Islington (bot) 917dbe350a
bpo-22367: Add tests for fcntl.lockf(). (GH-17010)
(cherry picked from commit befa032d88)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-11-09 03:12:35 -08:00
Miss Islington (bot) 1f9148bdb4
Fix a typo in wave module docstring (GH-17009)
s/pathing/patching/
(cherry picked from commit 25fa3ecb98)

Co-authored-by: Michael Haas <micha2718l@gmail.com>
2019-11-04 20:50:01 -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
Vinay Sajip 0118d109d5
[3.7] bpo-16575: Add checks for unions passed by value to functions. (GH-16799) (GH-17017)
(cherry picked from commit 79d4ed102a)
2019-10-31 14:15:04 +00:00
Miss Skeleton (bot) a28cf14dea Add docstring for shlex.split (GH-16740) (GH-17012)
(cherry picked from commit 65c7382c47)

Co-authored-by: MaT1g3R <peijun.ma@protonmail.com>
2019-10-31 12:50:32 +00: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) 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
Terry Jan Reedy baf2657eff
[3.7] bpo-37309: First idlelib/NEWS.txt for 3.7.6 (GH-) (#16949) 2019-10-27 02:38:20 -04:00
Miss Skeleton (bot) bc30db1ee7
bpo-34162: Last idlelib/NEWS.txt items for 3.8.0. (GH-16943)
(cherry picked from commit e31a79a5b4)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-10-26 19:38:26 -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) 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 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 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
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
Vinay Sajip 1c61f2cc7a bpo-38368: Added fix for ctypes crash when handling arrays in structs/unions. (GH-16589) (GH-16672)
(cherry picked from commit e8bedbddad)
2019-10-14 17:03:10 -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