Commit graph

110245 commits

Author SHA1 Message Date
Pablo Galindo Salgado
9356d1e47d
[3.10] bpo-44676: Add ability to serialize types.Union (GH-27244) (GH-27333)
(cherry picked from commit fe13f0b0f6)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2021-07-24 15:08:53 +01:00
Miss Islington (bot)
e8c01749c0
bpo-44353: Improve tests covering typing.NewType pickling (GH-27302) (GH-27328)
(cherry picked from commit a22b05da87)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2021-07-24 12:29:19 +02:00
Łukasz Langa
05f5d8e48c
[3.10] bpo-44353: Expand NewType tests for complex __qualname__ (GH-27311) (GH-27326)
Make NewType pickleable by name.
(cherry picked from commit e89ef0ad2a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-24 12:07:56 +02:00
Miss Islington (bot)
45caee2715
bpo-44713: [doc fix]: typo in subprocess.rst (GH-27297) (GH-27298)
This fixes a small typo. The code fragment should not be quoted. Thank you
@merwok for the feedback.
(cherry picked from commit 7d25254cf0)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
2021-07-24 11:59:22 +02:00
Miss Islington (bot)
659030c7d5
bpo-44720: Don't crash when calling weakref.proxy(not_an_iterator).__next__ (GH-27316) (GH-27324)
(cherry picked from commit 5370f0a82a)

Co-authored-by: Dennis Sweeney <36520290+sweeneyde@users.noreply.github.com>
2021-07-24 11:45:13 +02:00
Miss Islington (bot)
d15949a845
bpo-44353: Document that typing.NewType is now a class (GH-27319) (GH-27321)
(cherry picked from commit 7aac3f6236)

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-24 11:31:33 +02:00
Miss Islington (bot)
5ec275758d
bpo-42854: Correctly use size_t for _ssl._SSLSocket.read and _ssl._SSLSocket.write (GH-27271) (GH-27308)
(cherry picked from commit 83d1430ee5)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-07-23 16:25:54 +01:00
Miss Islington (bot)
632e8a6959
bpo-42747: Remove Py_TPFLAGS_HAVE_AM_SEND and make Py_TPFLAGS_HAVE_VERSION_TAG no-op (GH-27260) (GH-27306)
* Remove code that checks Py_TPFLAGS_HAVE_VERSION_TAG

    The field is always present in the type struct, as explained
    in the added comment.

* Remove Py_TPFLAGS_HAVE_AM_SEND

    The flag is not needed, and since it was added in 3.10 it can be removed now.
(cherry picked from commit a4760cc32d)

Co-authored-by: Petr Viktorin <encukou@gmail.com>
2021-07-23 16:56:53 +02:00
Miss Islington (bot)
c589992e09
bpo-29298: Fix crash with required subparsers without dest (GH-3680) (GH-27303)
(cherry picked from commit 17575f73ce)

Co-authored-by: Anthony Sottile <asottile@umich.edu>
2021-07-23 15:27:05 +02:00
Miss Islington (bot)
21db59fc75
bpo-44653: Support typing types in parameter substitution in the union type. (GH-27247) (#27296)
(cherry picked from commit 2e3744d50b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-23 00:18:49 +02:00
Miss Islington (bot)
9608719e12
bpo-44708: Only re-run test methods that match names of previously failing test methods (GH-27287) (GH-27290)
* Move to a static argparse.Namespace subclass
* Roughly annotate runtest.py
* Refactor libregrtest to use lossless test result objects
* Only re-run test methods that match names of previously failing test methods
* Adopt tests to cover test method name matching

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
(cherry picked from commit f1afef5e0d)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-22 22:30:44 +02:00
Miss Islington (bot)
d0c6175303
bpo-14879: [doc] clarify how to check for errors from subprocess.Popen(..., shell=True) (GH-26755) (GH-27288)
(cherry picked from commit 50ffbe3daf)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
2021-07-22 19:25:57 +01:00
Miss Islington (bot)
0fb4b75f7a
Fix typo in collections.rst (GH-27270) (#27285) 2021-07-22 10:38:22 +02:00
Miss Islington (bot)
4194f1465f
bpo-44704: Make Set._hash consistent with frozenset.__hash__ (GH-27281) (GH-27282) 2021-07-21 19:23:21 -05:00
Miss Islington (bot)
d17449f31d
bpo-30511: Add note on thread safety to shutil.make_archive() (GH-26933) (GH-27274)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 64f54b7ccd)

Co-authored-by: andrei kulakov <andrei.avk@gmail.com>
2021-07-21 10:55:22 +02:00
Miss Islington (bot)
68b4690b01
bpo-44566: resolve differences between asynccontextmanager and contextmanager (GH-27024) (#27266)
(cherry picked from commit 7f1c330da3)

Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2021-07-20 21:12:47 +02:00
Miss Islington (bot)
574da4633b
[3.10] bpo-43219: skip Solaris in the test as well (GH-27257) (GH-27268)
(cherry picked from commit 6564656495)


Co-authored-by: Jakub Kulík <Kulikjak@gmail.com>

Automerge-Triggered-By: GH:gpshead
2021-07-20 11:53:31 -07:00
Miss Islington (bot)
416f418a11
Update macOS build-installer script comments for 3.10 and remove unused pre-10.5 vestiges. (GH-27253)
(cherry picked from commit 42205ee512)

Co-authored-by: Ned Deily <nad@python.org>
2021-07-20 10:30:29 -07:00
Miss Islington (bot)
9ae5ba7dbf
bpo-44353: Add test to cover __or__ of two NewType (GH-27259) (#27261)
(cherry picked from commit 4868b94c60)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2021-07-20 18:06:38 +02:00
Miss Islington (bot)
c2f33dfc83
bpo-44353: Refactor typing.NewType into callable class (GH-27250) (#27258)
(cherry picked from commit 965dd76e90)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2021-07-20 17:24:57 +02:00
Miss Islington (bot)
c895f2bc4f
bpo-44524: Add missed __name__ and __qualname__ to typing module objects (GH-27237) (#27246)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit bce1418541)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2021-07-19 19:57:27 +02:00
Miss Islington (bot)
8c43bf1a92
bpo-27513: email.utils.getaddresses() now handles Header objects (GH-13797) (GH-27242)
getaddresses() should be able to handle a Header object if passed
one.

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 89f4c34797)

Co-authored-by: Zackery Spytz <zspytz@gmail.com>
2021-07-19 18:54:45 +02:00
Miss Islington (bot)
2d0492091e
Clean up comma usage in Doc/library/functions.rst (GH-27083) (#27243)
(cherry picked from commit 1e651c6ada)

Co-authored-by: α∂мιηιχтяαтσя <sadiqherritage@gmail.com>
2021-07-19 18:38:56 +02:00
Ken Jin
a272164959
bpo-44490: Improve typing module compatibility with types.Union (GH-27048) (#27222)
(cherry picked from commit bf89ff96e6)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
2021-07-19 07:22:59 -07:00
Miss Islington (bot)
37bdd2221c
bpo-44645: Check for interrupts on any potentially backwards edge (GH-27216) (GH-27235)
(cherry picked from commit d09c134178)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2021-07-19 12:15:58 +01:00
Miss Islington (bot)
bce2847169
[3.10] bpo-44561: Update hyperlinks in Doc/distributing/index.rst (GH-27032) (GH-27234)
* Update hyperlinks in Doc/distributing/index.rst

Update three expired hyperlinks.

Closes [bpo-44561]().
(cherry picked from commit b494685b25)


Co-authored-by: Steven Hsu <hsuhaochun@gmail.com>

Automerge-Triggered-By: GH:ncoghlan
2021-07-18 17:34:44 -07:00
Pablo Galindo Salgado
af9a352b60
Correct the order of check-abidump (GH-27229)
The check was backwards so we were not correctly detecting removals.
2021-07-18 16:56:45 +01:00
Serhiy Storchaka
a6670cdf77
[3.10] bpo-44654: Do not export the union type related symbols (GH-27223). (GH-27225)
(cherry picked from commit 8f50f44592)
2021-07-18 18:37:41 +03:00
Miss Islington (bot)
85b58292cf
bpo-44633: Fix parameter substitution of the union type with wrong types. (GH-27218) (GH-27224)
A TypeError is now raised instead of returning NotImplemented.
(cherry picked from commit 3ea5332a43)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-18 14:59:25 +03:00
Miss Islington (bot)
03aad3049d
[3.10] bpo-44654: Refactor and clean up the union type implementation (GH-27196) (GH-27219)
(cherry picked from commit 0fd27375ca)
2021-07-18 00:10:21 +03:00
Serhiy Storchaka
2d055ce132
[3.10] bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980) (GH-27207)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>.
(cherry picked from commit c45fa1a5d9)

Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
2021-07-17 22:14:57 +03:00
Miss Islington (bot)
e22e8641dd
Replace @ilevkivskyi with @Fidget-Spinner as typing code owner (GH-27210) (#27212)
(cherry picked from commit 311ee83adb)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-17 11:46:25 +02:00
Miss Islington (bot)
480f29f913
bpo-41249: Fix postponed annotations for TypedDict (GH-27017) (#27204)
This fixes TypedDict to work with get_type_hints and postponed evaluation of annotations across modules.

This is done by adding the module name to ForwardRef at the time the object is created and using that to resolve the globals during the evaluation.

Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
(cherry picked from commit 889036f7ef)

Co-authored-by: Germán Méndez Bravo <german.mb@gmail.com>
2021-07-17 10:48:17 +02:00
Miss Islington (bot)
efda9054b9
bpo-44655: Include the name of the type in unset __slots__ attribute errors (GH-27199) (GH-27201)
(cherry picked from commit f783428a23)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-07-17 01:01:53 +01:00
Miss Islington (bot)
a0b1d401db
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) (GH-27198)
(cherry picked from commit 6714dec5e1)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-07-16 22:16:08 +01:00
Miss Islington (bot)
42a5514cca
Revert "bpo-44645: Check for interrupts on any potentially backwards edge. (GH-27167)" (GH-27194) (#27195)
This reverts commit 000e70ad52.
(cherry picked from commit c90c591e51)

Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
2021-07-16 19:29:32 +02:00
Miss Islington (bot)
93d36a5bce
bpo-44647: Add a permanent Unicode-valued env var to regrtest (GH-27187) (#27191)
(cherry picked from commit 7915c96ffd)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-16 15:55:26 +02:00
Serhiy Storchaka
80844d1ebc
[3.10] bpo-44652: Preserve natural order of args in the union type. (GH-27185) (GH-27190)
(cherry picked from commit 0cd2d51aad)

Automerge-Triggered-By: GH:ambv
2021-07-16 06:42:04 -07:00
Miss Islington (bot)
948e39a866
bpo-40897:Give priority to using the current class constructor in inspect.signature (GH-27177) (#27189)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
(cherry picked from commit 6aab5f9bf3)

Co-authored-by: Weipeng Hong <hongweichen8888@sina.com>
2021-07-16 15:25:57 +02:00
Serhiy Storchaka
c3007ab3c6
[3.10] bpo-44636: Collapse union of equal types (GH-27178) (GH-27181)
The result of `int | int` is now `int`.

Fix comparison of the union type with non-hashable objects.
`int | str == {}` no longer raises a TypeError.
(cherry picked from commit d9f923280f)
2021-07-16 14:48:20 +03:00
Mark Shannon
37686f78cc
bpo-44626: Merge basic blocks earlier to enable better handling of exit blocks without line numbers (GH-27138) (GH-27182)
(cherry picked from commit a86f7dae0a)
2021-07-16 11:49:10 +01:00
Mark Shannon
0e349ea554
[3.10] bpo-44645: Check for interrupts on any potentially backwards edge. (GH-27167) (GH-27183)
(cherry picked from commit 000e70ad52)

Co-authored-by: Mark Shannon <mark@hotpy.org>
2021-07-16 11:48:46 +01:00
Miss Islington (bot)
705988056e
bpo-44646: Fix the hash of the union type. (GH-27179) (#27180)
It no longer depends on the order of arguments.
hash(int | str) == hash(str | int)

Co-authored-by: Jack DeVries <58614260+jdevries3133@users.noreply.github.com>
(cherry picked from commit aeaa553d65)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-16 11:02:59 +02:00
Miss Islington (bot)
6aa59c68dc
bpo-44184: Apply GH-26274 to the non-GC-type branch of subtype_dealloc (GH-27165) (GH-27174)
The non-GC-type branch of subtype_dealloc is using the type of an object after freeing in the same unsafe way as GH-26274 fixes. (I believe the old news entry covers this change well enough.)

https://bugs.python.org/issue44184
(cherry picked from commit 074e7659f2)

Co-authored-by: T. Wouters <thomas@python.org>
2021-07-16 01:18:16 +02:00
Miss Islington (bot)
356bdff1e9
bpo-44647: Fix test_httpservers failing on Unicode characters in os.environ on Windows (GH-27161) (#27169)
GH-23638 introduced a new test for Accept: headers in CGI HTTP servers. This test serializes all of os.environ on the server side. For non-UTF8 locales this can fail for some Unicode characters found in environment variables. This change fixes the HTTP_ACCEPT test.
(cherry picked from commit 82b218f36c)

Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-15 22:09:26 +02:00
Mark Shannon
47695e3c88
bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. (GH-27160) (GH-27163)
(cherry picked from commit f333ab0f2e)
2021-07-15 16:54:38 +02:00
Miss Islington (bot)
2ce8af3cbc
bpo-42073: allow classmethod to wrap other classmethod-like descriptors (GH-27115) (GH-27162)
Patch by Erik Welch.

bpo-19072 (GH-8405) allows `classmethod` to wrap other descriptors, but this does
not work when the wrapped descriptor mimics classmethod.  The current PR fixes
this.

In Python 3.8 and before, one could create a callable descriptor such that this
works as expected (see Lib/test/test_decorators.py for examples):
```python
class A:
    @myclassmethod
    def f1(cls):
        return cls

    @classmethod
    @myclassmethod
    def f2(cls):
        return cls
```
In Python 3.8 and before, `A.f2()` return `A`. Currently in Python 3.9, it
returns `type(A)`.  This PR make `A.f2()` return `A` again.

As of GH-8405, classmethod calls `obj.__get__(type)` if `obj` has `__get__`.
This allows one to chain `@classmethod` and `@property` together.  When
using classmethod-like descriptors, it's the second argument to `__get__`--the
owner or the type--that is important, but this argument is currently missing.
Since it is None, the "owner" argument is assumed to be the type of the first
argument, which, in this case, is wrong (we want `A`, not `type(A)`).

This PR updates classmethod to call `obj.__get__(type, type)` if `obj` has
`__get__`.

Co-authored-by: Erik Welch <erik.n.welch@gmail.com>
(cherry picked from commit b83861f026)
2021-07-15 15:42:11 +02:00
Miss Islington (bot)
3026d1381e
Fix osx_framework_user include to match distutils (GH-27093) (GH-27159)
(cherry picked from commit 28544609cb)

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
2021-07-15 12:10:57 +02:00
Miss Islington (bot)
cc1a47c849
bpo-44632: Fix support of TypeVar in the union type (GH-27139) (GH-27143)
int | TypeVar('T') returns now an instance of types.Union
instead of typing.Union.
(cherry picked from commit a158b20019)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
2021-07-15 10:25:22 +03:00
Serhiy Storchaka
6dec525582
[3.10] bpo-44635: Convert None to NoneType in the union type constructor (GH-27136). (GH-27142)
(cherry picked from commit b81cac0560)
2021-07-15 10:15:14 +03:00