Commit Graph

44749 Commits

Author SHA1 Message Date
Miss Islington (bot) bee8bfe5f4
bpo-37212: Preserve keyword argument order in unittest.mock.call and error messages (GH-14310)
(cherry picked from commit 9d607061c9)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-09 04:42:43 -07:00
Miss Islington (bot) 87a5a331ea
bpo-36250: ignore ValueError from signal in non-main thread (GH-12251)
Authored-By: blueyed <github@thequod.de>
(cherry picked from commit 8d64bfafdf)

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-09 04:25:21 -07:00
Steve Dower eb02196bd9
bpo-11953: Extend table of Windows WSA* error codes (GH-15004) 2019-09-09 03:36:04 -07:00
Miss Islington (bot) ebca7eb093
bpo-32587: Make winreg.REG_MULTI_SZ support zero-length strings (GH-13239)
* bpo-32587: Make winreg.REG_MULTI_SZ support PendingFileRenameOperations

* Address review comments.
(cherry picked from commit e223ba13d8)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-09 03:11:00 -07:00
Miss Islington (bot) 6e3809c7ce
bpo-34410: Fix a crash in the tee iterator when re-enter it. (GH-15625)
RuntimeError is now raised in this case.
(cherry picked from commit 526a01467b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-09 02:07:51 -07:00
Raymond Hettinger cc1bdf91d5
[3.8] bpo-36018: Address more reviewer feedback (GH-15733) (GH-15734) 2019-09-08 18:40:06 -07:00
Miss Islington (bot) 4009a8522d
bpo-38041: Refine IDLE Shell restart lines. (GH-15709)
Restart lines now always start with '=' and never end with ' ' and fill the width of the window unless that would require ending with ' ', which could be wrapped by itself and possible confusing the user.
(cherry picked from commit 38da805d56)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-06 11:14:49 -07:00
Miss Islington (bot) 4d1abedce9 bpo-37380: subprocess: don't use _active on win (GH-14360) (GH-15707)
As noted by @eryksun in [1] and [2], using _cleanup and _active(in
__del__) is not necessary on Windows, since:

> Unlike Unix, a process in Windows doesn't have to be waited on by
> its parent to avoid a zombie. Keeping the handle open will actually
> create a zombie until the next _cleanup() call, which may be never
> if Popen() isn't called again.

This patch simply defines `subprocess._active` as `None`, for which we already
have the proper logic in place in `subprocess.Popen.__del__`, that prevents it
from trying to append the process to the `_active`. This patch also defines
`subprocess._cleanup` as a noop for Windows.

[1] https://bugs.python.org/issue37380GH-msg346333
[2] https://bugs.python.org/issue36067GH-msg336262

Signed-off-by: Ruslan Kuprieiev <ruslan@iterative.ai>
(cherry picked from commit 042821ae3c)

Co-authored-by: Ruslan Kuprieiev <kupruser@gmail.com>
2019-09-06 11:14:31 +02:00
Miss Islington (bot) dafbe32656 bpo-36324: Apply review comments from Allen Downey (GH-15693) (GH-15694)
(cherry picked from commit e4810b2a6c)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-09-05 00:42:22 -07:00
Miss Islington (bot) bdcbb83c66
bpo-38026: fix inspect.getattr_static (GH-15676)
It should avoid dynamic lookup including `isinstance`.

This is a regression caused by GH-5351.
(cherry picked from commit 8f9cc8771f)

Co-authored-by: Inada Naoki <songofacandy@gmail.com>
2019-09-04 21:25:59 -07:00
Miss Islington (bot) 9c2654d1aa
bpo-37902: IDLE: Add scrolling for IDLE browsers. (GH-15368)
Modify the wheel event handler so it can also be used for module, path, and stack browsers.
Patch by George Zhang.
(cherry picked from commit 2cd9025858)

Co-authored-by: GeeTransit <geetransit@gmail.com>
2019-09-04 18:53:47 -07:00
Abhilash Raj 6ad0a2c45f
[3.8] bpo-37764: Fix infinite loop when parsing unstructured email headers. (GH-15239) (GH-15686)
Fixes a case in which email._header_value_parser.get_unstructured hangs the system for some invalid headers. This covers the cases in which the header contains either:
- a case without trailing whitespace
- an invalid encoded word

https://bugs.python.org/issue37764

This fix should also be backported to 3.7 and 3.8

https://bugs.python.org/issue37764
(cherry picked from commit c5b242f87f)

Co-authored-by: Ashwin Ramaswami <aramaswamis@gmail.com>
2019-09-04 18:20:40 -07:00
Miss Islington (bot) 6d7a786d2e
bpo-22347: Update mimetypes.guess_type to allow proper parsing of URLs (GH-15522)
https://bugs.python.org/issue22347
(cherry picked from commit 87bd2071c7)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-09-04 17:54:59 -07:00
Miss Islington (bot) 29825a3392
Fix idlelib.help comments (GH-15669)
(cherry picked from commit 6cd9666ce9)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-04 17:39:34 -07:00
Miss Islington (bot) cad7abf8ab
bpo-38030: Fix os.stat failures on block devices on Windows (GH-15681)
(cherry picked from commit 772ec0fad5)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-04 15:18:05 -07:00
Miss Islington (bot) 4dd1c9d9c2
closes bpo-37966: Fully implement the UAX GH-15 quick-check algorithm. (GH-15558)
The purpose of the `unicodedata.is_normalized` function is to answer
the question `str == unicodedata.normalized(form, str)` more
efficiently than writing just that, by using the "quick check"
optimization described in the Unicode standard in UAX GH-15.

However, it turns out the code doesn't implement the full algorithm
from the standard, and as a result we often miss the optimization and
end up having to compute the whole normalized string after all.

Implement the standard's algorithm.  This greatly speeds up
`unicodedata.is_normalized` in many cases where our partial variant
of quick-check had been returning MAYBE and the standard algorithm
returns NO.

At a quick test on my desktop, the existing code takes about 4.4 ms/MB
(so 4.4 ns per byte) when the partial quick-check returns MAYBE and it
has to do the slow normalize-and-compare:

  $ build.base/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  50 loops, best of 5: 4.39 msec per loop

With this patch, it gets the answer instantly (58 ns) on the same 1 MB
string:

  $ build.dev/python -m timeit -s 'import unicodedata; s = "\uf900"*500000' \
      -- 'unicodedata.is_normalized("NFD", s)'
  5000000 loops, best of 5: 58.2 nsec per loop

This restores a small optimization that the original version of this
code had for the `unicodedata.normalize` use case.

With this, that case is actually faster than in master!

$ build.base/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 561 usec per loop

$ build.dev/python -m timeit -s 'import unicodedata; s = "\u0338"*500000' \
    -- 'unicodedata.normalize("NFD", s)'
500 loops, best of 5: 512 usec per loop
(cherry picked from commit 2f09413947)

Co-authored-by: Greg Price <gnprice@gmail.com>
2019-09-03 20:03:37 -07:00
Miss Islington (bot) 952ea67289
bpo-38022: IDLE: upgrade help.html to sphinx 2.x HTML5 output (GH-15664)
The HTML5 output from Sphinx 2.x adds  '<p>' tags within list elements.  Using a new prevtag attribute, ignore these instead of emitting unwanted '\n\n'.

Also stop looking for 'first' classes on tags (no longer present) and fix the bug of double-spacing instead of single spacing after <pre> blocks.
(cherry picked from commit 580bdb0ece)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-09-03 14:18:45 -07:00
Ashwin Ramaswami 59e8fba718 [3.8] bpo-21315: Fix parsing of encoded words with missing leading ws (GH-13425) (GH-15655)
* [bpo-21315](https://bugs.python.org/issue21315): Fix parsing of encoded words with missing leading ws.

Because of missing leading whitespace, encoded word would get parsed as
unstructured token. This patch fixes that by looking for encoded words when
splitting tokens with whitespace.

Missing trailing whitespace around encoded word now register a defect
instead.

Original patch suggestion by David R. Murray on [bpo-21315](https://bugs.python.org/issue21315).
(cherry picked from commit 66c4f3f38b)

Co-authored-by: Abhilash Raj <maxking@users.noreply.github.com>
(cherry picked from commit dc20fc4311)

Co-authored-by: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com>





https://bugs.python.org/issue21315
2019-09-03 10:08:39 -07:00
Miss Islington (bot) 1c18aec3bb
bpo-35771: IDLE: Fix flaky tool-tip hover delay tests (GH-15634)
Extending the hover delay in test_tooltip should avoid spurious test_idle failures.
One longer delay instead of two shorter delays results in a net speedup.
(cherry picked from commit 132acaba5a)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-09-02 22:39:08 -07:00
Miss Islington (bot) bf69e160c4 bpo-38010 Sync importlib.metadata with importlib_metadata 0.20. (GH-15646) (GH-15648)
Sync importlib.metadata with importlib_metadata 0.20.
(cherry picked from commit 102e9b40ff)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-02 12:11:01 -04:00
Raymond Hettinger bd8ca9aacc
[3.8] bpo-29553: Fix ArgumentParser.format_usage() for mutually exclusive groups (GH-14976) (GH-15494) (GH-15624) 2019-08-30 15:25:38 -07:00
Miss Islington (bot) 4bd1d05ee2
Fix typos mostly in comments, docs and test names (GH-15209)
(cherry picked from commit 39d87b5471)

Co-authored-by: Min ho Kim <minho42@gmail.com>
2019-08-30 13:42:54 -07:00
Miss Islington (bot) 3d75857dfa
IDLE: Fix 2 typos found by Min ho Kim. (GH-15617)
(cherry picked from commit 15119bc2a7)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-30 13:36:06 -07:00
Miss Islington (bot) 17f61ed25a
bpo-37140: Fix StructUnionType_paramfunc() (GH-15612)
Fix a ctypes regression of Python 3.8. When a ctypes.Structure is
passed by copy to a function, ctypes internals created a temporary
object which had the side effect of calling the structure finalizer
(__del__) twice. The Python semantics requires a finalizer to be
called exactly once. Fix ctypes internals to no longer call the
finalizer twice.

Create a new internal StructParam_Type which is only used by
_ctypes_callproc() to call PyMem_Free(ptr) on Py_DECREF(argument).
StructUnionType_paramfunc() creates such object.
(cherry picked from commit 96b4087ce7)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-08-30 05:50:44 -07:00
Łukasz Langa 23d532a435 Python 3.8.0b4
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE4/8oOcBIslwITevpsmmV4xAlBWgFAl1oSsoACgkQsmmV4xAl
 BWiZ2w/9EGp9XonU8NCJShlmjmat3q1S1FKQD69W4817cQRNtj8Lv6UP17epkVtX
 8ASRA5IdUuMhU30A6eUMmk0HmVjTDvxQTCpC0qSa1gDxd6vysydTDOmxyoRExR5R
 secZIYswJVsKUGyiR0+aOaOqDJSS4zUMLttdBeiEKwZEXyXntqOStB3nx/lURKkM
 wLzQM0N7HQKvqY9lc3ANQ12LcD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1d2fq0gxXPIf8+oXOqhlZ3TypnFuQKtEMU0htytvVVvEtJo
 PTs0mGxLq56/bvAE56lLuW5wJLXJOGZ9JSW6HqiYNEcEcotwY/RvraQ4TuTwHu5f
 /ZKIzAYJ+WwalVQDXky6rUd4xFOiQ0xeAz+hvdRAf9RtIMfOQUGQz8pv0x6m5ULO
 FBRJArkT+OYpAODFJDg1dvy1PWKSb9RRZC1HoZx1Hgk92hUtpliVQ/Rmh7jpE+0G
 M6l5t87ofA==
 =hIaU
 -----END PGP SIGNATURE-----

Merge tag 'v3.8.0b4' into 3.8

Python 3.8.0b4
2019-08-30 11:01:00 +02:00
Miss Islington (bot) 27f418640c bpo-37976: Prevent shadowing of TypeError in zip() (GH-15592) (GH-15608)
(cherry picked from commit 6a650aaf77)

Co-authored-by: Sergey Fedoseev <fedoseev.sergey@gmail.com>
2019-08-29 23:23:17 -07:00
Miss Islington (bot) c19d6bca55 Steven Bethard designated a new maintainer for argparse (GH-15605) (GH-15606)
(cherry picked from commit 496058f599)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-29 21:27:33 -07:00
Łukasz Langa d93605de72
Python 3.8.0b4 2019-08-29 23:59:20 +02:00
Łukasz Langa 25a044ee6c
[3.8] bpo-37834: Prevent shutil.rmtree exception (GH-15602) (#15603)
when built on non-Windows system without fd system call support,
like older versions of macOS.
(cherry picked from commit 7fcc2088a5)

Co-authored-by: Ned Deily <nad@python.org>
2019-08-29 23:51:19 +02:00
Serhiy Storchaka 96631dcb11
[3.8] bpo-37034: Display argument name on errors with keyword arguments with Argument Clinic. (GH-13593). (GH-15599)
(cherry picked from commit 4901fe274b)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-08-29 18:29:59 +03:00
Miss Islington (bot) c71ae1a45b bpo-36743: __get__ is sometimes called without the owner argument (GH-12992) (GH-15589)
(cherry picked from commit 0dac68f1e5)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
2019-08-29 02:02:51 -07:00
Miss Islington (bot) 102130a63c
bpo-37960: Silence only necessary errors in repr() of buffered and text streams. (GH-15543)
(cherry picked from commit b235a1b473)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-08-29 01:13:29 -07:00
Miss Islington (bot) d1d42bf4a4
bpo-37372: Fix error unpickling datetime.time objects from Python 2 with seconds>=24. (GH-14307)
(cherry picked from commit 122376df55)

Co-authored-by: Justin Blanchard <UncombedCoconut@gmail.com>
2019-08-29 00:56:04 -07:00
Serhiy Storchaka 097eae5b9b
[3.8] bpo-37950: Fix ast.dump() when call with incompletely initialized node. (GH-15510) (GH-15582)
(cherry picked from commit e64f948e76)
2019-08-29 10:50:28 +03:00
Miss Islington (bot) 38d311d79e bpo-36871: Ensure method signature is used when asserting mock calls to a method (GH15578)
* Fix call_matcher for mock when using methods

* Add NEWS entry

* Use None check and convert doctest to unittest

* Use better name for mock in tests. Handle _SpecState when the attribute was not accessed and add tests.

* Use reset_mock instead of reinitialization. Change inner class constructor signature for check

* Reword comment regarding call object lookup logic
(cherry picked from commit c96127821e)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-08-29 07:58:27 +01:00
Miss Islington (bot) 612d3935ec
bpo-35946: Improve assert_called_with documentation (GH-11796)
(cherry picked from commit f5896a05ed)

Co-authored-by: Rémi Lapeyre <remi.lapeyre@henki.fr>
2019-08-28 23:39:47 -07:00
Miss Islington (bot) 4adcaf8151 bpo-34775: Return NotImplemented in PurePath division. (GH-9509) (GH-15172)
(cherry picked from commit 4c69be22df)

Co-authored-by: aiudirog <aiudirog@gmail.com>
2019-08-29 01:05:59 -04:00
Miss Islington (bot) e471a543a4
bpo-18378: Recognize "UTF-8" as a valid name in locale._parse_localename (GH-14736)
(cherry picked from commit b0caf32981)

Co-authored-by: Ronald Oussoren <ronaldoussoren@mac.com>
2019-08-28 21:56:00 -07:00
bsiem bd127b1b7d [3.8] bpo-37482: Fix email address name with encoded words and special chars (GH-14561) (GH-15380)
Special characters in email address header display names are normally
put within double quotes. However, encoded words (=?charset?x?...?=) are
not allowed withing double quotes. When the header contains a word with
special characters and another word that must be encoded, the first one
must also be encoded.

In the next example, the display name in the From header is quoted and
therefore the comma is allowed; in the To header, the comma is not
within quotes and not encoded, which is not allowed and therefore
rejected by some mail servers.

From: "Foo Bar, France" <foo@example.com>
To: Foo Bar, =?utf-8?q?Espa=C3=B1a?= <foo@example.com>

https://bugs.python.org/issue37482
(cherry picked from commit df0c21ff46)

Co-authored-by: bsiem <52461103+bsiem@users.noreply.github.com>
2019-08-29 00:47:15 -04:00
Miss Islington (bot) 23985c6a64 closes bpo-37965: Fix compiler warning of distutils CCompiler.test_function. (GH-15561)
https://bugs.python.org/issue37965

https://bugs.python.org/issue37965

Automerge-Triggered-By: @benjaminp
(cherry picked from commit 55aabee075)

Co-authored-by: Anonymous Maarten <madebr@users.noreply.github.com>
2019-08-28 10:32:34 -07:00
Miss Islington (bot) 2cb82d2a88 bpo-36582: Make collections.UserString.encode() return bytes, not str (GH-13138) (GH-15557)
(cherry picked from commit 2a16eea71f)

Co-authored-by: Daniel Fortunov <asqui@users.noreply.github.com>
2019-08-27 21:59:54 -07:00
Miss Islington (bot) c75f0e5bde
Fix an invalid assertEqual() call in test_descr.py (GH-15318)
(cherry picked from commit 6b2e3256b6)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-08-26 16:02:21 -07:00
Steve Dower 04b750740b
bpo-37664: Update ensurepip bundled wheels, again (GH-15483) 2019-08-26 12:57:57 -07:00
Miss Islington (bot) 69d22b8fee
bpo-34679: Restore instantiation Windows IOCP event loop from non-main thread (GH-15492)
* Restore running proactor event loop from non-main thread

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
(cherry picked from commit 1c06009986)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-08-26 03:14:54 -07:00
Miss Islington (bot) 522a394a72 [3.8] bpo-36917: Add default implementation of ast.NodeVisitor.visit_Constant(). (GH-15490) (GH-15509)
It emits a deprecation warning and calls corresponding method
visit_Num(), visit_Str(), etc.
(cherry picked from commit c3ea41e9bf)
2019-08-26 10:43:33 +03:00
Miss Islington (bot) a3875171d7
bpo-37805: Add tests for json.dump(..., skipkeys=True) (GH-15489)
https://bugs.python.org/issue37805

Automerge-Triggered-By: @methane
(cherry picked from commit 44cd86bbdd)

Co-authored-by: Dong-hee Na <donghee.na92@gmail.com>
2019-08-26 00:27:31 -07:00
Miss Islington (bot) 077887059a bpo-37824: Properly handle user input warnings in IDLE shell. (GH-15500)
Cease turning SyntaxWarnings into SyntaxErrors.
(cherry picked from commit 1039f39c9c)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-08-26 02:52:45 -04:00
Nick Coghlan 6ca030765d
[3.8] bpo-37757: Disallow PEP 572 cases that expose implementation details (GH-15491)
- drop TargetScopeError in favour of raising SyntaxError directly
  as per the updated PEP 572
- comprehension iteration variables are explicitly local, but
  named expression targets in comprehensions are nonlocal or
  global. Raise SyntaxError as specified in PEP 572
- named expression targets in the outermost iterable of a
  comprehension have an ambiguous target scope. Avoid resolving
  that question now by raising SyntaxError. PEP 572
  originally required this only for cases where the bound name
  conflicts with the iteration variable in the comprehension,
  but CPython can't easily restrict the exception to that case
  (as it doesn't know the target variable names when visiting
  the outermost iterator expression)

(cherry picked from commit 5dbe0f59b7)
2019-08-26 00:41:47 +10:00
Miss Islington (bot) e266d062e0
bpo-37929: IDLE: avoid Squeezer-related config dialog crashes (GH-15452)
These were caused by keeping around a reference to the Squeezer
instance and calling it's load_font() upon config changes, which
sometimes happened even if the shell window no longer existed.

This change completely removes that mechanism, instead having the
editor window properly update its width attribute, which can then
be used by Squeezer.
(cherry picked from commit d4b4c00b57)

Co-authored-by: Tal Einat <taleinat+github@gmail.com>
2019-08-24 23:18:01 -07:00
Raymond Hettinger 21161d73d9
[3.8] bpo-37942: Improve argument clinic float converter (GH-15470) (GH-15480)
(cherry picked from commit aef9ad82f7)
2019-08-24 19:45:12 -07:00