Commit Graph

46188 Commits

Author SHA1 Message Date
Steve Dower 70e9243a55
bpo-41490: Update ensurepip to install pip 20.2.1 and setuptools 49.2.1 (GH-21774) 2020-08-08 00:47:40 +01:00
Miss Islington (bot) 5e12a5b822
bpo-41473: Skip test_gdb with gdb 9.2 to work around gdb bug (GH-21768)
gdb 9.2 on Fedora Rawhide is not reliable, see:

* https://bugs.python.org/issue41473
* https://bugzilla.redhat.com/show_bug.cgi?id=1866884
(cherry picked from commit e27a51c11e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-08-07 09:18:29 -07:00
Miss Islington (bot) b49b88a93a
bpo-41482: Fix error in ipaddress.IPv4Network docstring (GH-21736)
(cherry picked from commit 52f98424a5)

Co-authored-by: Eric L. Frederich <eric.frederich@gmail.com>
2020-08-05 14:52:59 -07:00
Miss Islington (bot) a1320989f5
bpo-40726: handle uninitalized end_lineno on ast.increment_lineno (GH-20312)
(cherry picked from commit 8f4380d2f5)

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-08-05 06:52:29 -07:00
Miss Islington (bot) 1d16229f3f
bpo-41467: Fix asyncio recv_into() on Windows (GH-21720)
On Windows, fix asyncio recv_into() return value when the socket/pipe
is closed (BrokenPipeError): return 0 rather than an empty byte
string (b'').
(cherry picked from commit 602a971a2a)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-08-03 18:00:29 -07:00
Karthikeyan Singaravelan fe928b32da
[3.9] bpo-40360: Handle PendingDeprecationWarning in test_lib2to3. (GH-21694) (GH-21697)
(cherry picked from commit cadda52d97)

Co-authored-by: Karthikeyan Singaravelan <tir.karthi@gmail.com>
2020-07-31 07:17:18 -07:00
Miss Islington (bot) aa16ac7433
[3.9] Improve blake2 comment for Victor (GH-20981) (GH-20982)
Signed-off-by: Christian Heimes <christian@python.org>


(cherry picked from commit 8a0fe7b454)


Co-authored-by: Christian Heimes <christian@python.org>
2020-07-28 12:29:46 -07:00
Miss Islington (bot) 8b052751d3
bpo-41384: Raise TclError in tkinter.OptionMenu (GH-21601)
... when an unknown option is passed.  TypeError was being raised because a 2to3 fix was missing.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit f1d40f941a)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2020-07-26 22:14:12 -04:00
Miss Islington (bot) 6e4975a1c7
bpo-41182 selector: use DefaultSelector based upon implementation (GH-21257)
On some platform such as VMware ESXi, DefaultSelector fails
to detect selector due to default value.
This fix adds a check and uses the correct selector depending upon
select implementation and actual call.

Fixes: [bpo-41182]()

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit bcd47837a9)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
2020-07-26 08:32:25 -07:00
Miss Islington (bot) 41d1c04f73
bpo-41341: Recursive evaluation of ForwardRef in get_type_hints (GH-21553)
The issue raised by recursive evaluation is infinite recursion with
recursive types. In that case, only the first recursive ForwardRef is
evaluated.
(cherry picked from commit 653f420b53)

Co-authored-by: wyfo <joperez@hotmail.fr>
2020-07-26 08:31:24 -07:00
Miss Islington (bot) 8b7544cd02
bpo-41385: Fix test_executable_without_cwd on Windows (GH-21608)
(cherry picked from commit b1a87300a0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-26 00:38:52 -07:00
Miss Islington (bot) b74e536075
bpo-37309: NEWS for GH-41373 (GH-21612)
(cherry picked from commit af08db7bac)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-25 21:25:17 -07:00
Miss Islington (bot) fdc91c2e60
bpo-41314: fixed annotations __future__ version (GH-21616)
PEP 563 was updated to change the release where `from __future__ import annotations` becomes the default (and only) behavior from 4.0 to 3.10. Update `__future__.py` and its docs to reflect this.
(cherry picked from commit 0028c14073)

Co-authored-by: YoSTEALTH <35307184+YoSTEALTH@users.noreply.github.com>
2020-07-25 15:00:48 -07:00
Berker Peksag 2024d7aca1
bpo-38731: Fix NameError in command-line interface of py_compile (GH-21617) 2020-07-25 23:43:47 +03:00
Miss Islington (bot) 15fdbb7145
bpo-41373: IDLE: Fix saving files loaded with no newlines or mixed newlines (GH-21597)
Fixes regression in 3.8.4 and 3.9.0b4.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 0dd463c8a4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-24 20:39:31 -07:00
Miss Islington (bot) 4ff8e5ba4f
bpo-41317: Remove reader on cancellation in asyncio.loop.sock_accept() (GH-21595)
(cherry picked from commit 0dd98c2d00)

Co-authored-by: Alex Grönholm <alex.gronholm@nextday.fi>
2020-07-23 13:02:47 -07:00
Miss Islington (bot) 4cf7afcefc
bpo-4630: Fix errors in Lib/idlelib/NEWS.txt (GH-21594)
Also one in news log.
(cherry picked from commit 592527f3ee)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-22 23:25:59 -07:00
Miss Islington (bot) 00466db221
bpo-41364: Reduce import overhead of uuid module (GH-21586)
(cherry picked from commit bf2f76ec09)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-21 17:09:32 -07:00
Łukasz Langa 8ad7d506ca
Python 3.9.0b5 2020-07-20 19:47:09 +02:00
Miss Islington (bot) 46634b7aa8
bpo-37703: improve asyncio.gather documentation regarding cancellation (GH-15312)
These changes updates the doc to comprehensively mention the behaviour of gather.cancel()

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

Co-authored-by: Vinay Sharma <vinay04sharma@icloud.com>
2020-07-20 02:01:39 -07:00
Miss Islington (bot) 01ab963460
bpo-41295: Reimplement the Carlo Verre "hackcheck" (GH-21528)
Walk down the MRO backwards to find the type that originally defined the final `tp_setattro`, then make sure we are not jumping over intermediate C-level bases with the Python-level call.

Automerge-Triggered-By: @gvanrossum
(cherry picked from commit c53b310e59)

Co-authored-by: scoder <stefan_ml@behnel.de>
2020-07-18 14:39:02 -07:00
Miss Islington (bot) 27b811057f
bpo-39603: Prevent header injection in http methods (GH-18485)
reject control chars in http method in http.client.putrequest to prevent http header injection
(cherry picked from commit 8ca8a2e8fb)

Co-authored-by: AMIR <31338382+amiremohamadi@users.noreply.github.com>
2020-07-18 13:41:55 -07:00
Miss Islington (bot) 5a7aa28045
bpo-41300: IDLE - save files with non-ascii chars (GH-21512)
Fix regression released in 3.9.0b4 and 3.8.4.
(cherry picked from commit 38d3864efe)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-16 15:42:09 -07:00
Miss Islington (bot) 28e93dd2b2
bpo-41304: Ensure python3x._pth is loaded on Windows (GH-21495)
(cherry picked from commit 936a660945)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-15 15:14:48 -07:00
Miss Islington (bot) f3232294ee
[3.9] bpo-39017: Avoid infinite loop in the tarfile module (GH-21454) (GH-21482)
Avoid infinite loop when reading specially crafted TAR files using the tarfile module
(CVE-2019-20907).
(cherry picked from commit 5a8d121a1f)


Co-authored-by: Rishi <rishi_devan@mail.com>

Automerge-Triggered-By: @encukou
2020-07-15 05:30:33 -07:00
Miss Islington (bot) 57c984fab6
bpo-41288: Fix a crash in unpickling invalid NEWOBJ_EX. (GH-21458)
Automerge-Triggered-By: @tiran
(cherry picked from commit 4f309abf55)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-13 06:09:27 -07:00
Miss Islington (bot) fd27fb7f3d
bpo-37765: Add keywords to IDLE tab completions (GH-15138)
Keywords are present in the main module tab completion lists generated by rlcompleter, which is used by REPLs on *nix. Add all keywords to IDLE's main module name list except those already added from builtins (True, False, and None) . This list may also be used by Show Completions on the Edit menu, and its hot key.

Rewrite Completions doc.

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
(cherry picked from commit bce2eb4646)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-07-09 15:54:14 -07:00
Miss Islington (bot) c65ee55512
bpo-41172: Fix check for compiler in test suite (GH-21400)
(cherry picked from commit af56c4fc76)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-09 11:12:07 -07:00
Miss Islington (bot) e68978978f
bpo-40597: Allow email.contextmanager set_content() to set a null string. (GH-20542)
(cherry picked from commit 4fa61a7732)

Co-authored-by: Mark Sapiro <mark@msapiro.net>
2020-07-08 14:21:00 -07:00
Miss Islington (bot) 2c82628e9a
bpo-41207 In distutils.spawn, rewrite FileNotFound (GH-21359)
Automerge-Triggered-By: @jaraco
(cherry picked from commit 6ae2780be0)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-07-07 04:31:32 -07:00
Pablo Galindo 6488a4a3c9
[3.9] bpo-41218: Only mark async code with CO_COROUTINE. (GH-21357) (GH-21362)
3.8.3 had a regression where compiling with
ast.PyCF_ALLOW_TOP_LEVEL_AWAIT woudl agressively mark things are
coroutine even if there were not.
(cherry picked from commit bd46174)

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>

Co-authored-by: Matthias Bussonnier <bussonniermatthias@gmail.com>
2020-07-06 23:30:20 +01:00
Miss Islington (bot) 4981fe36c7
bpo-29778: Ensure python3.dll is loaded from correct locations when Python is embedded (GH-21297)
Also enables using debug build of `python3_d.dll`
Reference: CVE-2020-15523
(cherry picked from commit dcbaa1b49c)

Co-authored-by: Steve Dower <steve.dower@python.org>
2020-07-06 09:52:13 -07:00
Miss Islington (bot) 5a1384935e
bpo-39168: Remove the __new__ method of typing.Generic (GH-21327)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 7fed75597f)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-07-05 09:02:40 -07:00
Steve Dower e1d4fdc533
bpo-41162: Clear audit hooks later during finalization (GH-21222)
Co-authored-by: Konge <zkonge@outlook.com>
2020-07-03 22:58:29 +01:00
Łukasz Langa b0bb791313 Python 3.9.0b4
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl7+ICsACgkQsmmV4xAl
 BWjNgg//fTnAwme/3pJU6MiYy9K6nes+498B9pjqbmm08Afb7n7Jx/N8hKr7Bx7w
 QL7KzXltmGyKQwU7D9436eXCWkkkYn5wGt/snsgPAxf0wgg2T9vaJMvw48XNZatD
 zRY8Jh9fdKZMA3HNuUkFGpun6sB/IP/JyeCUK66ZKdcW0YLrU6ycWt5E6Vh8BQxQ
 YHyqJXFhsTW1XgkxbMbhSAv60DBBmHX2Wdtnhezpqu92eYlCVNI++adNc4A5v5t7
 fdxAJOsdbqiZMEcV6xwlfdlciBE3Y0Eu0DH6z1gfeKN69+2E+mrOzTOvhNJ+tZAs
 R7KRcVZZMxdiB0QMlEYjZS/zABp8XBQEDByonvEIdCcrGRS/jH7NP04+nUtnjUnB
 BT3dNimwVqJHCJkfgzUrTXjz5tPwzLB4SA/bJDjM1ifDS2Ml+lk/WcemMNe6IKv+
 ukIi8dvRJmx/W7Nrevu7EDsQnOqwkMjR9sUcwysJNA2iDQ3cePQ/GhPQHBWBgSA+
 voiem2SDC7MOBw47yxELk8P96DpoYGZ0IACDMXTrlaqQqXPOpNY27rf1ofpTRBUf
 iukBrZh2DPw4l3EO/CXhVDY8MA3YRWaPyYr44kv/GSFZ+IaLiaeGH+Wc05832C2d
 KN+p/MVUK/gKQWUh/KZ3dYWhKHSs1tFxz8pA1wWdDTnubIKnk1I=
 =9XaI
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl7/YSkQHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaNqAD/98JLK6EnZSOLduPWcXs/hNCnSek8Wf4V5e
 fx7h3Oh58x2lUMGwroLICWWNKEU3KGVXxhC/RZj7EefIwDzZQHFFHNuz/MyF5nqS
 NJ7TbVks4nLPQMkxqXCRSiIB9O8XNAfIBzGqqRMKXoan5Nt30FN30MPKZT9JpD1l
 pcFcZ7jAYmEZekRW5JZB+6R5AfUI1WMoxT4NBKWZ7QCD9lGvR1iorHERnZ1GXGFn
 2c4xk3wc/RgzuoMaEC4LhmObUVLmjuF3PC5WtnV710wARVGQgsOWkp0YsHk+KFHN
 M2XFZdgCSmSXgNzHUYszFN2SYe7oZtI9IZJRjmHKjMPN1PwOjUmENn8WBwD5bjHO
 PWA2dSazN1ZzaLmngNOx1NBwLu7p85dMpnYSiG1qKRpsD5DtCbKS0tSHdExSmhHT
 3Ju2oInJcswWqk2SVHDauq3ocLxaYlf0lRl71G6p56eN9DrTSj0wDrhjoseRpNkm
 s0ZrpCUYZWR3T9kTTxJjYTnoA1x7TybOSJFHe+dKVfggO0n2/Ytuy+HOTRY+BPrc
 0x2TNbfkAL2Vla5e5wxv+zQkZhBoRZRpf1k3A5mJg8ZMC9c69HEpMDEJI8wzQd0a
 kf+T+XzuUIdS/lzFTWu/KWRXpNj9PXsjjN6vbmDC3U0qcU2y27bQKfFWwX/nyROe
 onLsxvD8EQ==
 =Y3oI
 -----END PGP SIGNATURE-----

Merge tag 'v3.9.0b4' into 3.9

Python 3.9.0b4
2020-07-03 18:47:34 +02:00
Miss Islington (bot) 486c256bdf
Improve code organization for the random module (GH-21161) (GH-21163) 2020-07-02 18:12:50 -07:00
Miss Islington (bot) bfec674254
bpo-39960: Allow heap types in the "Carlo Verre" hack check that override "tp_setattro()" (GH-21092)
Automerge-Triggered-By: @gvanrossum
(cherry picked from commit 148f329135)

Co-authored-by: scoder <stefan_ml@behnel.de>
2020-07-02 17:28:41 -07:00
Łukasz Langa 69dec9c8d2
Python 3.9.0b4 2020-07-02 19:57:45 +02:00
Miss Islington (bot) 0b4c87ef8f
bpo-41193: Ignore OSError in readline write_history() (GH-21279)
The write_history() atexit function of the readline completer now
ignores any OSError to ignore error if the filesystem is read-only,
instead of only ignoring FileNotFoundError and PermissionError.
(cherry picked from commit 0ab917e07e)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-07-02 04:02:16 -07:00
Serhiy Storchaka ecfecc2d6c
[3.9] bpo-41043: Escape literal part of the path for glob(). (GH-20994). (GH-21275)
(cherry picked from commit 9355868458)
2020-07-02 10:05:16 +03:00
Miss Islington (bot) df59293bf0
bpo-40967: Remove deprecated asyncio.Task.current_task() and asyncio.Task.all_tasks() (GH-20874)
(cherry picked from commit 004e64e805)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-07-01 21:06:51 -07:00
Miss Islington (bot) fe0175f5b5
bpo-41158: IDLE: rewrite the code for handling file encoding (GH-21215)
(cherry picked from commit 694d31e714)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-07-01 08:29:30 -07:00
Miss Islington (bot) 01638ce51a
bpo-41152: IDLE: always use UTF-8 for standard IO streams (GH-21214)
(cherry picked from commit 2515a28230)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-29 17:36:46 -07:00
Miss Islington (bot) 9a646aa82d
bpo-41004: Resolve hash collisions for IPv4Interface and IPv6Interface (GH-21033)
The __hash__() methods of classes IPv4Interface and IPv6Interface had issue
of generating constant hash values of 32 and 128 respectively causing hash collisions.
The fix uses the hash() function to generate hash values for the objects
instead of XOR operation
(cherry picked from commit b30ee26e36)

Co-authored-by: Ravi Teja P <rvteja92@gmail.com>
2020-06-29 11:15:32 -07:00
Lysandros Nikolaou 990efe0fff
[3.9] bpo-41084: Fix test_fstring failure when using the old parser (GH-21212) 2020-06-29 13:55:57 +01:00
Miss Islington (bot) 9e36b6e6c8
bpo-41048: mimetypes should read the rule file using UTF-8, not the locale encoding (GH-20998)
(cherry picked from commit 7f569c9bc0)

Co-authored-by: Srinivas Reddy Thatiparthy (శ్రీనివాస్  రెడ్డి తాటిపర్తి) <thatiparthysreenivas@gmail.com>
2020-06-29 05:07:31 -07:00
Miss Islington (bot) d1e05e78a3
bpo-41138: Fix trace CLI for non-UTF-8 files. (GH-21177)
Fix also a resource warning when store counts and module info.
(cherry picked from commit 04cdeb7a56)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-28 03:52:26 -07:00
Miss Islington (bot) 1497bf66f9
bpo-41144: Fix IDLE open module error (GH-21182)
Could not open os.path.

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 8ab77c6f9f)

Co-authored-by: E-Paine <63801254+E-Paine@users.noreply.github.com>
2020-06-27 23:22:05 -07:00
Guido van Rossum 2a1ee1d970
[3.9] bpo-35975: Only use cf_feature_version if PyCF_ONLY_AST in cf_flags (#21022) 2020-06-27 17:34:30 -07:00
Pablo Galindo 102ca529ef
[3.9] bpo-40769: Allow extra surrounding parentheses for invalid annotated assignment rule (GH-20387) (GH-21186)
(cherry picked from commit c8f29ad986)
2020-06-28 00:40:41 +01:00
Miss Islington (bot) cb0dc52d37
bpo-41084: Adjust message when an f-string expression causes a SyntaxError (GH-21084)
Prefix the error message with `fstring: `, when parsing an f-string expression throws a `SyntaxError`.
(cherry picked from commit 2e0a920e9e)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-06-27 12:43:49 -07:00
Serhiy Storchaka f925407a19
[3.9] bpo-41069: Make TESTFN and the CWD for tests containing non-ascii characters. (GH-21035). (GH-21156)
(cherry picked from commit 700cfa8c90)
2020-06-25 20:39:12 +03:00
Miss Islington (bot) c4dfcb28f7
bpo-41112: Fix test_peg_generator on non-UTF-8 locales. (GH-21138)
(cherry picked from commit aad8f0eeca)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-25 05:24:15 -07:00
Miss Islington (bot) 086b453980
bpo-41113: Fix test_warnings on non-Western locales. (GH-21143)
(cherry picked from commit 0f8ec1fff0)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-25 05:21:58 -07:00
Christian Heimes cd6f911097
[3.9] bpo-41009: fix requires_OS_version() class decorator (GH-20942) (GH-20947)
Signed-off-by: Christian Heimes <christian@python.org>

Automerge-Triggered-By: @tiran.
(cherry picked from commit bb6ec14479)

Co-authored-by: Christian Heimes <christian@python.org>
2020-06-25 05:18:06 -07:00
Miss Islington (bot) fdf6872f38
bpo-35773: Fix test_bdb on non-UTF-8 locales. (GH-21136)
(cherry picked from commit 94eee69e9b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-25 04:41:42 -07:00
Miss Islington (bot) 0ef6a3fc0e
bpo-41074: Fix support of non-ASCII names and SQL in msilib. (GH-21126)
* Fix support of non-ASCII names in functions OpenDatabase()
  and init_database().
* Fix support of non-ASCII SQL in method Database.OpenView().
(cherry picked from commit 55939b1708)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-25 02:12:58 -07:00
Miss Islington (bot) 29aa8085e9
bpo-41094: Additional fix for PYTHONSTARTUP. (GH-21119)
(cherry picked from commit a7dc714701)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-24 10:15:59 -07:00
Miss Islington (bot) 7329c8c7a2
bpo-41094: Fix decoding errors with audit when open files. (GH-21095)
(cherry picked from commit 6c6810d989)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-24 09:45:27 -07:00
Miss Islington (bot) d518ed0baa
bpo-41005: Fixed perrmission error (GH-20936) (GH-21051)
* fixed issue 41005: webbrowser fails when xdg-settings cannot be executed

Co-authored-by: KrishnaSai2020 <krishnasai.chivukula@gmal.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 9e27bc0c1e)

Co-authored-by: Krishna Chivukula <63070026+KrishnaSai2020@users.noreply.github.com>

Co-authored-by: Krishna Chivukula <63070026+KrishnaSai2020@users.noreply.github.com>
2020-06-24 14:59:19 +02:00
Miss Islington (bot) 4b80cfbaf6
Fix typo in dataclasses module (GH-21109) (#21110)
Automerge-Triggered-By: @matrixise
(cherry picked from commit 80526f6841)

Co-authored-by: Jürgen Gmach <juergen.gmach@googlemail.com>

Co-authored-by: Jürgen Gmach <juergen.gmach@googlemail.com>
2020-06-24 07:13:57 -04:00
Miss Islington (bot) cd696201ff
Small clean-ups for the random module (GH-21038) (GH-21065) 2020-06-22 21:22:40 -07:00
Miss Islington (bot) c916c48afc
bpo-41068: Fix read after write in zipfile for non-ASCII files names. (GH-21040)
(cherry picked from commit 36ff513f82)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-22 01:46:11 -07:00
Miss Islington (bot) 5606d555b6
bpo-26407: Do not mask errors in csv. (GH-20536)
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in csv.reader(), csv.writer.writerow() and
csv.writer.writerows().
(cherry picked from commit c88239f864)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-22 01:40:54 -07:00
Miss Islington (bot) 353c4bab7d
bpo-40824: Do not mask errors in __iter__ in "in" and the operator module. (GH-20537)
Unexpected errors in calling the __iter__ method are no longer
masked by TypeError in the "in" operator and functions
operator.contains(), operator.indexOf() and operator.countOf().
(cherry picked from commit cafe1b6e9d)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-22 01:20:56 -07:00
Miss Islington (bot) 26f6126b2a
bpo-41058: Use source file encoding in pdb.find_function(). (GH-21010)
(cherry picked from commit 19fcffa927)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-21 12:51:54 -07:00
Dong-hee Na 814b07bf81
[3.9] bpo-41052: Opt out serialization/deserialization for _random.Random (GH-21002). (GH-21030)
(cherry picked from commit 6989af0bc7)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-06-21 19:33:06 +09:00
Lysandros Nikolaou 71bb921829
[3.9] bpo-41060: Avoid SEGFAULT when calling GET_INVALID_TARGET in the grammar (GH-21020) (GH-21024)
`GET_INVALID_TARGET` might unexpectedly return `NULL`, which if not
caught will cause a SEGFAULT. Therefore, this commit introduces a new
inline function `RAISE_SYNTAX_ERROR_INVALID_TARGET` that always
checks for `GET_INVALID_TARGET` returning NULL and can be used in
the grammar, replacing the long C ternary operation used till now.

(cherry picked from commit 6c4e0bd974)

Automerge-Triggered-By: @pablogsal
2020-06-20 19:47:22 -07:00
Miss Islington (bot) 9862181750
bpo-41044: Generate valid PEG python parsers for opt+seq rules (GH-20995)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
(cherry picked from commit 55460ee6dc)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-06-20 10:59:32 -07:00
Miss Islington (bot) 75238869b5
bpo-41040: Fix test_modulefinder. (GH-20991)
(cherry picked from commit a041e116db)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2020-06-19 14:26:00 -07:00
Miss Islington (bot) 1529322ca6
bpo-38377: Fix skip_if_broken_multiprocessing_synchronize() on macOS (GH-20984)
skip_if_broken_multiprocessing_synchronize() only attempts for create
a semaphore on Linux to fix multiprocessing
test_resource_tracker_reused() on macOS.
(cherry picked from commit 3358da4054)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-06-19 09:20:15 -07:00
Miss Islington (bot) 83e54debac
Improve readability of `formataddr` docstring (GH-20963)
For me as a non native English speaker, the sentence with its embedded clause was very hard to understand.

modified:   Lib/email/utils.py

Automerge-Triggered-By: @csabella
(cherry picked from commit 66a65ba43c)

Co-authored-by: Jürgen Gmach <juergen.gmach@googlemail.com>
2020-06-19 05:18:44 -07:00
Lysandros Nikolaou a5442b26f4
[3.9] bpo-40334: Produce better error messages on invalid targets (GH-20106) (GH-20973)
* bpo-40334: Produce better error messages on invalid targets (GH-20106)

The following error messages get produced:
- `cannot delete ...` for invalid `del` targets
- `... is an illegal 'for' target` for invalid targets in for
  statements
- `... is an illegal 'with' target` for invalid targets in
  with statements

Additionally, a few `cut`s were added in various places before the
invocation of the `invalid_*` rule, in order to speed things
up.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
(cherry picked from commit 01ece63d42)
2020-06-19 01:03:58 +01:00
Victor Stinner b1e7361134
bpo-38377: Add support.skip_if_broken_multiprocessing_synchronize() (GH-20944) (GH-20962)
On Linux, skip tests using multiprocessing if the current user cannot
create a file in /dev/shm/ directory. Add the
skip_if_broken_multiprocessing_synchronize() function to the
test.support module.

(cherry picked from commit ddbeb2f3e0)
2020-06-18 17:19:59 +02:00
stratakis 9a58f03dc2
[3.9] bpo-40637: Do not emit warnings for disabled builtin hashes (GH… (GH-20951)
…-20937)

test_hashlib emits some warnings when it cannot find some hashes
as it assumes they failed to compile. Since we can disable hashes
through configure, we emit the warnings only in the case that we
did not intentionaly disable them.

Automerge-Triggered-By: @tiran
(cherry picked from commit 236a0f5)

Co-authored-by: stratakis <cstratak@redhat.com>
2020-06-17 12:43:27 -07:00
Victor Stinner b39d41ba1b
bpo-41003: Fix test_copyreg when numpy is installed (GH-20935) (GH-20945)
Fix test_copyreg when numpy is installed: test.pickletester now
saves/restores warnings.filters when importing numpy, to ignore
filters installed by numpy.

Add the save_restore_warnings_filters() function to the
test.support.warnings_helper module.

(cherry picked from commit 8362893e3f)
2020-06-17 18:40:14 +02:00
Miss Islington (bot) 7795ae8f05
bpo-40958: Avoid buffer overflow in the parser when indexing the current line (GH-20875) (GH-20919)
(cherry picked from commit 51c5896b62)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-16 18:36:59 +01:00
Miss Islington (bot) 097b8b6d52
bpo-40985: Show correct SyntaxError text when last line has a LINECONT (GH-20888)
When a file ends with a line that contains a line continuation character
the text of the emitted SyntaxError is empty, contrary to the old
parser, where the error text contained the text of the last line.
(cherry picked from commit 113e2b0a07)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-06-15 17:46:44 -07:00
Miss Islington (bot) bc996c67b7
bpo-38488: Upgrade bundled versions of pip & setuptools (GH-20491)
(cherry picked from commit 5f79f46612)

Co-authored-by: Xavier Fernandez <xav.fernandez@gmail.com>
2020-06-15 13:39:49 -07:00
Miss Islington (bot) 9a0624a3d9
bpo-40448: ensurepip: Do not use cache (GH-19812)
ensurepip optionally installs or upgrades 'pip' and 'setuptools' using
the version of those modules bundled with Python.  The internal PIP
installation routine by default temporarily uses its cache, if it
exists.  This is undesirable as Python builds and installations may be
independent of the user running the build, whilst PIP cache location
is dependent on the user's environment and outside of the build
environment.

At the same time, there's no value in using the cache while installing
bundled modules.

This change disables PIP caching when used in ensurepip.
(cherry picked from commit 4a3a682b12)

Co-authored-by: Krzysztof Konopko <kkonopko@users.noreply.github.com>
2020-06-15 10:48:44 -07:00
Miss Islington (bot) b87453f94f
bpo-34226: fix cgi.parse_multipart without content_length (GH-8530)
In Python 3.7 the behavior of parse_multipart changed requiring CONTENT-LENGTH
header, this fix remove this header as required and fix FieldStorage
read_lines_to_outerboundary, by not using limit when it's negative,
since by default it's -1 if not content-length and keeps substracting what
was read from the file object.

Also added a test case for this problem.
(cherry picked from commit d8cf3514dd)

Co-authored-by: roger <rogerduran@gmail.com>
2020-06-15 08:51:30 -07:00
Pablo Galindo 145fa86598
[3.9] Include soft keywords in keyword.py (GH-20877). (GH-20880)
(cherry picked from commit 78319e373d)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-15 04:31:05 +01:00
Jason R. Coombs 8a3469047c
[3.9] bpo-40924: Remove protocol for supplying Traversable objects from loaders (GH-20820)
Remove protocol that loaders can present a files method as found in importlib_resources 1.3-1.6 (added in Python 3.8b1).
2020-06-14 14:12:20 +02:00
Miss Islington (bot) 83cd968f5c
bpo-30064: Fix slow asyncio sock test (GH-20868)
Using a log2n way to fill a much smaller buffer, and receiving in a cleaner way with EOF.

The failing test was reproducible using the following command thanks to @aeros :

```bash
./python -m test test_asyncio.test_sock_lowlevel --match test_sock_client_racing -j100 -F -v
```

According to test results, we may still need to bump the timeout:

5aad027db9/Lib/test/test_asyncio/test_sock_lowlevel.pyGH-L256-L257
(cherry picked from commit 8f04a84755)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2020-06-14 01:08:08 -07:00
Miss Islington (bot) 37c9fc5baa
Some reformatting (suggested by Black) and minor factoring. (GH-20865) (GH-20866) 2020-06-13 19:53:32 -07:00
Miss Islington (bot) 55c1d21761
bpo-40855: Fix ignored mu and xbar parameters (GH-20835) (#GH-20862) 2020-06-13 16:56:15 -07:00
Miss Islington (bot) f1534d0840
Minor code clean-ups (GH-20838) (GH-20858) 2020-06-13 10:23:48 -07:00
Miss Islington (bot) 94bb4b7db2
bpo-40834: Fix truncate when sending str object with channel (GH-20555)
(cherry picked from commit 29c117202e)

Co-authored-by: An Long <aisk@users.noreply.github.com>
2020-06-13 05:44:38 -07:00
Christian Heimes f919179087
bpo-40964: disable remote IMAP tests (GH-20836)
Remote host cyrus.andrew.cmu.edu is blocking incoming connections and is
causing test suite to fail.

Signed-off-by: Christian Heimes <christian@python.org>
2020-06-12 15:06:20 -04:00
Pablo Galindo 3782497cc2
[3.9] bpo-40939: Fix test_keyword for the old parser (GH-20814) 2020-06-11 19:29:13 +01:00
Victor Stinner dc40105c88
bpo-40947: getpath.c uses PyConfig.platlibdir (GH-20807) (GH-20813)
Followup of bpo-40854, there is one remaining usage of PLATLIBDIR
which should be replaced by config->platlibdir.

test_sys checks that sys.platlibdir attribute exists and is a string.

Update Makefile: getpath.c and sysmodule.c no longer need PLATLIBDIR
macro, PyConfig.platlibdir member is used instead.

Co-authored-by: Sandro Mani <manisandro@gmail.com>
(cherry picked from commit d72b9644a3)
2020-06-11 18:27:00 +02:00
Miss Islington (bot) 2f46c65071
bpo-34401: Fix test_gdb for HP GDB version string (GH-20804)
The GDB provided by HPE on HP-UX contains a modified version string. Therefore
the tests fail. Adapt the regex to match that string.

Patch by Michael Osipov.

Co-Authored-by: Michael Osipov <michael.osipov@siemens.com>
(cherry picked from commit b2dca49ca3)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-06-11 07:08:29 -07:00
Miss Islington (bot) 961edf7979
bpo-40939: Generate keyword.py using the new parser (GH-20800)
(cherry picked from commit 9727694f08)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-06-11 06:02:37 -07:00
Miss Islington (bot) f6428babb1
Collections module reformatting and minor code refactoring (GH-20772) (GH-20798) 2020-06-11 00:08:27 -07:00
Miss Islington (bot) e3ce3bba92
bpo-40847: Consider a line with only a LINECONT a blank line (GH-20769)
A line with only a line continuation character should be considered
a blank line at tokenizer level so that only a single NEWLINE token
gets emitted. The old parser was working around the issue, but the
new parser threw a `SyntaxError` for valid input. For example,
an empty line following a line continuation character was interpreted
as a `SyntaxError`.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
(cherry picked from commit 896f4cf63f)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-06-10 17:14:16 -07:00
Victor Stinner af69325753
bpo-40927: Fix test_binhex when run twice (GH-20764) (GH-20789)
test_binhex now uses import_fresh_module() to ensure that it raises
DeprecationWarning each time.

(cherry picked from commit 9c24e2e4c1)
2020-06-10 20:17:13 +02:00
Victor Stinner 4a4f660cfd
bpo-40826: Fix test_repl.test_close_stdin() on Windows (GH-20779) (GH-20785)
test_repl.test_close_stdin() now calls
support.suppress_msvcrt_asserts() to fix the test on Windows.

* Move suppress_msvcrt_asserts() from test.libregrtest.setup to
  test.support. Make its verbose parameter optional: verbose=False by
  default.
* SuppressCrashReport now uses SetErrorMode() of the msvcrt module,
  rather than using ctypes.
* Remove also an unused variable (deadline) in wait_process().

(cherry picked from commit f6e58aefde)
2020-06-10 19:24:56 +02:00
Miss Islington (bot) 3b97d1becb
bpo-36543: Revert "bpo-36543: Remove the xml.etree.cElementTree module." (GH-20117) (GH-20780)
* Revert "bpo-36543: Remove the xml.etree.cElementTree module. (GH-19108)"

This reverts commit b33e52511a.
(cherry picked from commit ec88e1bca8)
2020-06-10 18:01:25 +02:00
Miss Islington (bot) d55ed7b107
Raise specialised syntax error for invalid lambda parameters (GH-20776)
(cherry picked from commit c6483c9896)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-10 06:24:41 -07:00
Łukasz Langa b484871ba7
Python 3.9.0b3 2020-06-09 20:52:10 +02:00
Łukasz Langa ce5e6f098f
[3.9] bpo-40924: Revert "bpo-39791 native hooks for importlib.resources.files (GH-20576)" (#20760)
This reverts commit 9cf1be46e3 due to
https://bugs.python.org/issue40924.
2020-06-09 19:50:01 +02:00
Łukasz Langa 8f1f4161de Python 3.9.0b2
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl7etVEACgkQsmmV4xAl
 BWjzUxAAmbCfQsA5KW2o8fyj4R3NOI69juBUHaUmcHp668Ah8wbVjz7cf+uGOJ/1
 TLVMUez3I27BhPRNhjfawH6Xv/xpnAWbCzK7GNpspSlUkY0OXk30We5ddbuz2p8I
 4yff9aHAH1pgkdSz7W51aJrgNfzOhyFL7affDuQraKpUNLJdDXjRjSVGdXRHXXk5
 ft7hTgxDVRL0DNJFFl9DKXlpQ7S6GywfaAEPJj22Gu1nKQRQGx8pa+Z3HtKOtTGq
 x3AoTNQdvaZXxqIfp67gG7S4DMrmMxCT/Sv+IsqoBVTEVKfaH6uGMtxUQJSWhngf
 yY1uARSxYwhbXsEtD2wRWmn+lOLq8HHdnDOg9X1564s/unaPoelebhy3RCA9qChh
 65O+wKZ/zzJQQc7Gee3uEQnK//51ihqgM0YEEKG3DPHRyFFdFIE92XQ/sQuxkTcc
 wPH2+edUhoGNND+oFWV7uPLlpqAsp6de+Cs3TXRpjjFFhNDOm15WgStdHvrIhvob
 67ri9PO4tS94zVY1a3bn0Z/uwMerz22zZSU15Ov+8Sezb00LRqiNntRXdzTcD3cB
 XxnMliiytbH/Ft6WXb3W77usdXnXR3SDLwnizjgLPkzOFWTcfeggQmblmFtN5/Mi
 1PxlMAo6usF75d7ZKsV4jAAG5H1PXUk5+DcFiQoNvuLI7OxNbIs=
 =sDBi
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQJEBAABCAAuFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl7e1n0QHGx1a2FzekBs
 YW5nYS5wbAAKCRCyaZXjECUFaEFGEACTv9oYX+gMEPCdJIdJyNWBFRA+QRxIcpwQ
 /PZbTpx/SIlrSzSYGw1q5w42gl9fIXXWpnhlFmY/Y2LbNPz7fK4OAigvUCzcvc9Q
 6q3dOyR4CfZu7c0u+zlzjKL9oGcadw99Bk/LYTa0zcLLadTemzeVRZnM3VCd17os
 E61JgJtUrXpyjfaStuMoYjYjbW4aH7mnRIAgH2ugqkbI+RbO0HAxYVdI56WxYe0x
 Qt5gqqYoJs3pZSGphnpkQqRcngfueefwMDCzl74s5zLt25MIuHacdFhLExuW5o44
 IRAnWJ8BotY8Y+SY6W/lz7ZCpS4mGhAo8dFRZSLrVS2UHQBvvgvijaDbUjmNyHPP
 /SNGpjoYvBE5k9qzXNpRrIL3DuqaCYexEpGemOp3RTTx4kayACRomAe3kBYve5jE
 Bt/9GqpZbORsnhjdL3CWRhDtBTg3TH2e3ea1ccliFyUjaSy2BgkqtS0FKnv7lNpB
 uQwPyEIjDkz3+yXFik1Eaew9L/63oqi7RIh6cTAh/0By3r4f3aEHqdSVsJFrfzmU
 eOCINcMPtrMd4zwelzrboPTnb79EpfBYCATOUPOe82KOwNafWOqvZn8hXeVvlgiS
 gmDh5sv1Q7QDiCZSYklka7IcHT5Dj+i4BrOYXACIvOvyOZBBNMwslr6vTxzKkt3q
 FqNsF5Jwhw==
 =X0Xv
 -----END PGP SIGNATURE-----

Merge tag 'v3.9.0b2' into 3.9

Python 3.9.0b2
2020-06-09 02:23:22 +02:00
Miss Islington (bot) 299d3d1c52
Minor improvement to the namedtuple implementation (GH-20741) (GH-20742) 2020-06-08 13:25:48 -07:00
Łukasz Langa 0b1a1c8c4c
Python 3.9.0b2 2020-06-08 20:41:34 +02:00
Victor Stinner 817506432d
bpo-40854: Allow overriding sys.platlibdir via PYTHONPLATLIBDIR env-var (GH-20605) (GH-20725)
(cherry picked from commit 8f023a2f66)

Co-authored-by: Sandro Mani <manisandro@gmail.com>
2020-06-08 19:36:13 +02:00
Victor Stinner dedaac040f
bpo-40910: Export Py_GetArgcArgv() function (GH-20721) (GH-20723)
Export explicitly the Py_GetArgcArgv() function to the C API and
document the function. Previously, it was exported implicitly which
no longer works since Python is built with -fvisibility=hidden.

* Add PyConfig._orig_argv member.
* Py_InitializeFromConfig() no longer calls _PyConfig_Write() twice.
* PyConfig_Read() no longer initializes Py_GetArgcArgv(): it is now
  _PyConfig_Write() responsibility.
* _PyConfig_Write() result type becomes PyStatus instead of void.
* Write an unit test on Py_GetArgcArgv().

(cherry picked from commit e81f6e687d)
2020-06-08 18:44:50 +02:00
Pablo Galindo 2b33cc3a25
[3.9] Remove PEG-specific syntax error check in the old parser (GH-20717) 2020-06-08 11:27:58 +01:00
Miss Islington (bot) 8df4f3942f
bpo-40903: Handle multiple '=' in invalid assignment rules in the PEG parser (GH-20697)
Automerge-Triggered-By: @pablogsal
(cherry picked from commit 9f495908c5)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-08 02:22:06 -07:00
Miss Islington (bot) 3deded947c
Deny eval() direct access to builtins (GH-20713) (GH-20714) 2020-06-08 00:19:27 -07:00
Miss Islington (bot) 9cf1be46e3
bpo-39791 native hooks for importlib.resources.files (GH-20576)
* Provide native .files support on SourceFileLoader.

* Add native importlib.resources.files() support to zipimporter. Remove fallback support.

* make regen-all

* 📜🤖 Added by blurb_it.

* Move 'files' into the ResourceReader so it can carry the relevant module name context.

* Create 'importlib.readers' module and add FileReader to it.

* Add zip reader and rely on it for a TraversableResources object on zipimporter.

* Remove TraversableAdapter, no longer needed.

* Update blurb.

* Replace backslashes with forward slashes.

* Incorporate changes from importlib_metadata 2.0, finalizing the interface for extension via get_resource_reader.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 843c277656)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-06-07 18:30:08 -07:00
Miss Islington (bot) 6440911736
bpo-40904: Fix segfault in the new parser with f-string containing yield statements with no value (GH-20701)
(cherry picked from commit 972ab03276)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-06-07 18:08:53 -07:00
Miss Islington (bot) 71f501698d
bpo-39791: Support file systems that cannot support non-ascii filenames (skipping tests in that case). (GH-20681)
(cherry picked from commit 2efe18bf27)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-06-07 08:17:45 -07:00
Miss Islington (bot) 1e4fa91104
bpo-40724: Support setting buffer slots from type specs (GH-20648) (GH-20683)
This is not part of the limited API but makes the buffer slots available for type specs.
(cherry picked from commit f7c4e23642)
2020-06-07 09:06:40 +02:00
Miss Islington (bot) 90ee51f1cd
bpo-40870: Invalidate usage of some constants with ast.Name (GH-20649)
(cherry picked from commit 68874a8502)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-06-06 10:04:38 -07:00
Miss Islington (bot) d5e7348e41
bpo-40862: Raise TypeError when const is given to argparse.BooleanOptionalAction (GH-20623) (GH-20664) 2020-06-05 19:31:18 -07:00
Miss Islington (bot) a4fa9a9515
bpo-39791: Refresh importlib.metadata from importlib_metadata 1.6.1. (GH-20659) (GH-20661)
* Refresh importlib.metadata from importlib_metadata 1.6.1.

* 📜🤖 Added by blurb_it.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
(cherry picked from commit 161541ab45)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2020-06-05 17:46:24 -04:00
Miss Islington (bot) cdc3d9cb22
Fix missing FloatOperation in EXTRA_FUNCTIONALITY path. (GH-20655) (#20660)
(cherry picked from commit 5fe1df1886)

Authored-by: Stefan Krah <skrah@bytereef.org>
2020-06-05 22:22:49 +02:00
Miss Islington (bot) 3dfe549bfa
bpo-40807: Show warnings once from codeop._maybe_compile (GH-20486)
* bpo-40807: Show warnings once from codeop._maybe_compile

* Move catch_warnings

* news

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
(cherry picked from commit 052d3fc090)

Co-authored-by: Cheryl Sabella <cheryl.sabella@gmail.com>
2020-06-04 16:59:44 -07:00
Miss Islington (bot) 196810a98a
bpo-17258: Add requires_hashdigest to multiprocessing tests (GH-20412)
Skip some :mod:`multiprocessing` tests when MD5 hash digest is blocked.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit b022e5cffb)

Co-authored-by: Christian Heimes <christian@python.org>
2020-06-04 10:22:36 -07:00
Victor Stinner 6d62dc1ea4
[3.9] bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578) (GH-20618)
* bpo-40826: Add _Py_EnsureTstateNotNULL() macro (GH-20571)

Add _Py_EnsureTstateNotNULL(tstate) macro: call Py_FatalError() if
tstate is NULL, the error message contains the current function name.

(cherry picked from commit 3026cad59b)

* bpo-40826: PyOS_InterruptOccurred() requires GIL (GH-20578)

PyOS_InterruptOccurred() now fails with a fatal error if it is called
with the GIL released.

(cherry picked from commit cbe1296922)
2020-06-03 20:16:39 +02:00
Victor Stinner 5d2396c8cf
[3.9] bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20613)
* bpo-40826: Fix GIL usage in PyOS_Readline() (GH-20579)

Fix GIL usage in PyOS_Readline(): lock the GIL to set an exception.

Pass tstate to my_fgets() and _PyOS_WindowsConsoleReadline(). Cleanup
these functions.

(cherry picked from commit c353764fd5)

* bpo-40826: Add _PyOS_InterruptOccurred(tstate) function (GH-20599)

my_fgets() now calls _PyOS_InterruptOccurred(tstate) to check for
pending signals, rather calling PyOS_InterruptOccurred().

my_fgets() is called with the GIL released, whereas
PyOS_InterruptOccurred() must be called with the GIL held.

test_repl: use text=True and avoid SuppressCrashReport in
test_multiline_string_parsing().

Fix my_fgets() on Windows: fgets(fp) does crash if fileno(fp) is closed.

(cherry picked from commit fa7ab6aa0f)
2020-06-03 17:49:25 +02:00
Miss Islington (bot) a125561397
Update error message in _zoneinfo.py to use f-string (GH-20577)
Inline with the rest of the file, updated error message to use f-string.
(cherry picked from commit 5b9fbbabac)

Co-authored-by: aboddie <64019758+aboddie@users.noreply.github.com>
2020-06-03 08:09:49 -07:00
Miss Islington (bot) 74a1fceeb6
bpo-40767: Allow pure Wayland to get default XDG web browser (GH-20382)
Would be nice to backport to python 3.7+. I don't think it's worth the hassle to backport this all the way down to 3.10. But I'll let the maintainers decide.

This is hard to test because the test setup already includes this [environment variable](https://github.com/python/cpython/blob/master/Lib/test/pythoninfo.pyGH-L292)

Let me know if something doesn't match the PR guidelines. This is my first PR in the python source code.
(cherry picked from commit c822efeda9)

Co-authored-by: Jeremy Attali <jeremy.attali@gmail.com>
2020-06-03 06:04:29 -07:00
Huon Wilson 3c7609a23c
[3.9] bpo-40630: Add tracemalloc.reset_peak (GH-20102) (GH-20545)
* bpo-40630: Add tracemalloc.reset_peak (GH-20102, cherrypick 8b62644)

The reset_peak function sets the peak memory size to the current size,
representing a resetting of that metric. This allows for recording the
peak of specific sections of code, ignoring other code that may have
had a higher peak (since the most recent `tracemalloc.start()` or
tracemalloc.clear_traces()` call).

* Adjust docs to point to 3.9
2020-06-01 19:26:22 +02:00
Miss Islington (bot) 410b730c20
Make sure that keyword arguments are merged into the arguments dictionary when dict unpacking and keyword arguments are interleaved. (GH-20553) (GH-20569)
(cherry picked from commit db64f12e4d)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2020-06-01 17:07:32 +01:00
Miss Islington (bot) 0a674638a3
bpo-17005: Move topological sort functionality to its own module (GH-20558)
The topological sort functionality that was introduced initially in the
functools module has been moved to a new graphlib module to
better accommodate the new tools and keep the original scope of the
functools module.
(cherry picked from commit 2f172d8f15)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-31 17:01:37 -07:00
Miss Islington (bot) 96d91071c0
bpo-40759: Deprecate the symbol module (GH-20364)
Automerge-Triggered-By: @pablogsal
(cherry picked from commit cf88871d6a)

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-05-31 15:23:29 -07:00
Miss Islington (bot) cdb015b7ed
Fix asyncio.to_thread() documented return type (GH-20547)
When I wrote the documentation for `asyncio.to_thread()`, I mistakenly assumed that `return await loop.run_in_executor(...)` within an async def function would return a Future. In reality, it returns a coroutine.

This likely won't affect typical usage of `asyncio.to_thread()`, but it's important for the documentation to be correct here. In general, we also tend to avoid returning futures from high-level APIs in asyncio.
(cherry picked from commit 2b201369b4)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-31 00:26:20 -07:00
Miss Islington (bot) 9f3f70fd0b
bpo-39885: Make IDLE context menu cut and copy work again (GH-18951)
Leave selection when right click within.  This exception to clearing selections when right-clicking was omitted from the previous commit, 4ca060d.  I did not realize that this completely disabled the context menu entries, and  I should have merged a minimal fix immediately.  An automated test should follow.
(cherry picked from commit 97e4e0f53d)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-05-29 16:13:21 -07:00
Miss Islington (bot) 805fa54676
Further de-linting of zoneinfo module (GH-20499)
* Remove unused imports in zoneinfo

* Remove unused variables in zoneinfo

* Remove else after raise
(cherry picked from commit 364b5ead15)

Co-authored-by: Paul Ganssle <paul@ganssle.io>
2020-05-29 06:53:52 -07:00
Miss Islington (bot) ad088ca5c6
bpo-40780: Fix failure of _Py_dg_dtoa to remove trailing zeros (GH-20435) (GH-20514)
* Fix failure of _Py_dg_dtoa to remove trailing zeros

* Add regression test and news entry

* Add explanation about why it's safe to strip trailing zeros

* Make code safer, clean up comments, add change note at top of file

* Nitpick: avoid implicit int-to-float conversion in tests
(cherry picked from commit 895c9c1d43)

Co-authored-by: Mark Dickinson <mdickinson@enthought.com>
2020-05-29 14:46:54 +01:00
Miss Islington (bot) 8fcc1474ef
bpo-40784: Fix sqlite3 deterministic test (GH-20448)
(cherry picked from commit c610d970f5)

Co-authored-by: Erlend Egeberg Aasland <erlend.aasland@innova.no>
2020-05-29 05:46:52 -07:00
Miss Islington (bot) a6ae02d7e9
bpo-39040: Fix parsing of email mime headers with whitespace between encoded-words. (gh-17620)
* bpo-39040: Fix parsing of email headers with encoded-words inside a quoted string.

It is fairly common to find malformed mime headers (especially content-disposition
headers) where the parameter values, instead of being encoded to RFC
standards, are "encoded" by doing RFC 2047 "encoded word" encoding, and
then enclosing the whole thing in quotes.  The processing of these malformed
headers was incorrectly leaving the spaces between encoded words in the decoded
text (whitespace between adjacent encoded words is supposed to be stripped on
decoding).  This changeset fixes the encoded word processing inside quoted strings
(bare-quoted-string) to do correct RFC 2047 decoding by stripping that
whitespace.
(cherry picked from commit 21017ed904)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
2020-05-29 04:43:06 -07:00
Miss Islington (bot) 6637bd4516
bpo-30064: Properly skip unstable loop.sock_connect() racing test (GH-20494)
(cherry picked from commit dc4eee9e26)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2020-05-28 15:17:33 -07:00
Miss Islington (bot) 1d82f00367
bpo-30064: Fix unstable asyncio "racing" socket tests (GH-20485)
Skip new "racing" socket tests which fail randomly until someone fix
them, to ease analysis of buildbot failures (skip tests which are
known to be broken/unstable).
(cherry picked from commit 84ee7e1573)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-28 07:28:17 -07:00
Christian Heimes 8183e11d87
[3.9] bpo-40791: Use CRYPTO_memcmp() for compare_digest (GH-20456) (GH-20461)
hashlib.compare_digest uses OpenSSL's CRYPTO_memcmp() function
when OpenSSL is available.

Note: The _operator module is a builtin module. I don't want to add
libcrypto dependency to libpython. Therefore I duplicated the wrapper
function and added a copy to _hashopenssl.c..
(cherry picked from commit db5aed931f)

Co-authored-by: Christian Heimes <christian@python.org>
2020-05-28 05:09:38 -07:00
Miss Islington (bot) 9e3c583954
bpo-40795: ctypes calls unraisablehook with an exception (GH-20452)
If ctypes fails to convert the result of a callback or if a ctypes
callback function raises an exception, sys.unraisablehook is now
called with an exception set. Previously, the error was logged into
stderr by PyErr_Print().
(cherry picked from commit 10228bad04)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-27 16:00:01 -07:00
Pablo Galindo 9b83829e7d
[3.9] bpo-40614: Respect feature version for f-string debug expressions (GH-20196) (GH-20464)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit c116c94)

Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
2020-05-27 22:01:11 +01:00
Miss Islington (bot) 3a2667d91e
bpo-30064: Fix asyncio loop.sock_* race condition issue (GH-20369)
(cherry picked from commit 210a137396)

Co-authored-by: Fantix King <fantix.king@gmail.com>
2020-05-27 13:39:03 -07:00
Lysandros Nikolaou 1bfe659ee5
[3.9] Backport GH-20370 and GH-20436: Soft keywords (GH-20458) 2020-05-27 21:20:07 +01:00
Miss Islington (bot) 788d7bfe18
bpo-13097: ctypes: limit callback to 1024 arguments (GH-19914)
ctypes now raises an ArgumentError when a callback
is invoked with more than 1024 arguments.

The ctypes module allocates arguments on the stack in
ctypes_callproc() using alloca(), which is problematic
when large numbers of arguments are passed. Instead
of a stack overflow, this commit raises an ArgumentError
if more than 1024 parameters are passed.
(cherry picked from commit 29a1384c04)

Co-authored-by: Sean Gillespie <sean@swgillespie.me>
2020-05-27 08:46:57 -07:00
Miss Islington (bot) 1c88bf8541
bpo-39244: multiprocessing return default start method first on macOS (GH-18625)
(cherry picked from commit db098bc1f0)

Co-authored-by: idomic <michael.ido@gmail.com>
2020-05-26 08:13:33 -07:00
Miss Islington (bot) 66391b0c6e
bpo-40637: Fix test_pbkdf2_hmac_py for missing sha1 (GH-20422)
(cherry picked from commit be63019ed7)

Co-authored-by: Christian Heimes <christian@python.org>
2020-05-26 03:46:24 -07:00
Miss Islington (bot) 5221a10dde
bpo-35714: Reject null characters in struct format strings (GH-16928)
struct.error is now raised if there is a null character in a struct
format string.
(cherry picked from commit 3f59b55316)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2020-05-26 00:04:59 -07:00
Miss Islington (bot) a729f4abb8
Simplify creation of the __new__ method in namedtuple() (GH-20361) (GH-20409) 2020-05-25 22:00:31 -07:00
Lysandros Nikolaou 791a46ed58
[3.9] bpo-38964: Print correct filename on a SyntaxError in an fstring (GH-20399) (GH-20404)
When a `SyntaxError` in the expression part of a fstring is found,
the filename attribute of the `SyntaxError` is always `<fstring>`.
With this commit, it gets changed to always have the name of the file
the fstring resides in.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>.
(cherry picked from commit f7b1e46156)
2020-05-26 02:24:31 +01:00
Lysandros Nikolaou 6cb0ad2039
bpo-40246: Fix test_fstring when run with the old parser (GH-20402) 2020-05-26 01:10:00 +01:00
Miss Islington (bot) 318a18eb88
bpo-23082: Better error message for PurePath.relative_to() from pathlib (GH-19611)
Co-authored-by: Sadhana Srinivasan <rotuna@Sadhanas-MBP.fritz.box>
(cherry picked from commit 448325369f)

Co-authored-by: Rotuna <sadhanasrinivasan@protonmail.com>
2020-05-25 13:01:20 -07:00
Miss Islington (bot) 20b2bf3183
bpo-38972: Fix typos in PowerShell Execution Policies links (GH-20383)
(cherry picked from commit ef16958d17)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2020-05-25 08:13:49 -07:00
Miss Islington (bot) 7015823971
bpo-40695: Limit hashlib builtin hash fallback (GH-20259)
:mod:`hashlib` no longer falls back to builtin hash implementations when
OpenSSL provides a hash digest and the algorithm is blocked by security
policy.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 4cc2f9348c)

Co-authored-by: Christian Heimes <christian@python.org>
2020-05-25 02:07:35 -07:00
Miss Islington (bot) 1a4e9e6f35
bpo-36290: Fix keytword collision handling in AST node constructors (GH-12382)
(cherry picked from commit c73914a562)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@lenstra.fr>
2020-05-24 14:32:32 -07:00
Miss Islington (bot) 4bb4cde177
bpo-40443: Remove unused imports in the zoneinfo (GH-20354)
(cherry picked from commit 3436f5f899)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-05-24 07:58:25 -07:00
Miss Islington (bot) 21a9af193c
bpo-37309: Update IDLE NEWS.txt (GH-20356)
(cherry picked from commit 16ef324193)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-05-24 07:16:09 -07:00
Miss Islington (bot) 874506cff9
bpo-40723: Make IDLE autocomplete test run without __main__.__file__ (GH-20311)
This was the only failure running unittest.main(test.test_idle) after imports.
(cherry picked from commit 905b3cd05f)

Co-authored-by: Florian Dahlitz <f2dahlitz@freenet.de>
2020-05-24 04:14:17 -07:00
Miss Islington (bot) 7f77ac463c
bpo-40696: Fix a hang that can arise after gen.throw() (GH-20287)
This updates _PyErr_ChainStackItem() to use _PyErr_SetObject()
instead of _PyErr_ChainExceptions(). This prevents a hang in
certain circumstances because _PyErr_SetObject() performs checks
to prevent cycles in the exception context chain while
_PyErr_ChainExceptions() doesn't.
(cherry picked from commit 7c30d12bd5)

Co-authored-by: Chris Jerdonek <chris.jerdonek@gmail.com>
2020-05-22 14:35:22 -07:00
Miss Islington (bot) a08b7c3bb0
bpo-9216: hashlib usedforsecurity fixes (GH-20258)
func:`hashlib.new` passed ``usedforsecurity`` to OpenSSL EVP constructor
``_hashlib.new()``. test_hashlib and test_smtplib handle strict security
policy better.

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

Automerge-Triggered-By: @tiran
(cherry picked from commit 909b5714e1)

Co-authored-by: Christian Heimes <christian@python.org>
2020-05-22 11:22:30 -07:00
Miss Islington (bot) 51025e0c86
Fix the URL to fishshell.com (GH-20251)
(cherry picked from commit da7d1f0408)

Co-authored-by: Jonathan Goble <jcgoble3@gmail.com>
2020-05-22 07:32:21 -07:00
Miss Islington (bot) 55c8923524
bpo-40334: Produce better error messages for non-parenthesized genexps (GH-20153)
The error message, generated for a non-parenthesized generator expression
in function calls, was still the generic `invalid syntax`, when the generator expression wasn't appearing as the first argument in the call. With this patch, even on input like `f(a, b, c for c in d, e)`, the correct error message gets produced.
(cherry picked from commit ae14583302)

Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-05-21 18:14:55 -07:00
Miss Islington (bot) d00aaf306a
bpo-40715: Reject dict unpacking on dict comprehensions (GH-20292)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
(cherry picked from commit b8a65ec1d3)

Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-05-21 15:58:16 -07:00
Pablo Galindo 275d7e1080
[3.9] bpo-40176: Improve error messages for trailing comma on from import (GH-20294) (GH-20302)
(cherry picked from commit 72e0aa2)

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-05-21 22:04:54 +01:00
Miss Islington (bot) 3e650545bf
bpo-32309: Add support for contextvars in asyncio.to_thread() (GH-20278)
Allows contextvars from the main thread to be accessed in the separate thread used in `asyncio.to_thread()`. See the [discussion](https://github.com/python/cpython/pull/20143GH-discussion_r427808225) in GH-20143 for context.

Automerge-Triggered-By: @aeros
(cherry picked from commit 0f56263e62)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-20 22:38:00 -07:00
Miss Islington (bot) 4a1dba7bb8
s/wakup/wakeup (GH-20250)
(as title)

Automerge-Triggered-By: @Mariatta
(cherry picked from commit f2947e354c)

Co-authored-by: Kunal Bhalla <bhalla.kunal@gmail.com>
2020-05-20 10:58:47 -07:00
Miss Islington (bot) f541a371a5
bpo-40698: Improve distutils upload hash digests (GH-20260)
- Fix upload test on systems that blocks MD5
- Add SHA2-256 and Blake2b-256 digests based on new Warehous and twine
  specs.

Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit e572c7f6db)

Co-authored-by: Christian Heimes <christian@python.org>
2020-05-20 07:57:08 -07:00
Miss Islington (bot) 059279d870
bpo-38870: invalid escape sequence (GH-20240)
`/home/isidentical/cpython/cpython/Lib/test/test_unparse.py:333: DeprecationWarning: invalid escape sequence \X`

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

Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2020-05-19 15:33:45 -07:00
Miss Islington (bot) e2991308c9
bpo-32309: Implement asyncio.to_thread() (GH-20143)
Implements `asyncio.to_thread`, a coroutine for asynchronously running IO-bound functions in a separate thread without blocking the event loop. See the discussion starting from [here](https://github.com/python/cpython/pull/18410GH-issuecomment-628930973) in GH-18410 for context.

Automerge-Triggered-By: @aeros
(cherry picked from commit cc2bbc2227)

Co-authored-by: Kyle Stanley <aeros167@gmail.com>
2020-05-19 03:03:25 -07:00
Łukasz Langa 97fe9cfd9f
Python 3.9.0b1 2020-05-19 01:07:09 +02:00
Hai Shi a3ec3ad9e2
bpo-40275: More lazy imports in test.support (GH-20131)
Make the the following imports lazy in test.support:

* bz2
* gzip
* lzma
* resource
* zlib

The following test.support decorators now need to be called
with parenthesis:

* @support.requires_bz2
* @support.requires_gzip
* @support.requires_lzma
* @support.requires_zlib

For example, "@requires_zlib" becomes "@requires_zlib()".
2020-05-19 00:02:57 +02:00
Batuhan Taskaya c102a14825
bpo-38870: Don't omit parenthesis when unparsing a slice in ast.unparse
When unparsing a non-empty tuple, the parentheses can be safely
omitted if there aren't any elements that explicitly require them (such as starred expressions).
2020-05-18 21:48:49 +01:00
Lysandros Nikolaou 75b863aa97
bpo-40334: Reproduce error message for type comments on bare '*' in the new parser (GH-20151) 2020-05-18 20:14:47 +01:00
CyberSaxosTiGER d71a6492db
bpo-38870: correctly escape unprintable characters on ast.unparse (GH-20166)
Unprintable characters such as `\x00` weren't correctly roundtripped
due to not using default string repr when generating docstrings. This
patch correctly encodes all unprintable characters (except `\n` and `\t`, which
are commonly used for formatting, and found unescaped).

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Batuhan Taskaya <isidentical@gmail.com>
2020-05-18 19:41:35 +01:00
Batuhan Taskaya 2135e10dc7
bpo-40663: Correctly handle annotations with subscripts in ast_unparse.c (GH-20156) 2020-05-18 19:23:48 +01:00
Irit Katriel e6578a226d
bpo-40662: Fixed ast.get_source_segment for ast nodes that have incomplete location information (GH-20157)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-18 19:14:12 +01:00
Lysandros Nikolaou 7b7a21bc4f
bpo-40661: Fix segfault when parsing invalid input (GH-20165)
Fix segfaults when parsing very complex invalid input, like `import äˆ ð£„¯ð¢·žð±‹á”€ð””ð‘©±å®ä±¬ð©¾\n𗶽`.

Co-authored-by: Guido van Rossum <guido@python.org>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2020-05-18 18:32:03 +01:00
Serhiy Storchaka 08b47c367a
bpo-40257: Revert changes to inspect.getdoc() (GH-20073) 2020-05-18 20:25:07 +03:00
Nathaniel J. Smith 58205a0217
bpo-39148: fixup to account for IPV6_ENABLED being moved (GH-20170) 2020-05-18 00:56:47 -07:00
Kjell Braden 442634c42f
bpo-39148: enable ipv6 for datagrams in Proactor (GH-19121)
Ifdef is not necessary, as AF_INET6 is supported from Windows Vista, and other code in overlapped.c uses AF_INET6 and is not ifdef'd.
Change the raised exception so users are not fooled to think it comes from Windows API.

Automerge-Triggered-By: @njsmith
2020-05-17 23:21:30 -07:00
Chris Jerdonek da742ba826
bpo-31033: Improve the traceback for cancelled asyncio tasks (GH-19951)
When an asyncio.Task is cancelled, the exception traceback now
starts with where the task was first interrupted.  Previously,
the traceback only had "depth one."
2020-05-17 22:47:31 -07:00
Paul Ganssle e527ec8abe
bpo-40536: Add zoneinfo.available_timezones (GH-20158)
This was not specified in the PEP, but it will likely be a frequently requested feature if it's not included.

This includes only the "canonical" zones, not a simple listing of every valid value of `key` that can be passed to `Zoneinfo`, because it seems likely that that's what people will want.
2020-05-17 21:55:11 -04:00
Raymond Hettinger 9681953c99
bpo-39058: Preserve attribute order in argparse Namespace reprs. (GH-17621) 2020-05-17 18:53:01 -07:00
Christian Heimes 54f2898fe7
bpo-40645: Implement HMAC in C (GH-20129)
The internal module ``_hashlib`` wraps and exposes OpenSSL's HMAC API. The
new code will be used in Python 3.10 after the internal implementation
details of the pure Python HMAC module are no longer part of the public API.

The code is based on a patch by Petr Viktorin for RHEL and Python 3.6.

Co-Authored-By: Petr Viktorin <encukou@gmail.com>
2020-05-17 13:49:10 +02:00
Erlend Egeberg Aasland 9a45bfe6f4
bpo-35569: Expose RFC 3542 IPv6 socket options on macOS (GH-19526) 2020-05-17 02:32:46 -04:00
Chris Jerdonek d7184d3dbd
bpo-29587: Add another test for the gen.throw() fix. (GH-19859) 2020-05-16 21:14:48 -07:00
Pablo Galindo 6341fc7257
bpo-38870: Use subTest in test_unparse for better error reporting (GH-20141) 2020-05-17 03:53:57 +01:00
Pablo Galindo af8e5f84d9
Use subTest in test_exceptions for better error reporting (GH-20140) 2020-05-17 01:22:00 +01:00
Christian Heimes 837f9e42e3
bpo-40645: Deprecated internal details of hmac.HMAC (GH-20132) 2020-05-17 01:05:40 +02:00
Batuhan Taskaya dff92bb31f
bpo-38870: Implement round tripping support for typed AST in ast.unparse (GH-17797) 2020-05-17 00:04:12 +01:00
Batuhan Taskaya e966af7cff
bpo-38870: Correctly handle empty docstrings in ast.unparse (GH-18768)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-16 23:49:07 +01:00
Batuhan Taskaya d5a980a607
bpo-40165: Suppress stderr when checking if test_stty_match should be skipped (GH-19325) 2020-05-16 23:38:02 +01:00
Batuhan Taskaya 25160cdc47
bpo-38870: Don't put unnecessary parentheses on class declarations in ast.parse (GH-20134) 2020-05-16 22:53:25 +01:00
Batuhan Taskaya ce4a753dcb
bpo-38870: Do not separate factor prefixes in ast.unparse (GH-20133) 2020-05-16 22:46:11 +01:00
Christian Heimes d5b3f6b7f9
bpo-37630: Use SHA3 and SHAKE XOF from OpenSSL (GH-16049)
OpenSSL 1.1.1 comes with SHA3 and SHAKE builtin.

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

Automerge-Triggered-By: @tiran
2020-05-16 13:27:06 -07:00
Paul Ganssle 1b97b9b0ad
bpo-24416: Return named tuple from date.isocalendar() (GH-20113)
{date, datetime}.isocalendar() now return a private custom named tuple object
IsoCalendarDate rather than a simple tuple.

In order to leave IsocalendarDate as a private class and to improve what
backwards compatibility is offered for pickling the result of a
datetime.isocalendar() call, add a __reduce__ method to the named tuples that
reduces them to plain tuples. (This is the part of this PR most likely to cause
problems — if it causes major issues, switching to a strucseq or equivalent
would be prudent).

The pure python implementation of IsoCalendarDate uses positional-only
arguments, since it is private and only constructed by position anyway; the
equivalent change in the argument clinic on the C side would require us to move
the forward declaration of the type above the clinic import for whatever
reason, so it seems preferable to hold off on that for now.

bpo-24416: https://bugs.python.org/issue24416

Original PR by Dong-hee Na with only minor alterations by Paul Ganssle.

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2020-05-16 10:02:59 -04:00
Dong-hee Na aa92a7cf21
bpo-39305: Update nntplib to merge nntplib.NNTP and nntplib._NNTPBase (GH-19817) 2020-05-16 19:31:54 +09:00
Hai Shi 372fa3ead5
bpo-40275: lazy import modules in test.support (GH-20128)
Automerge-Triggered-By: @vstinner
2020-05-16 03:01:39 -07:00
Paul Ganssle 62972d9d73
bpo-40503: PEP 615: Tests and implementation for zoneinfo (GH-19909)
This is the initial implementation of PEP 615, the zoneinfo module,
ported from the standalone reference implementation (see
https://www.python.org/dev/peps/pep-0615/#reference-implementation for a
link, which has a more detailed commit history).

This includes (hopefully) all functional elements described in the PEP,
but documentation is found in a separate PR. This includes:

1. A pure python implementation of the ZoneInfo class
2. A C accelerated implementation of the ZoneInfo class
3. Tests with 100% branch coverage for the Python code (though C code
   coverage is less than 100%).
4. A compile-time configuration option on Linux (though not on Windows)

Differences from the reference implementation:

- The module is arranged slightly differently: the accelerated module is
  `_zoneinfo` rather than `zoneinfo._czoneinfo`, which also necessitates
  some changes in the test support function. (Suggested by Victor
  Stinner and Steve Dower.)
- The tests are arranged slightly differently and do not include the
  property tests. The tests live at test/test_zoneinfo/test_zoneinfo.py
  rather than test/test_zoneinfo.py or test/test_zoneinfo/__init__.py
  because we may do some refactoring in the future that would likely
  require this separation anyway; we may:
        - include the property tests
        - automatically run all the tests against both pure Python and C,
          rather than manually constructing C and Python test classes (similar
          to the way this works with test_datetime.py, which generates C
          and Python test cases from datetimetester.py).
- This includes a compile-time configuration option on Linux (though not
  on Windows); added with much help from Thomas Wouters.
- Integration into the CPython build system is obviously different from
  building a standalone zoneinfo module wheel.
- This includes configuration to install the tzdata package as part of
  CI, though only on the coverage jobs. Introducing a PyPI dependency as
  part of the CI build was controversial, and this is seen as less of a
  major change, since the coverage jobs already depend on pip and PyPI.

Additional changes that were introduced as part of this PR, most / all of
which were backported to the reference implementation:

- Fixed reference and memory leaks

    With much debugging help from Pablo Galindo

- Added smoke tests ensuring that the C and Python modules are built

    The import machinery can be somewhat fragile, and the "seamlessly falls
    back to pure Python" nature of this module makes it so that a problem
    building the C extension or a failure to import the pure Python version
    might easily go unnoticed.

- Adjustments to zoneinfo.__dir__

    Suggested by Petr Viktorin.

- Slight refactorings as suggested by Steve Dower.

- Removed unnecessary if check on std_abbr

    Discovered this because of a missing line in branch coverage.
2020-05-16 10:20:06 +02:00
Zackery Spytz 6b6092f533
bpo-39075: types.SimpleNamespace no longer sorts attributes in its repr (GH-19430) 2020-05-15 18:27:54 -07:00
Chris Jerdonek 1ce5841eca
bpo-31033: Add a msg argument to Future.cancel() and Task.cancel() (GH-19979) 2020-05-15 16:55:50 -07:00
Gregory P. Smith 6a5d3ff676
bpo-40636: Clarify the zip built-in docstring. (GH-20118)
Clarify the zip built-in docstring.

This puts much simpler text up front along with an example.

As it was, the zip built-in docstring was technically correct.  But too
technical for the reader who shouldn't _need_ to know about `__next__` and
`StopIteration` as most people do not need to understand the internal
implementation details of the iterator protocol in their daily life.

This is a documentation only change, intended to be backported to 3.8; it is
only tangentially related to PEP-618 which might offer new behavior options
in the future.

Wording based a bit more on enumerate per Brandt's suggestion.

This gets rid of the legacy wording paragraph which seems too tied to
implementation details of the iterator protocol which isn't relevant here.

Co-authored-by: Brandt Bucher <brandtbucher@gmail.com>
2020-05-15 14:26:00 -07:00
romasku 382a5635bd
bpo-40607: Reraise exception during task cancelation in asyncio.wait_for() (GH-20054)
Currently, if asyncio.wait_for() timeout expires, it cancels
inner future and then always raises TimeoutError. In case
those future is task, it can handle cancelation mannually,
and those process can lead to some other exception. Current
implementation silently loses thoses exception.

To resolve this, wait_for will check was the cancelation
successfull or not. In case there was exception, wait_for
will reraise it.

Co-authored-by: Roman Skurikhin <roman.skurikhin@cruxlab.com>
2020-05-15 13:12:05 -07:00
Victor Stinner 6e57237faf
bpo-40055: test_distutils leaves warnings filters unchanged (GH-20095)
distutils.tests now saves/restores warnings filters to leave them
unchanged. Importing tests imports docutils which imports
pkg_resources which adds a warnings filter.
2020-05-15 18:06:23 +02:00
Guido van Rossum 15bc9ab301
bpo-40612: Fix SyntaxError edge cases in traceback formatting (GH-20072)
This fixes both the traceback.py module and the C code for formatting syntax errors (in Python/pythonrun.c). They now both consistently do the following:

- Suppress caret if it points left of text
- Allow caret pointing just past end of line
- If caret points past end of line, clip to *just* past end of line

The syntax error formatting code in traceback.py was mostly rewritten; small, subtle changes were applied to the C code in pythonrun.c.

There's still a difference when the text contains embedded newlines. Neither handles these very well, and I don't think the case occurs in practice.

Automerge-Triggered-By: @gvanrossum
2020-05-14 19:22:48 -07:00
Pablo Galindo 16ab07063c
bpo-40334: Correctly identify invalid target in assignment errors (GH-20076)
Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
2020-05-15 02:04:52 +01:00
Joannah Nanjekye 7ba1f75f3f
bpo-38872: Document exec symbol for codeop.compile_command (GH-20047)
* Document exec symbol for codeop.compile_command

* Remove extra statements

Co-authored-by: nanjekyejoannah <joannah.nanjekye@ibm.com>
2020-05-14 21:59:46 -03:00
Victor Stinner 4b972faf60
bpo-40462: Fix typo in test_json (GH-20094) 2020-05-15 01:02:10 +02:00
Victor Stinner edf2643bbb
bpo-40460: Fix typo in idlelib/zzdummy.py (GH-20093)
Replace ztest with ztext.
2020-05-15 00:51:51 +02:00
Lysandros Nikolaou ce21cfca7b
bpo-40618: Disallow invalid targets in augassign and except clauses (GH-20083)
This commit fixes the new parser to disallow invalid targets in the
following scenarios:
- Augmented assignments must only accept a single target (Name,
  Attribute or Subscript), but no tuples or lists.
- `except` clauses should only accept a single `Name` as a target.

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-14 21:13:50 +01:00
Pablo Galindo bcc3036095
bpo-40619: Correctly handle error lines in programs without file mode (GH-20090) 2020-05-14 21:11:48 +01:00
Victor Stinner f2c3b6823b
Revert "bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)" (GH-20089)
* Revert "bpo-40613: Remove compiler warning from _xxsubinterpretersmodule (GH-20069)"

This reverts commit fa0a66e62d.

* Revert "bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)"

This reverts commit a1d9e0accd.
2020-05-14 18:46:24 +02:00
Lumír 'Frenzy' Balhar e77d428856
bpo-40495: compileall option to hardlink duplicate pyc files (GH-19901)
compileall is now able to use hardlinks to prevent duplicates in a
case when .pyc files for different optimization levels have the same content.

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-14 16:17:22 +02:00
Hai Shi 7443d42021
bpo-40275: Import locale module lazily in gettext (GH-19905) 2020-05-14 03:22:30 +02:00
Arkadiusz Hiler 6f2f475d5a
bpo-40597: email: Use CTE if lines are longer than max_line_length consistently (gh-20038)
raw_data_manager (default for EmailPolicy, EmailMessage)
does correct wrapping of 'text' parts as long as the message contains
characters outside of 7bit US-ASCII set: base64 or qp
Content-Transfer-Encoding is applied if the lines would be too long
without it.  It did not, however, do this for ascii-only text,
which could result in lines that were longer than
policy.max_line_length or even the rfc 998  maximum.

This changeset fixes the heuristic so that if lines are longer than
policy.max_line_length, it will always apply a
content-transfer-encoding so that the lines are wrapped correctly.
2020-05-13 20:53:26 -04:00
Chris Jerdonek 75cd8e48c6
bpo-29587: Make gen.throw() chain exceptions with yield from (GH-19858)
The previous commits on bpo-29587 got exception chaining working
with gen.throw() in the `yield` case. This patch also gets the
`yield from` case working.

As a consequence, implicit exception chaining now also works in
the asyncio scenario of awaiting on a task when an exception is
already active.

Tests are included for both the asyncio case and the pure
generator-only case.
2020-05-13 16:18:27 -07:00
Michael Graczyk d72ea60521
issue-25872: Fix KeyError using linecache from multiple threads (GH-18007)
The crash that this fixes occurs when using traceback and other modules from multiple threads; 
del cache[filename] can raise a KeyError.
2020-05-13 18:41:57 -04:00
Lysandros Nikolaou a15c9b3a05
bpo-40334: Always show the caret on SyntaxErrors (GH-20050)
This commit fixes SyntaxError locations when the caret is not displayed,
by doing the following:

- `col_number` always gets set to the location of the offending
  node/expr. When no caret is to be displayed, this gets achieved
  by setting the object holding the error line to None.

- Introduce a new function `_PyPegen_raise_error_known_location`,
  which can be called, when an arbitrary `lineno`/`col_offset`
  needs to be passed. This function then gets used in the grammar
  (through some new macros and inline functions) so that SyntaxError
  locations of the new parser match that of the old.
2020-05-13 20:36:27 +01:00
Tzanetos Balitsaris b809717c1e
bpo-40331: Increase test coverage for the statistics module (GH-19608) 2020-05-13 13:29:31 +03:00
Steve Dower d6b727e2c9
bpo-40501: Replace ctypes code in uuid with native module (GH-19948) 2020-05-12 23:32:32 +01:00
Serhiy Storchaka 5650e76f63
bpo-40596: Fix str.isidentifier() for non-canonicalized strings containing non-BMP characters on Windows. (GH-20053) 2020-05-12 16:18:00 +03:00
Serhiy Storchaka 74ea6b5a75
bpo-40593: Improve syntax errors for invalid characters in source code. (GH-20033) 2020-05-12 12:42:04 +03:00
Batuhan Taskaya f3a5b7ada0
bpo-39481: remove generic classes from ipaddress/mmap (GH-20045)
These were added by mistake (see https://bugs.python.org/issue39481#msg366288).
2020-05-11 19:32:40 -07:00
Tim Peters b1b4c790e7
bpo-40480: restore ability to join fnmatch.translate() results (GH-20049)
In translate(), generate unique group names across calls.

The restores the undocumented ability to get a valid regexp
by joining multiple translate() results via `|`.
2020-05-11 21:19:20 -05:00
Raymond Hettinger 21cdb711e3
bpo-40571: Make lru_cache(maxsize=None) more discoverable (GH-20019) 2020-05-11 17:00:53 -07:00
Shantanu 27c0d9b54a
bpo-40334: produce specialized errors for invalid del targets (GH-19911) 2020-05-11 14:53:58 -07:00
Brad Solomon ef7973a981
bpo-40561: Add docstrings for webbrowser open functions (GH-19999)
Co-authored-by: Brad Solomon <brsolomon@deloitte.com>
Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2020-05-11 14:50:11 -04:00
Pablo Galindo 5b956ca42d
bpo-40585: Normalize errors messages in codeop when comparing them (GH-20030)
With the new parser, the error message contains always the trailing
newlines, causing the comparison of the repr of the error messages
in codeop to fail. This commit makes the new parser mirror the old parser's
behaviour regarding trailing newlines.
2020-05-11 01:41:26 +01:00
Serhiy Storchaka 2fbc57af85
bpo-40257: Tweak docstrings for special generic aliases. (GH-20022)
* Add the terminating period.
* Omit module name for builtin types.
2020-05-10 15:14:27 +03:00
Serhiy Storchaka 0122d48681
bpo-40397: Fix subscription of nested generic alias without parameters. (GH-20021) 2020-05-10 13:39:40 +03:00
Serhiy Storchaka fcb285609a
bpo-40397: Remove __args__ and __parameters__ from _SpecialGenericAlias (GH-19984) 2020-05-10 11:53:16 +03:00
Pablo Galindo ac7a92cc0a
bpo-40334: Avoid collisions between parser variables and grammar variables (GH-19987)
This is for the C generator:
- Disallow rule and variable names starting with `_`
- Rename most local variable names generated by the parser to start with `_`

Exceptions:
- Renaming `p` to `_p` will be a separate PR
- There are still some names that might clash, e.g.
  - anything starting with `Py`
  - C reserved words (`if` etc.)
  - Macros like `EXTRA` and `CHECK`
2020-05-09 21:34:50 -07:00
Jason R. Coombs 2c3d508c5f
bpo-40570: Improve compatibility of uname_result with late-bound .platform (#20015)
* bpo-40570: Improve compatibility of uname_result with late-bound .platform.

* Add test capturing ability to cast uname to a tuple.
2020-05-09 10:12:41 -04:00
Jason R. Coombs 7f7e706d78
bpo-39791: Add files() to importlib.resources (GH-19722)
* bpo-39791: Update importlib.resources to support files() API (importlib_resources 1.5).

* 📜🤖 Added by blurb_it.

* Add some documentation about the new objects added.

Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2020-05-08 19:20:26 -04:00
Raymond Hettinger 81a5fc38e8
bpo-40541: Add optional *counts* parameter to random.sample() (GH-19970) 2020-05-08 07:53:15 -07:00
Zackery Spytz 02fa0ea9c1
bpo-40273: Reversible mappingproxy (FH-19513) 2020-05-07 22:25:50 -07:00
Pablo Galindo db9163ceef
bpo-40555: Check for p->error_indicator in loop rules after the main loop is done (GH-19986) 2020-05-08 03:38:44 +01:00
Eric Snow a1d9e0accd
bpo-32604: [_xxsubinterpreters] Propagate exceptions. (GH-19768)
(Note: PEP 554 is not accepted and the implementation in the code base is a private one for use in the test suite.)

If code running in a subinterpreter raises an uncaught exception then the "run" call in the calling interpreter fails. A RunFailedError is raised there that summarizes the original exception as a string. The actual exception type, __cause__, __context__, state, etc. are all discarded. This turned out to be functionally insufficient in practice. There is a more helpful solution (and PEP 554 has been updated appropriately).

This change adds the exception propagation behavior described in PEP 554 to the _xxsubinterpreters module. With this change a copy of the original exception is set to __cause__ on the RunFailedError. For now we are using "pickle", which preserves the exception's state. We also preserve the original __cause__, __context__, and __traceback__ (since "pickle" does not preserve those).

https://bugs.python.org/issue32604
2020-05-07 08:56:01 -06:00
Petr Viktorin e1becf46b4
bpo-38787: C API for module state access from extension methods (PEP 573) (GH-19936)
Module C state is now accessible from C-defined heap type methods (PEP 573).
Patch by Marcel Plch and Petr Viktorin.

Co-authored-by: Marcel Plch <mplch@redhat.com>
Co-authored-by: Victor Stinner <vstinner@python.org>
2020-05-07 15:39:59 +02:00
Lysandros Nikolaou 4638c64295
bpo-40334: Error message for invalid default args in function call (GH-19973)
When parsing something like `f(g()=2)`, where the name of a default arg
is not a NAME, but an arbitrary expression, a specialised error message
is emitted.
2020-05-07 11:44:06 +01:00
Lysandros Nikolaou 2f37c355ab
bpo-40334: Fix error location upon parsing an invalid string literal (GH-19962)
When parsing a string with an invalid escape, the old parser used to
point to the beginning of the invalid string. This commit changes the new
parser to match that behaviour, since it's currently pointing to the
end of the string (or to be more precise, to the beginning of the next
token).
2020-05-07 11:37:51 +01:00
Serhiy Storchaka c1c7d8ead9
bpo-40397: Refactor typing._GenericAlias (GH-19719)
Make the design more object-oriented.
Split _GenericAlias on two almost independent classes: for special
generic aliases like List and for parametrized generic aliases like List[int].
Add specialized subclasses for Callable, Callable[...], Tuple and Union[...].
2020-05-07 04:09:33 +03:00
Pablo Galindo 99db2a1db7
bpo-40334: Allow trailing comma in parenthesised context managers (GH-19964) 2020-05-06 22:54:34 +01:00
Batuhan Taskaya 091951a67c
bpo-40528: Improve and clear several aspects of the ASDL definition code for the AST (GH-19952) 2020-05-06 15:29:32 +01:00
Victor Stinner 2668a9a5aa
bpo-40527: Fix command line argument parsing (GH-19955) 2020-05-06 22:22:17 +09:00
Tim Peters b9c46a2c2d
bpo-40480 "fnmatch" exponential execution time (GH-19908)
bpo-40480:  create different regexps in the presence of multiple `*`
patterns to prevent fnmatch() from taking exponential time.
2020-05-05 21:28:24 -05:00
Pablo Galindo 96074de573
bpo-40523: Add pass-throughs for hash() and reversed() to weakref.proxy objects (GH-19946) 2020-05-05 22:58:19 +01:00
Dennis Sweeney 1253c3ef70
bpo-40504: Allow weakrefs to lru_cache objects (GH-19938) 2020-05-05 14:14:32 -07:00
Curtis Bucher c21c51235a
bpo-40355: Improve error messages in ast.literal_eval with malformed Dict nodes (GH-19868)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
2020-05-05 20:40:56 +01:00
Victor Stinner b0be6b3b94
bpo-29587: _PyErr_ChainExceptions() checks exception (GH-19902)
_PyErr_ChainExceptions() now ensures that the first parameter is an
exception type, as done by _PyErr_SetObject().

* The following function now check PyExceptionInstance_Check() in an
  assertion using a new _PyBaseExceptionObject_cast() helper
  function:

  * PyException_GetTraceback(), PyException_SetTraceback()
  * PyException_GetCause(), PyException_SetCause()
  * PyException_GetContext(), PyException_SetContext()

* PyExceptionClass_Name() now checks PyExceptionClass_Check() with an
  assertion.

* Remove XXX comment and add gi_exc_state variable to _gen_throw().

* Remove comment from test_generators
2020-05-05 17:07:41 +02:00
Dennis Sweeney 1e7e4519a8
bpo-40459: Fix NameError in platform.py (GH-19855) 2020-05-05 11:33:17 +09:00
Hai Shi 975408c065
bpo-40275: test.support imports lazily locale import (GH-19761) 2020-05-04 20:05:02 +02:00
Dong-hee Na 785f5e6d67
bpo-40489: Add test case for dict contain use after free (GH-19906) 2020-05-05 02:30:42 +09:00
Hai Shi caa3ef284a
bpo-40135: Fix multiprocessing test_shared_memory_across_processes() (GH-19892)
Don't define shared memory block's name in test_shared_memory_across_processes():
use SharedMemory(create=True) instead.
2020-05-04 17:05:54 +02:00