Commit Graph

22467 Commits

Author SHA1 Message Date
Miss Islington (bot) 29bde48ade
bpo-38077: IDLE no longer adds 'argv' to the user namespace (GH-15818)
This only happened when initializing the subprocess to run a module.
This recent bug only affected 3.7.4 and 3.8.0b2 to 3.8.0b4.
(cherry picked from commit c59295a1ca)

Co-authored-by: Terry Jan Reedy <tjreedy@udel.edu>
2019-09-09 20:29:01 -07:00
Zachary Ware 99df5e8373
[3.8] bpo-34293: Fix PDF documentation paper size (GH-8585) (GH-15816)
The "A4" pdfs were previously the wrong size due to a change in the options in Sphinx 1.5.

See also sphinx-doc/sphinxGH-5235
(cherry picked from commit b5381f6697)

Authored-by: Jean-François B <jfbu@free.fr>
2019-09-09 23:11:23 +01:00
Miss Islington (bot) eadf6b8787
bpo-35803: Document and test dir=PathLike for tempfile (GH-11644)
Co-Authored-By: Ammar Askar <ammar_askar@hotmail.com>
(cherry picked from commit 370138ba9c)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2019-09-09 10:31:31 -07:00
Steve Dower 2d5594fac2
bpo-20490: Improve circular import error message (GH-15308) 2019-09-09 09:45:18 -07:00
Miss Islington (bot) 78d15faf6c
bpo-38006: Avoid closure in weakref.WeakValueDictionary (GH-15641)
weakref.WeakValueDictionary defines a local remove() function used as
callback for weak references. This function was created with a
closure.  Modify the implementation to avoid the closure.
(cherry picked from commit a2af05a0d3)

Co-authored-by: Victor Stinner <vstinner@redhat.com>
2019-09-09 09:24:16 -07:00
Miss Islington (bot) b6ef8f2beb
bpo-37876: Tests for ROT-13 codec (GH-15314)
The Rot-13 codec is for educational use but does not have unit tests,
dragging down test coverage. This adds a few very simple tests.
(cherry picked from commit b3b48c81f0)

Co-authored-by: Zeth <theology@gmail.com>
2019-09-09 09:12:01 -07:00
Miss Islington (bot) 0d4396c04c
bpo-38059: Using sys.exit() over exit() in inspect.py (GH-15666)
Constants added by the site module like exit() "should not be used in programs"
(cherry picked from commit e3c59a7527)

Co-authored-by: Alan Yee <alanyee@users.noreply.github.com>
2019-09-09 08:20:36 -07:00
Miss Islington (bot) 3bd4bed78a bpo-34596: Fallback to a default reason when @unittest.skip is uncalled (GH-9082) (#15781)
* bpo-34596: Fallback to a default reason when @unittest.skip is uncalled

* Change default reason to empty string

* Fix rst formatting of NEWS entry
(cherry picked from commit d5fd75c53f)

Co-authored-by: Naitree Zhu <Naitreey@gmail.com>
2019-09-09 17:01:14 +02:00
Miss Islington (bot) cabcbbe7a5 bpo-36797: Fix a dead link in Doc/distutils/apiref (GH-15700) (GH-15704)
https://bugs.python.org/issue36797
(cherry picked from commit 2c2b561967)

Co-authored-by: Miro Hrončok <miro@hroncok.cz>
2019-09-09 16:52:34 +02:00
Miss Islington (bot) b150d0bf1b
bpo-38037: Fix reference counters in signal module (GH-15753)
(cherry picked from commit 77643c486f)

Co-authored-by: animalize <animalize@users.noreply.github.com>
2019-09-09 07:42:35 -07:00
Steve Dower 5d695b6b7b
bpo-37702: Fix SSL's certificate-store leak on Windows (GH-15632)
ssl_collect_certificates function in _ssl.c has a memory leak.
Calling CertOpenStore() and CertAddStoreToCollection(), a store's refcnt gets incremented by 2.
But CertCloseStore() is called only once and the refcnt leaves 1.
2019-09-09 06:48:22 -07:00
Miss Islington (bot) 2a4a982cbc
bpo-37283: Ensure command-line and unattend.xml setting override previously detected states in Windows installer (GH-15759)
(cherry picked from commit 3a0ddbcdfc)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-09 06:02:42 -07:00
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
Miss Islington (bot) 68e401fa0b
bpo-37705: Improve the implementation of winerror_to_errno() (GH-15623)
winerror_to_errno() is no longer automatically generated.
Do not rely on the old _dosmapperr() function.
Add ERROR_NO_UNICODE_TRANSLATION (1113) -> EILSEQ.
(cherry picked from commit 19052a1131)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-09 03:37:55 -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) c837ad408e
bpo-37936: Avoid ignoring files that we actually do track. (GH-15451)
There were about 14 files that are actually in the repo but that are
covered by the rules in .gitignore.

Git itself takes no notice of what .gitignore says about files that
it's already tracking... but the discrepancy can be confusing to a
human that adds a new file unexpectedly covered by these rules, as
well as to non-Git software that looks at .gitignore but doesn't
implement this wrinkle in its semantics.  (E.g., `rg`.)

Several of these are from rules that apply more broadly than
intended: for example, `Makefile` applies to `Doc/Makefile` and
`Tools/freeze/test/Makefile`, whereas `/Makefile` means only the
`Makefile` at the repo's root.

And the `Modules/Setup` rule simply wasn't updated after 961d54c5c.

https://bugs.python.org/issue37936
(cherry picked from commit 5e5e951502)

Co-authored-by: Greg Price <gnprice@gmail.com>
2019-09-09 03:25: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
Zachary Ware 14f7de72b6
[3.8] bpo-15817: gdbinit: Document commands after defining them (GH-15021) (#15744)
The gdb manual[1] says the following for "document":

  The command commandname must already be defined.

[1] https://sourceware.org/gdb/current/onlinedocs/gdb/Define.html

And indeed when trying to use the gdbinit file with gdb 8.3, I get:

  .../cpython/Misc/gdbinit:17: Error in sourced command file:
  Undefined command: "pyo".  Try "help".

Fix this by moving all documentation blocks after the define blocks.

This was introduced in GH-6384.
(cherry picked from commit 1f86fdcfc5)

Authored-by: Florian Bruhin <me@the-compiler.org>
2019-09-09 04:56:38 -05:00
Miss Islington (bot) e103732f5d
bpo-37445: Include FORMAT_MESSAGE_IGNORE_INSERTS in FormatMessageW() calls (GH-14462)
If FormatMessageW() is passed the FORMAT_MESSAGE_FROM_SYSTEM flag without FORMAT_MESSAGE_IGNORE_INSERTS, it will fail if there are insert sequences in the message definition.
(cherry picked from commit a6563650c8)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-09 02:50:30 -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
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) 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) 54dac6c0f4
bpo-38020: Fixes crash in os.readlink() on Windows (GH-15663)
(cherry picked from commit 993ac92418)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-03 13:13:41 -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
Serhiy Storchaka 353053d9ad
[3.8] bpo-37994: Fix silencing all errors if an attribute lookup fails. (GH-15630) (GH-15635)
Only AttributeError should be silenced.
(cherry picked from commit 41c57b3353)
2019-09-01 14:01:05 +03:00
Miss Islington (bot) 6922b9e4fc bpo-37977: Warn more strongly and clearly about pickle security (GH-15595) (GH-15629)
(cherry picked from commit daa82d019c)

Co-authored-by: Daniel Pope <lordmauve@users.noreply.github.com>
2019-08-30 23:02:15 -07:00
Inada Naoki 97a31c7b48
[3.8] bpo-37990: fix gc stats (GH-15626)
(cherry picked from commit 013e52f)
2019-08-31 10:50:27 +09: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) 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 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) 9db66a2b5a
bpo-37979: Add alternative to fromisoformat in documentation (GH-15596)
Adds a link to `dateutil.parser.isoparse` in the documentation.

It would be nice to set up intersphinx for things like this, but I think we can leave that for a separate PR.

CC: @pitrou

[bpo-37979](https://bugs.python.org/issue37979)

https://bugs.python.org/issue37979

Automerge-Triggered-By: @pitrou
(cherry picked from commit 59725f3bad)

Co-authored-by: Paul Ganssle <paul@ganssle.io>
2019-08-29 07:54:37 -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) f92bb6ed33
bpo-18049: Define THREAD_STACK_SIZE for AIX to pass default recursion limit test (GH-15081)
* Define THREAD_STACK_SIZE for AIX to pass default recursion limit test
(cherry picked from commit 9670ce76b8)

Co-authored-by: Michael Felt <aixtools@users.noreply.github.com>
2019-08-28 22:35:41 -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