Commit Graph

44936 Commits

Author SHA1 Message Date
plokmijnuhby e082e7cbe4 bpo-37953: Fix ForwardRef hash and equality checks (GH-15400)
Ideally if we stick a ForwardRef in a dictionary we would like to reliably be able to get it out again.

https://bugs.python.org/issue37953
2019-09-13 20:40:54 +01:00
Benjamin Peterson 0bc17ea2f5
Fix typo in test_api.py. (GH-16119) 2019-09-13 18:27:59 +01:00
Michael Foord 14fd925a18 bpo-38122: minor fixes to AsyncMock spec handling (GH-16099) 2019-09-13 17:40:56 +01:00
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
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
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
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
Jakub Kulík 42671aea2d bpo-37785: Fix xgettext warning in argparse (GH-15161) 2019-09-13 11:25:32 +02: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
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
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
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
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
Hai Shi f545638b57 bpo-9938: Add optional keyword argument exit_on_error to argparse.ArgumentParser (GH-15362)
Co-Authored-by: Xuanji Li <xuanji@gmail.com>


https://bugs.python.org/issue9938



Automerge-Triggered-By: @matrixise
2019-09-12 03:56:05 -07:00
Divij Rajkumar 692a0dc915 bpo-38008: Move builtin protocol whitelist to mapping instead of list (GH-15647)
Fixes https://bugs.python.org/issue38008
2019-09-12 11:13:51 +01:00
bggardner 954900a3f9 closes bpo-37405: Make socket.getsockname() always return a tuple for AF_CAN. (GH-14392)
This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.
2019-09-12 11:02:48 +01:00
Eric Snow 64535fc6c0
bpo-36876: Skip test_check_c_globals for now. (gh-16017) 2019-09-12 10:51:00 +01:00
Xtreak 6e1a30b15e Fix the ImportWarning regarding __spec__ and __package__ being None (GH-16003) 2019-09-12 10:29:36 +01:00
Jason R. Coombs 8ed6503eca bpo-38121: Sync importlib.metadata with 0.22 backport (GH-15993)
* bpo-38121: Sync importlib.metadata with 0.22 backport

* 📜🤖 Added by blurb_it.
2019-09-12 10:29:11 +01:00
Greg Price 6954be815a closes bpo-37758: Extend unicodedata checksum tests to cover all of Unicode. (GH-15125)
Unicode has grown since Python first gained support for it,
when Unicode itself was still rather new.

This pair of test cases was added in commit 6a20ee7de back in 2000,
and they haven't needed to change much since then.  But do change
them to look beyond the Basic Multilingual Plane (range(0x10000))
and cover all 17 planes of Unicode's final form.

This adds about 5 seconds to the test suite's runtime.  Mark the
tests as CPU-using accordingly.
2019-09-12 10:25:25 +01:00
ewosborne f9c95a4ba2 bpo-32820: __format__ method for ipaddress (#5627)
* bits method and test_bits

* Cleaned up assert string

* blurb

* added docstring

* Faster method, per Eric Smith

* redoing as __format__

* added ipv6 method

* test cases and cleanup

* updated news

* cleanup and NEWS.d

* cleaned up old NEWS

* removed cut and paste leftover

* one more cleanup

* moved to regexp, moved away from v4- and v6-specific versions of __format__

* More cleanup, added ipv6 test cases

* more cleanup

* more cleanup

* cleanup

* cleanup

* cleanup per review, part 1

* addressed review comments around help string and regexp matching

* wrapped v6 test strings. contiguous integers: break at 72char. with underscores: break so that it looks clean.

*  's' and '' tests for pv4 and ipv6

* whitespace cleanup

* Remove trailing whitespace

* Remove more trailing whitespace

* Remove an excess blank line
2019-09-12 10:03:31 +01:00
Joannah Nanjekye 92777d5e5a bpo-18578: Rename and document test.bytecode_helper as test.support.bytecode_helper (GH-15168)
Rename and document test.bytecode_helper as test.support.bytecode_helper
2019-09-12 10:02:59 +01:00
Xtreak a06d683d7f bpo-38120: Fix DeprecationWarning in test_random for invalid type of arguments to random.seed. (GH-15987) 2019-09-12 11:13:20 +03:00
Eric Snow ee536b2020
bpo-36876: Add a tool that identifies unsupported global C variables. (#15877) 2019-09-11 19:49:45 +01:00
Christian Heimes de606ea169 Correct typo in min version test (GH-16000)
Signed-off-by: Christian Heimes <christian@python.org>
2019-09-11 10:48:58 -07:00
Christian Heimes c9bc49c5f6 bpo-34001: Fix test_ssl with LibreSSL (GH-13783) 2019-09-11 10:24:47 -07:00
Joannah Nanjekye 8d120f75fb bpo-28724: Add methods send_fds and recv_fds to the socket module (GH-12889)
The socket module now has the socket.send_fds() and socket.recv.fds() functions.
Contributed by Joannah Nanjekye, Shinya Okano (original patch)
and Victor Stinner.

Co-Authored-By: Victor Stinner <vstinner@redhat.com>
2019-09-11 19:12:21 +02:00
Xtreak e6557d3c62 bpo-36528: Remove duplicate re tests. (GH-2689)
Co-Authored-By: Makdon <makdon@makdon.me>
2019-09-11 17:02:34 +01:00
Dong-hee Na 145cf1f50c bpo-35923: Update the BuiltinImporter to use loader._ORIGIN instead of a hard-coded value (GH-15651) 2019-09-11 17:00:02 +01:00
Daniel Andrade 4a12a178f4 bpo-34331: Fix incorrectly pluralized abstract class error message. (GH-8670) 2019-09-11 17:29:44 +02:00
Daniel Abrahamsson 5209e586b7 bpo-37885: venv: Don't produce unbound variable warning on deactivate (GH-15330)
Before, running deactivate from a bash shell configured to treat undefined variables as errors (`set -u`) would produce a warning:

``` 
$ python3 -m venv test
$ source test/bin/activate
(test) $ deactivate
-bash: $1: unbound variable
```
2019-09-11 07:58:56 -07:00
Steve Dower 574b324bdc bpo-36634: Fixes activate.bat when existing values contain double quotes (GH-15924) 2019-09-11 15:41:21 +01:00
blhsing 72c359912d bpo-37972: unittest.mock._Call now passes on __getitem__ to the __getattr__ chaining so that call() can be subscriptable (GH-15565)
* bpo-37972: unittest.mock._Call now passes on __getitem__ to the __getattr__ chaining so that call() can be subscriptable

* 📜🤖 Added by blurb_it.

* Update 2019-08-28-21-40-12.bpo-37972.kP-n4L.rst

added name of the contributor

* bpo-37972: made all dunder methods chainable for _Call

* bpo-37972: delegate only attributes of tuple instead to __getattr__
2019-09-11 16:28:06 +02:00
Pavel Koneski b6643dcfc2 bpo-36919: make test_source_encoding.test_issue2301 implementation-independent (#13639)
* bpo-36919: make test_issue2301 implementation-independent
2019-09-11 14:57:32 +01:00
Jakub Kulík 95da826db9 closes bpo-37252: Fix devpoll tests. (GH-14017) 2019-09-11 14:42:04 +01:00
Filip Š 4b41745b3c bpo-37305: add MIME type for Web App Manifest (#14199)
* bpo-37305: add MIME type for Web App Manifest

* bpo-37305: add news entry

* Restore indentation and sort by value
2019-09-11 14:32:04 +01:00
hui shang 088a09af4b bpo-31163: Added return values to pathlib.Path instance's rename and replace methods. (GH-13582)
* bpo-31163: Added return values to pathlib.Path instance's rename and replace methods.
2019-09-11 14:26:49 +01:00
Michael Osipov a828514cc3 bpo-34519: Add additional aliases for HP Roman 8 (GH-8956)
* bpo-34519: Add additional aliases for HP Roman 8

HP Roman 8 is known under mode aliases than listed in aliases.py.

Patch by Michael Osipov.
2019-09-11 14:08:41 +01:00