Commit Graph

44816 Commits

Author SHA1 Message Date
Serhiy Storchaka f37a983102
[3.8] bpo-38005: Fixed comparing and creating of InterpreterID and ChannelID. (GH-15652) (GH-16145)
* Fix a crash in comparing with float (and maybe other crashes).
* They are now never equal to strings and non-integer numbers.
* Comparison with a large number no longer raises OverflowError.
* Arbitrary exceptions no longer silenced in constructors and comparisons.
* TypeError raised in the constructor contains now the name of the type.
* Accept only ChannelID and int-like objects in channel functions.
* Accept only InterpreterId, int-like objects and str in the InterpreterId constructor.
* Accept int-like objects, not just int in interpreter related functions.
(cherry picked from commit bf169915ec)
2019-09-14 19:36:19 +03:00
Serhiy Storchaka d322abbb83
[3.8] bpo-37206: Unrepresentable default values no longer represented as None. (GH-13933) (GH-16141)
In ArgumentClinic, value "NULL" should now be used only for unrepresentable default values
(like in the optional third parameter of getattr). "None" should be used if None is accepted
as argument and passing None has the same effect as not passing the argument at all.
(cherry picked from commit 279f44678c)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-14 13:31:50 +03:00
Miss Islington (bot) 66da347ef0
bpo-37953: Fix deprecation warnings in test_typing (GH-16133)
self.assertEquals() is deprecated.

```
./python -We -m test test_typing
Run tests sequentially
0:00:00 load avg: 0.23 [1/1] test_typing
test test_typing failed -- Traceback (most recent call last):
  File "/home/lubuntu2/cpython/Lib/test/test_typing.py", line 2382, in test_forward_equality_gth
    self.assertEquals(Union[c1, c1_gth], Union[c1])
  File "/home/lubuntu2/cpython/Lib/unittest/case.py", line 1390, in deprecated_func
    warnings.warn(
DeprecationWarning: Please use assertEqual instead.

test_typing failed

== Tests result: FAILURE ==

1 test failed:
    test_typing

Total duration: 140 ms
Tests result: FAILURE
```

https://bugs.python.org/issue37953
(cherry picked from commit d057b896f9)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-14 01:02:19 -07:00
Miss Islington (bot) e91edfed42
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
(cherry picked from commit e082e7cbe4)

Co-authored-by: plokmijnuhby <39633434+plokmijnuhby@users.noreply.github.com>
2019-09-13 13:00:39 -07:00
Miss Islington (bot) cd85200f6d
Fix typo in test_api.py. (GH-16119)
(cherry picked from commit 0bc17ea2f5)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-09-13 10:49:09 -07:00
Miss Islington (bot) cf25765cf7 bpo-34706: Preserve subclassing in inspect.Signature.from_callable (GH-16108) (GH-16113)
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.
(cherry picked from commit 5b9ff7a0dc)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-09-13 18:42:35 +01:00
Miss Islington (bot) 436b429ade
bpo-38092: Reduce overhead when using multiprocessing in a Windows virtual environment (GH-16098)
https://bugs.python.org/issue38092
(cherry picked from commit f2b7556ef8)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-13 09:59:11 -07:00
Miss Islington (bot) 83c21fdc36
bpo-37199: Replace the early returns added in c2cda63. (GH-14535)
(cherry picked from commit 81319a81b2)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-13 09:12:33 -07:00
Miss Islington (bot) 590ed09a5b
bpo-25068: urllib.request.ProxyHandler now lowercases the dict keys (GH-13489)
(cherry picked from commit b761e3aed1)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2019-09-13 07:25:51 -07:00
Andrew Svetlov 6638c92260
[3.8] bpo-38148: Add slots to asyncio transports (GH-16077) (GH-16093)
* 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>
(cherry picked from commit 9eb35ab0d7)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-13 16:14:55 +03:00
Miss Islington (bot) 44cb89a78a
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
(cherry picked from commit bb41147eab)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-13 04:47:51 -07:00
Miss Islington (bot) b9bfe143d1
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
(cherry picked from commit d31b31516c)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-13 04:23:43 -07:00
Miss Islington (bot) 52c99aeb9f
Fix the ImportWarning regarding __spec__ and __package__ being None (GH-16003)
(cherry picked from commit 6e1a30b15e)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-13 03:53:22 -07:00
Miss Islington (bot) 8750dfe09e
bpo-37785: Fix xgettext warning in argparse (GH-15161)
(cherry picked from commit 42671aea2d)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2019-09-13 02:45:27 -07:00
Miss Islington (bot) 21bfff9a5a
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
(cherry picked from commit 855df7f273)

Co-authored-by: Daniel Hahler <github@thequod.de>
2019-09-12 09:05:52 -07:00
Jason R. Coombs a0d4aac50b
[3.8] bpo-38121: Sync importlib.metadata with 0.22 backport (GH-15993) (GH-16064)
* bpo-38121: Sync importlib.metadata with 0.22 backport

* 📜🤖 Added by blurb_it..
(cherry picked from commit 8ed6503eca)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-12 16:41:31 +01:00
Miss Islington (bot) 98a4a713d0 bpo-37935: Added tests for os.walk(), glob.iglob() and Path.glob() (GH-15956) (GH-16043)
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).
(cherry picked from commit f9dc2ad890)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2019-09-12 16:07:47 +01:00
Miss Islington (bot) 824407f76e
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
(cherry picked from commit 4ffd05d7ec)

Co-authored-by: animalize <animalize@users.noreply.github.com>
2019-09-12 07:41:11 -07:00
Miss Islington (bot) 717cc61ed1
bpo-36991: Fix incorrect exception escaping ZipFile.extract() (GH-13632)
(cherry picked from commit 2f1b857562)

Co-authored-by: Berker Peksag <berker.peksag@gmail.com>
2019-09-12 07:33:53 -07:00
Miss Islington (bot) 67b90a079c bpo-38132: Simplify _hashopenssl code (GH-16023) (#16040)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit 5a4f82f457)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-12 14:03:50 +01:00
Miss Islington (bot) 345bfc990f
bpo-36373: Deprecate explicit loop in task and subprocess API (GH-16033)
(cherry picked from commit a488879cba)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-12 05:59:50 -07:00
Miss Islington (bot) db0d8a5b2c bpo-37972: unittest.mock._Call now passes on __getitem__ to the __getattr__ chaining so that call() can be subscriptable (GH-15565) (GH-15965)
* 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__
(cherry picked from commit 72c359912d)

Co-authored-by: blhsing <github@ydooby.com>
2019-09-12 12:52:49 +02:00
Miss Islington (bot) f60fd95dcc closes bpo-37405: Make socket.getsockname() always return a tuple for AF_CAN. (GH-14392) (GH-16018)
This fixes a regression from 3.5. In recent releases, `getsockname()` in the AF_CAN case has returned a string.
(cherry picked from commit 954900a3f9)

Co-authored-by: bggardner <brent@ebrent.net>
2019-09-12 11:34:28 +01:00
Miss Islington (bot) 52baf90a74
bpo-38008: Move builtin protocol whitelist to mapping instead of list (GH-15647)
Fixes https://bugs.python.org/issue38008
(cherry picked from commit 692a0dc915)

Co-authored-by: Divij Rajkumar <drajkuma1@gmail.com>
2019-09-12 03:32:36 -07:00
Petr Viktorin 3562ae2540
[3.8] bpo-37879: Suppress subtype_dealloc decref when base type is a C heap type (GH-15323, GH-16004) (GH-15966)
The instance destructor for a type is responsible for preparing
an instance for deallocation by decrementing the reference counts
of its referents.

If an instance belongs to a heap type, the type object of an instance
has its reference count decremented while for static types, which
are permanently allocated, the type object is unaffected by the
instance destructor.

Previously, the default instance destructor searched the class
hierarchy for an inherited instance destructor and, if present,
would invoke it.

Then, if the instance type is a heap type, it would decrement the
reference count of that heap type.  However, this could result in the
premature destruction of a type because the inherited instance
destructor should have already decremented the reference count
of the type object.

This change avoids the premature destruction of the type object
by suppressing the decrement of its reference count when an
inherited, non-default instance destructor has been invoked.

Finally, an assertion on the Py_SIZE of a type was deleted.  Heap
types have a non zero size, making this into an incorrect assertion.

https://github.com/python/cpython/pull/15323.
(cherry picked from commit ff023ed36e)
Fixup: https://github.com/python/cpython/pull/16004.
(cherry picked from commit 5e9caeec76)

Co-authored-by: Eddie Elizondo <eduardo.elizondorueda@gmail.com>
2019-09-12 10:44:46 +01:00
Miss Islington (bot) 8af4e0c994 Correct typo in min version test (GH-16001)
Signed-off-by: Christian Heimes <christian@python.org>
(cherry picked from commit de606ea169)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-11 11:19:12 -07:00
Miss Islington (bot) d6ac67f48f bpo-34001: Fix test_ssl with LibreSSL (GH-13783) (#15997)
(cherry picked from commit c9bc49c5f6)

Co-authored-by: Christian Heimes <christian@python.org>
2019-09-11 19:59:13 +02:00
Miss Islington (bot) f90cbcbfe3
bpo-36528: Remove duplicate re tests. (GH-2689)
Co-Authored-By: Makdon <makdon@makdon.me>
(cherry picked from commit e6557d3c62)

Co-authored-by: Xtreak <tir.karthi@gmail.com>
2019-09-11 09:46:29 -07:00
Miss Islington (bot) 63eefc3567 bpo-37885: venv: Don't produce unbound variable warning on deactivate (GH-15973)
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
```
(cherry picked from commit 5209e586b7)

Co-authored-by: Daniel Abrahamsson <hamsson@gmail.com>
2019-09-11 08:55:57 -07:00
Miss Islington (bot) 20f80bfc83
bpo-36634: Fixes activate.bat when existing values contain double quotes (GH-15924)
(cherry picked from commit 574b324bdc)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-11 08:21:58 -07:00
Miss Islington (bot) b4808c1265 closes bpo-37252: Fix devpoll tests. (GH-14017) (GH-15948)
(cherry picked from commit 95da826db9)

Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>
2019-09-11 16:37:38 +02:00
Miss Islington (bot) 42edfcfd12 bpo-36919: make test_source_encoding.test_issue2301 implementation-independent (GH-13639) (GH-15952)
* bpo-36919: make test_issue2301 implementation-independent
(cherry picked from commit b6643dcfc2)

Co-authored-by: Pavel Koneski <pavel.koneski@gmail.com>
2019-09-11 15:37:18 +01:00
Miss Islington (bot) b18b19809d
bpo-38107: Replace direct future and task contructor calls with factories in asyncio tests (GH-15928)
(cherry picked from commit 9aee90018a)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-11 07:21:53 -07:00
Miss Islington (bot) fef5bdc645 bpo-34519: Add additional aliases for HP Roman 8 (GH-8956) (GH-15945)
* 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.
(cherry picked from commit a828514cc3)

Co-authored-by: Michael Osipov <michael.osipov@siemens.com>
2019-09-11 15:13:54 +01:00
Miss Islington (bot) 35d0934040 bpo-37305: add MIME type for Web App Manifest (GH-14199) (#15946)
* bpo-37305: add MIME type for Web App Manifest

Co-authored-by: Filip Š <filip.stamcar@hotmail.com>
2019-09-11 15:13:31 +01:00
Miss Islington (bot) cbd7b2a399 bpo-31163: Added return values to pathlib.Path instance's rename and replace methods. (GH-13582) (GH-15944)
* bpo-31163: Added return values to pathlib.Path instance's rename and replace methods.
(cherry picked from commit 088a09af4b)

Co-authored-by: hui shang <shangdahao@gmail.com>
2019-09-11 15:12:54 +01:00
Vinay Sajip 3b92ddb761
[3.8] bpo-35168: Make shlex.punctuation_chars read-only (GH-11631) (GH-15927)
(cherry picked from commit 972cf5c06a)

Co-authored-by: Alex <a.v.shkop@gmail.com>
2019-09-11 13:39:52 +01:00
Miss Islington (bot) e3bd941e4e
bpo-20504 : in cgi.py, fix bug when a multipart/form-data request has… (GH-10638)
* bpo-20504 : in cgi.py, fix bug when a multipart/form-data request has no content-length header

* Add Misc/NEWS.d/next file.

* Add rst formatting for NEWS.d/next file

* Reaplce assert by self.assertEqual
(cherry picked from commit 2d7cacacc3)

Co-authored-by: Pierre Quentel <pierre.quentel@gmail.com>
2019-09-11 05:09:23 -07:00
Miss Islington (bot) f3e430b079
bpo-35066: Make trailing percent test more portable. (GH-15907)
Different libc implementations have different behavior when presented with trailing % in strftime strings. To make test_strftime_trailing_percent more portable, compare the output of datetime.strftime directly to that of time.strftime rather than hardcoding.
(cherry picked from commit f2173ae38f)

Co-authored-by: Benjamin Peterson <benjamin@python.org>
2019-09-11 04:47:16 -07:00
Brett Cannon 0a6693a469
[3.8] bpo-37409: fix relative import with no parent (GH-14956) (GH-15913)
Relative imports use resolve_name to get the absolute target name,
which first seeks the current module's absolute package name from the globals:
If __package__ (and __spec__.parent) are missing then
import uses __name__, truncating the last segment if
the module is a submodule rather than a package __init__.py
(which it guesses from whether __path__ is defined).

The __name__ attempt should fail if there is no parent package (top level modules),
if __name__ is '__main__' (-m entry points), or both (scripts).
That is, if both __name__ has no subcomponents and the module does not seem
to be a package __init__ module then import should fail..
(cherry picked from commit 92420b3e67)

Co-authored-by: Ben Lewis <benjimin@users.noreply.github.com>
2019-09-11 12:38:22 +01:00
Miss Islington (bot) 57491de7c3
bpo-38081: Fixes ntpath.realpath('NUL') (GH-15899)
(cherry picked from commit 92521fea5d)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-11 03:43:30 -07:00
Andrew Svetlov 4601f7a49f
[3.8] bpo-36373: Fix deprecation warnings (GH-15889) (GH-15901)
https://bugs.python.org/issue36373
(cherry picked from commit 7264e92b71)

Co-authored-by: Andrew Svetlov <andrew.svetlov@gmail.com>
2019-09-11 13:40:36 +03:00
Zachary Ware df935b5f0b
[3.8] bpo-37936: Systematically distinguish rooted vs. unrooted in .gitignore (GH-15823) (GH-15900)
A root cause of bpo-37936 is that it's easy to write a .gitignore
rule that's intended to apply to a specific file (e.g., the
`pyconfig.h` generated by `./configure`) but actually applies to all
similarly-named files in the tree (e.g., `PC/pyconfig.h`.)

Specifically, any rule with no non-trailing slashes is applied in an
"unrooted" way, to files anywhere in the tree.  This means that if we
write the rules in the most obvious-looking way, then

 * for specific files we want to ignore that happen to be in
   subdirectories (like `Modules/config.c`), the rule will work
   as intended, staying "rooted" to the top of the tree; but

 * when a specific file we want to ignore happens to be at the root of
   the repo (like `platform`), then the obvious rule (`platform`) will
   apply much more broadly than intended: if someone tries to add a
   file or directory named `platform` somewhere else in the tree, it
   will unexpectedly get ignored.

That's surprising behavior that can make the .gitignore file's
behavior feel finicky and unpredictable.

To avoid it, we can simply always give a rule "rooted" behavior when
that's what's intended, by systematically using leading slashes.

Further, to help make the pattern obvious when looking at the file and
minimize any need for thinking about the syntax when adding new rules:
separate the rules into one group for each type, with brief comments
identifying them.

For most of these rules it's clear whether they're meant to be rooted
or unrooted, but in a handful of cases I've only guessed.  In that
case the safer default (the choice that won't hide information) is the
narrower, rooted meaning, with a leading slash.  If for some of these
the unrooted meaning is desired after all, it'll be easy to move them
to the unrooted section at the top.

(cherry picked from commit 455122a009)

Co-authored-by: Greg Price <gnprice@gmail.com>
2019-09-11 11:31:12 +01:00
Miss Islington (bot) 872c85a179
bpo-37424: Avoid a hang in subprocess.run timeout output capture (GH-14490)
Fixes a possible hang when using a timeout on subprocess.run() while
capturing output. If the child process spawned its own children or otherwise
connected its stdout or stderr handles with another process, we could hang
after the timeout was reached and our child was killed when attempting to read
final output from the pipes.
(cherry picked from commit 580d2782f7)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-09-11 03:05:14 -07:00
Miss Islington (bot) 74b0291b03
bpo-28494: Test existing zipfile working behavior. (GH-15853)
Add unittests for executables with a zipfile appended to test_zipfile, as zipfile.is_zipfile and zipfile.ZipFile work properly on these today.
(cherry picked from commit 3f4db4a0ba)

Co-authored-by: Gregory P. Smith <greg@krypto.org>
2019-09-10 15:57:54 -07:00
Victor Stinner d42a4fdc63
bpo-37531: Enhance regrtest multiprocess timeout (GH-15345) (GH-15871)
* Write a message when killing a worker process
* Put a timeout on the second popen.communicate() call
  (after killing the process)
* Put a timeout on popen.wait() call
* Catch popen.kill() and popen.wait() exceptions

(cherry picked from commit de2d9eed8b)
2019-09-10 17:54:51 +02:00
Jason R. Coombs 97c2f68a4c
[3.8] bpo-38086: Sync importlib.metadata with importlib_metadata 0.21. (GH-15840) (#15861)
https://gitlab.com/python-devs/importlib_metadata/-/tags/0.21.
(cherry picked from commit 17499d8270)

Co-authored-by: Jason R. Coombs <jaraco@jaraco.com>
2019-09-10 15:58:29 +01:00
Miss Islington (bot) 41c965f930
Fix subprocess docstring typo (GH-15812)
(cherry picked from commit 182e1d1f84)

Co-authored-by: Matthias <xmatthias@outlook.com>
2019-09-10 07:51:29 -07:00
Miss Islington (bot) 2ed0ac6bf1 bpo-38088: Fixes distutils not finding vcruntime140.dll with only v142 toolset installed (GH-15849)
(cherry picked from commit cd8221152d)

Co-authored-by: Steve Dower <steve.dower@python.org>
2019-09-10 15:42:26 +01:00
Steve Dower 206e4c3d35
bpo-38087: Fix case sensitivity in test_pathlib and test_ntpath (GH-15850) 2019-09-10 15:29:28 +01:00