Commit Graph

105379 Commits

Author SHA1 Message Date
Steve Dower f2b7556ef8 bpo-38092: Reduce overhead when using multiprocessing in a Windows virtual environment (GH-16098)
https://bugs.python.org/issue38092
2019-09-13 09:40:19 -07:00
Gregory P. Smith 5b9ff7a0dc
bpo-34706: Preserve subclassing in inspect.Signature.from_callable (GH-16108)
https://bugs.python.org/issue34706

Specifically in the case of a class that does not override its
constructor signature inherited from object.

These are Buck Evan @bukzor's changes cherrypicked from GH-9344.
2019-09-13 17:13:51 +01:00
Joannah Nanjekye 2ccb50cf77 bpo-37449: Move ensurepip off of pkgutil and to importlib.resources (GH-15109)
Move ensurepip off of pkgutil and to importlib.resources.


https://bugs.python.org/issue37449
2019-09-13 09:01:20 -07:00
Elizabeth Uselton d6a9d17d8b bpo-37555: Update _CallList.__contains__ to respect ANY (#14700)
* Flip equality to use mock calls' __eq__

* bpo-37555: Regression test demonstrating assert_has_calls not working with ANY and spec_set

Co-authored-by: Neal Finne <neal@nealfinne.com>

* Revert "Flip equality to use mock calls' __eq__"

This reverts commit 94ddf54c5a.

* bpo-37555: Add regression tests for mock ANY ordering issues

Add regression tests for whether __eq__ is order agnostic on _Call and _CallList, which is useful for comparisons involving ANY, especially if the ANY comparison is to a class not defaulting __eq__ to NotImplemented.

Co-authored-by: Neal Finne <neal@nealfinne.com>

* bpo-37555: Fix _CallList and _Call order sensitivity

_Call and _CallList depend on ordering to correctly process that an object being compared to ANY with __eq__ should return True. This fix updates the comparison to check both a == b and b == a and return True if either condition is met, fixing situations from the tests in the previous two commits where assertEqual would not be commutative if checking _Call or _CallList objects. This seems like a reasonable fix considering that the Python data model specifies that if an object doesn't know how to compare itself to another object it should return NotImplemented, and that on getting NotImplemented from a == b, it should try b == a, implying that good behavior for __eq__ is commutative. This also flips the order of comparison in _CallList's __contains__ method, guaranteeing ANY will be on the left and have it's __eq__ called for equality checking, fixing the interaction between assert_has_calls and ANY.

Co-author: Neal Finne <neal@neal.finne.com>

* bpo-37555: Ensure _call_matcher returns _Call object

* Adding ACK and news entry

* bpo-37555: Replacing __eq__ with == to sidestep NotImplemented

bool(NotImplemented) returns True, so it's necessary to use ==
instead of __eq__ in this comparison.

* bpo-37555: cleaning up changes unnecessary to the final product

* bpo-37555: Fixed call on bound arguments to respect args and kwargs

* Revert "bpo-37555: Add regression tests for mock ANY ordering issues"

This reverts commit 49c5310ad4.

* Revert "bpo-37555: cleaning up changes unnecessary to the final product"

This reverts commit 18e964ba01.

* Revert "bpo-37555: Replacing __eq__ with == to sidestep NotImplemented"

This reverts commit f295eaca5b.

* Revert "bpo-37555: Fix _CallList and _Call order sensitivity"

This reverts commit 874fb697b8.

* Updated NEWS.d

* bpo-37555: Add tests checking every function using _call_matcher both with and without spec

* bpo-37555: Ensure all assert methods using _call_matcher are actually passing calls

* Remove AnyCompare and use call objects everywhere.

* Revert "Remove AnyCompare and use call objects everywhere."

This reverts commit 24973c0b32.

* Check for exception in assert_any_await
2019-09-13 16:54:32 +01:00
Zackery Spytz 81319a81b2 bpo-37199: Replace the early returns added in c2cda63. (GH-14535) 2019-09-13 16:53:13 +01:00
Benjamin Peterson f3095b0b58
Run autoreconf. (GH-16106) 2019-09-13 15:30:36 +01:00
Zackery Spytz b761e3aed1 bpo-25068: urllib.request.ProxyHandler now lowercases the dict keys (GH-13489) 2019-09-13 15:07:07 +01:00
Gregory P. Smith 693aa80a43 bpo-36046: Fix buildbot failures (GH-16091)
Varying user/group/permission check needs on platforms.
2019-09-13 14:43:35 +01:00
Doyle Rowland 0519d497b0 closes bpo-36002: Use AC_PATH_TOOL to find llvm-profdata and llvm-ar. (GH-14998) 2019-09-13 14:38:07 +01:00
Gregory P. Smith 0765411d51 Adjust code ownership so @gpshead don't get asyncio subprocess PRs. (GH-16100) 2019-09-13 14:36:26 +01:00
Windson yang 9585f46b97 bpo-26468: Doc: improve the documentation of shutil.copy2 when it can fail. (GH-13765) 2019-09-13 14:36:09 +01:00
Christian Heimes 995b5d38e7 bpo-38153: Normalize hashlib algorithm names (GH-16083)
Signed-off-by: Christian Heimes <christian@python.org>
2019-09-13 14:31:19 +01:00
Julien Palard 375a3e2bdb
bpo-29986: Doc: Delete tip to raise TypeError from tp_richcompare. (GH-16095) 2019-09-13 15:07:37 +02:00
Kexuan Sun 53f78ec9e1 Doc: Improve consistency of os.path.normcase with other os.path functions (GH-14004) 2019-09-13 14:01:02 +01:00
Andrew Svetlov 9eb35ab0d7
bpo-38148: Add slots to asyncio transports (GH-16077)
* bpo-38148: Add slots to asyncio transports

* Update Misc/NEWS.d/next/Library/2019-09-13-08-55-43.bpo-38148.Lnww6D.rst

Co-Authored-By: Kyle Stanley <aeros167@gmail.com>
2019-09-13 15:18:46 +03:00
Ashwin Ramaswami ff2e182865 bpo-12707: deprecate info(), geturl(), getcode() methods in favor of headers, url, and status properties for HTTPResponse and addinfourl (GH-11447)
Co-Authored-By: epicfaace <aramaswamis@gmail.com>
2019-09-13 12:40:07 +01:00
Xtreak bb41147eab bpo-12144: Handle cookies with expires attribute in CookieJar.make_cookies (GH-13921)
Handle time comparison for cookies with `expires` attribute when `CookieJar.make_cookies` is called.

Co-authored-by: Demian Brecht <demianbrecht@gmail.com>


https://bugs.python.org/issue12144



Automerge-Triggered-By: @asvetlov
2019-09-13 04:29:00 -07:00
Xtreak d31b31516c bpo-36889: Document Stream class and add docstrings (GH-14488)
* This just copies the docs from `StreamWriter` and `StreamReader`.
* Add docstring for asyncio functions.


https://bugs.python.org/issue36889



Automerge-Triggered-By: @asvetlov
2019-09-13 03:52:38 -07:00
Rémi Lapeyre 6a517c6749 bpo-8538: Add support for boolean actions to argparse (GH-11478)
Co-Authored-By: remilapeyre <remi.lapeyre@henki.fr>
2019-09-13 11:17:43 +01:00
Dino Viehland 04f0bbfbed bpo-38075: Port _randommodule.c to PEP-384 (GH-15798)
- Migrate `Random_Type` to `PyType_FromSpec`
- To simulate an old use of `PyLong_Type.tp_as_number->nb_absolute`, I added
  code to the module init function to stash `int.__abs__` for later
  use. Ideally we'd use `PyType_GetSlot()` instead, but it doesn't currently
  work for static types in CPython, and implementing it just for this case
  doesn't seem worth it.
- Do exact check for long and dispatch to PyNumber_Absolute, use vector call when not exact.
2019-09-13 03:12:27 -07:00
Jakub Kulík 42671aea2d bpo-37785: Fix xgettext warning in argparse (GH-15161) 2019-09-13 11:25:32 +02:00
Kishore Vancheeshwaran 7183064e9e Doc: Add example snippet for str.isupper() (GH-14681) 2019-09-13 10:20:01 +01:00
Christian Heimes 7cad53e6b0 bpo-9216: Add usedforsecurity to hashlib constructors (GH-16044)
The usedforsecurity keyword only argument added to the hash constructors is useful for FIPS builds and similar restrictive environment with non-technical requirements that legacy algorithms be forbidden by their implementations without being explicitly annotated as not being used for any security related purposes.  Linux distros with FIPS support benefit from this being standard rather than making up their own way(s) to do it.

Contributed and Signed-off-by: Christian Heimes christian@python.org
2019-09-12 19:30:00 -05:00
Greg Price 3a4f66707e Cut disused recode_encoding logic in _PyBytes_DecodeEscape. (GH-16013)
All call sites pass NULL for `recode_encoding`, so this path is
completely untested.  That's been true since before Python 3.0.
It adds significant complexity to this logic, so it's best to
take it out.

All call sites now have a literal NULL, and that's been true since
commit 768921cf3 eliminated a conditional (`foo ? bar : NULL`) at
the call site in Python/ast.c where we're parsing a bytes literal.
But even before then, that condition `foo` had been a constant
since unadorned string literals started meaning Unicode, in commit
572dbf8f1 aka v3.0a1~1035 .

The `unicode` parameter is already unused, so mark it as unused too.
The code that acted on it was also taken out before Python 3.0, in
commit 8d30cc014 aka v3.0a1~1031 .

The function (PyBytes_DecodeEscape) is exposed in the API, but it's
never been documented.
2019-09-12 19:12:22 +01:00
Benjamin Peterson a44f3dc21d
Move Eric's TODO file into his directory. (GH-16072) 2019-09-12 18:19:46 +01:00
Steve Dower ed93a8852d
bpo-38133: Allow py.exe launcher to locate installations from the Microsoft Store (GH-16025) 2019-09-12 18:16:50 +01:00
Patrick McLean 2b2ead7438 bpo-36046: Add user and group parameters to subprocess (GH-11950)
* subprocess: Add user, group and extra_groups paremeters to subprocess.Popen

This adds a `user` parameter to the Popen constructor that will call
setreuid() in the child before calling exec(). This allows processes
running as root to safely drop privileges before running the subprocess
without having to use a preexec_fn.

This also adds a `group` parameter that will call setregid() in
the child process before calling exec().

Finally an `extra_groups` parameter was added that will call
setgroups() to set the supplimental groups.
2019-09-12 18:15:44 +01:00
Matti Picus 57b7dbc46e Emphasize the need to always call PySequence_Fast. (GH-11140) 2019-09-12 17:19:06 +01:00
Eric Snow 088b63ea7a
bpo-36876: Fix the globals checker tool. (gh-16058) 2019-09-12 16:59:38 +01:00
Daniel Hahler 855df7f273 closes bpo-37803: pdb: fix handling of options (--help / --version) (GH-15193)
The "--" should not be included with long options passed to
getopt.getopt.

Fixes https://bugs.python.org/issue37803
2019-09-12 16:46:37 +01:00
Hai Shi b1a2abdb06 bpo-37908: Add an example of ArgumentParser.exit() (GH-15455)
Co-Authored-By: Brandt Bucher <brandtbucher@gmail.com>
2019-09-12 16:34:24 +01:00
Raymond Hettinger 4210ad5ebd
bpo-38096: Complete the "structseq" and "named tuple" cleanup (GH-16010) 2019-09-12 07:56:28 -07:00
Sergey Fedoseev c6734ee7c5 bpo-37802: Slightly improve perfomance of PyLong_FromUnsigned*() (GH-15192) 2019-09-12 15:41:14 +01:00
Dino Viehland 8d88e8c662 bpo-38138: Fix memory leak introduced by interned strings (GH-16053)
Interned string needs to be decref'd



https://bugs.python.org/issue38138



Automerge-Triggered-By: @matrixise
2019-09-12 07:38:13 -07:00
Christian Heimes 9a4963b932 bpo-38137: Re-add OpenSSL 1.0.2 compat (GH-16051)
The defines are required for OpenSSL 1.0.2 and LibreSSL.


https://bugs.python.org/issue38134



Automerge-Triggered-By: @tiran
2019-09-12 07:33:26 -07:00
animalize 4ffd05d7ec bpo-21872: fix lzma library decompresses data incompletely (GH-14048)
* 1. add test case with wrong behavior
* 2. fix bug when max_length == -1
* 3. allow b"" as valid input data for decompress_buf()
* 4. when max_length >= 0, let needs_input mechanism works
* add more asserts to test case
2019-09-12 15:20:37 +01:00
Berker Peksag 2f1b857562 bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632) 2019-09-12 15:13:44 +01:00
T. Wouters 99b54d6817 Revert "Fix depth-first-search computation in compile.c (GH-16042)" (GH-16050)
This reverts commit 355f3e1e5c.

bpo-38135
2019-09-12 15:05:33 +01:00
Mark Shannon 355f3e1e5c Fix depth-first-search computation in compile.c (GH-16042) 2019-09-12 06:42:23 -07:00
Christian Heimes 8c74574e0a bpo-38132: Check EVP_DigestUpdate for error (GH-16041) 2019-09-12 14:30:47 +01:00
Julien Palard a45b0efdea Doc: Add -m reference in context of code execution (GH-16045) 2019-09-12 14:19:06 +01:00
Christian Heimes ed4b3216e5 bpo-37363: Document internal audit events (GH-14663)
Three internal cpython events were not documented, yet.

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



https://bugs.python.org/issue37363
2019-09-12 06:13:02 -07:00
Serhiy Storchaka f9dc2ad890 bpo-37935: Added tests for os.walk(), glob.iglob() and Path.glob() (GH-15956)
Test that they do not keep too many file descriptors open for the host OS in a reasonable test scenario.

See [bpo-37935](https://bugs.python.org/issue37935).
2019-09-12 13:54:48 +01:00
Christian Heimes 5a4f82f457 bpo-38132: Simplify _hashopenssl code (GH-16023)
Signed-off-by: Christian Heimes <christian@python.org>
2019-09-12 13:42:07 +01:00
Andrew Svetlov a488879cba
bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033) 2019-09-12 15:40:40 +03:00
Zachary Ware 3ab61473ba Enhance Py_UNREACHABLE macro (GH-16032) 2019-09-12 13:35:48 +01:00
Brandt Bucher 224b8aaa7e bpo-26868: Fix example usage of PyModule_AddObject. (#15725)
* Add a note to the PyModule_AddObject docs.

* Correct example usages of PyModule_AddObject.

* Whitespace.

* Clean up wording.

* 📜🤖 Added by blurb_it.

* First code review.

* Add < 0 in the tests with PyModule_AddObject
2019-09-12 13:11:20 +01:00
Windson yang 967b84c913 bpo-35325: Doc: imp.find_module() return value documentation discrepancy (GH-11040) 2019-09-12 14:10:50 +02:00
Christian Heimes 64117e059b bpo-38134: Remove PKBDF2_HMAC_fast from _hashopenssl (GH-16028)
Signed-off-by: Christian Heimes <christian@python.org>
2019-09-12 12:46:37 +01:00
Emmanuel Arias 31a82e25b6 bpo-35685: Add examples of unittest.mock.patch.dict usage (GH-11456) 2019-09-12 13:29:54 +02:00