Commit graph

110430 commits

Author SHA1 Message Date
Łukasz Langa 311ee83adb
Replace @ilevkivskyi with @Fidget-Spinner as typing code owner (#27210) 2021-07-17 11:21:31 +02:00
Germán Méndez Bravo 889036f7ef
bpo-41249: Fix postponed annotations for TypedDict (GH-27017)
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>
2021-07-16 20:49:30 -07:00
Yurii Karabas bf89ff96e6
bpo-44490: Improve typing module compatibility with types.Union (GH-27048) 2021-07-16 20:33:40 -07:00
Pablo Galindo Salgado f783428a23
bpo-44655: Include the name of the type in unset __slots__ attribute errors (GH-27199) 2021-07-17 00:34:46 +01:00
Pablo Galindo Salgado 6714dec5e1
bpo-44655: Don't include suggestions for attributes that are the same as the missing one (GH-27197) 2021-07-16 21:58:21 +01:00
Pablo Galindo Salgado c90c591e51
Revert "bpo-44645: Check for interrupts on any potentially backwards edge. (GH-27167)" (#27194)
This reverts commit 000e70ad52.
2021-07-16 19:05:47 +02:00
Ken Jin e9cd47d0e5
Remove legacy opcache structs (GH-27164) 2021-07-17 00:49:35 +09:00
Batuhan Taskaya 9af34c9351
bpo-20201: variadic arguments support for AC (GH-18609)
Implement support for `*args` in AC, and port `print()` to use it.
2021-07-16 18:43:02 +03:00
Łukasz Langa 7915c96ffd
bpo-44647: Add a permanent Unicode-valued env var to regrtest (#27187) 2021-07-16 15:24:02 +02:00
Jason R. Coombs 29358e93f2
bpo-44638: Add a reference to the zipp project and hint as to how to use it. (GH-27188)
Automerge-Triggered-By: GH:jaraco
2021-07-16 06:14:54 -07:00
Serhiy Storchaka 0cd2d51aad
bpo-44652: Preserve natural order of args in the union type. (GH-27185) 2021-07-16 16:11:30 +03:00
Weipeng Hong 6aab5f9bf3
bpo-40897:Give priority to using the current class constructor in inspect.signature (#27177)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-16 15:04:27 +02:00
Ammar Askar 8ce3008585
bpo-44569: Decouple frame formatting in traceback.py (GH-27038) 2021-07-16 13:21:16 +01:00
Pablo Galindo Salgado a283ef116b
Remove unnecessary 'invalid_primary' rule in the parser (GH-27186) 2021-07-16 13:20:09 +01:00
Mark Shannon 000e70ad52
bpo-44645: Check for interrupts on any potentially backwards edge. (GH-27167) 2021-07-16 10:59:31 +01:00
Serhiy Storchaka d9f923280f
bpo-44636: Collapse union of equal types (GH-27178)
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.
2021-07-16 12:49:33 +03:00
Serhiy Storchaka aeaa553d65
bpo-44646: Fix the hash of the union type. (#27179)
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>
2021-07-16 10:34:56 +02:00
Batuhan Taskaya 919ad53751
bpo-43950: make BinOp specializations more reliable (GH-27126) 2021-07-16 00:38:11 +01:00
T. Wouters 074e7659f2
bpo-44184: Apply GH-26274 to the non-GC-type branch of subtype_dealloc (GH-27165)
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
2021-07-16 00:40:57 +02:00
Łukasz Langa 82b218f36c
bpo-44647: Fix test_httpservers failing on Unicode characters in os.environ on Windows (GH-27161)
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.
2021-07-15 21:14:24 +02:00
Mark Shannon a86f7dae0a
bpo-44626: Merge basic blocks earlier to enable better handling of exit blocks without line numbers (GH-27138) 2021-07-15 17:46:55 +01:00
Erlend Egeberg Aasland 5007a4f23c
bpo-44641: Use vectorcall in sqlite3 collation callback (GH-27158) 2021-07-15 16:49:14 +01:00
Pablo Galindo Salgado 4cb7263f0c
Remove sys._deactivate_opcache() now that is not needed (GH-27154) 2021-07-15 14:43:59 +01:00
Mark Shannon f333ab0f2e
bpo-44622: Set line number of END_ASYNC_FOR to match that of iterator. (GH-27160) 2021-07-15 14:37:57 +01:00
Łukasz Langa b83861f026
bpo-42073: allow classmethod to wrap other classmethod-like descriptors (#27115)
Patch by Erik Welch.

bpo-19072 (#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 #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>
2021-07-15 15:16:19 +02:00
Irit Katriel 641345d636
bpo-26280: Port BINARY_SUBSCR to PEP 659 adaptive interpreter (GH-27043) 2021-07-15 13:13:12 +01:00
Leonardo Freua a0551059ba
Remove unnecessary pass statement in msvccompiler.py (GH-27123) 2021-07-15 12:59:01 +02:00
andrei kulakov b39eea06d1
bpo-42799: fnmatch module: bump up size of lru_cache for patterns (GH-27084) 2021-07-15 12:53:26 +02:00
Elisha Hollander 3527569f1c
Remove unnecessary test for xc == 1 in _pydecimal (GH-27102)
- if `xc == 1` then the function returns on line 2140;
- other assignments to `xc` are inside the `y.sign == 1` condition block which always returns early
2021-07-15 12:48:46 +02:00
Tzu-ping Chung 28544609cb
Fix osx_framework_user include to match distutils (#27093) 2021-07-15 11:44:04 +02:00
Jack DeVries 2693132292
bpo-44589: raise a SyntaxError when mapping patterns have duplicate literal keys (GH-27131) 2021-07-14 17:38:42 -07:00
Vinay Sajip 3b8075f907
bpo-44473: Update docstring and documentation for QueueHandler.prepar… (GH-27140)
…e().
2021-07-14 17:06:48 -07:00
Shane Harvey d59d7374a3
bpo-34932: Add socket.TCP_KEEPALIVE for macOS (GH-25079) 2021-07-14 23:53:15 +01:00
Pablo Galindo Salgado 2b47af6398
Add release highlights for the 3.10 what's new document (GH-27150) 2021-07-14 23:19:55 +01:00
Erlend Egeberg Aasland 81b8c0a385
Fix docstring typo in sqlite3.Connection.executescript/sqlite3.Cursor.executescript (GH-27147)
Both `executescript` methods contain the same docstring typo:
_"Executes a multiple SQL statements at once."_ => _"Executes multiple SQL statements at once."_

Automerge-Triggered-By: GH:pablogsal
2021-07-14 14:54:37 -07:00
Jack DeVries 1ca27f2647
bpo-44639: fix typo in sqlite.rst (transation => transaction) (GH-27145)
To my understanding, this is supposed to say "transaction".

See the relevant source:

a158b20019/Modules/_sqlite/connection.c (L1434-L1467)
2021-07-14 14:39:54 -07:00
Serhiy Storchaka a158b20019
bpo-44632: Fix support of TypeVar in the union type (GH-27139)
int | TypeVar('T') returns now an instance of types.Union
instead of typing.Union.
2021-07-14 20:09:15 +03:00
Serhiy Storchaka b81cac0560
bpo-44635: Convert None to NoneType in the union type constructor (GH-27136) 2021-07-14 19:54:54 +03:00
Erlend Egeberg Aasland 05162993fe
bpo-42064: Move sqlite3 exceptions to global state, part 2 of 2 (GH-26884)
Automerge-Triggered-By: GH:encukou
2021-07-14 04:26:44 -07:00
Mark Shannon e5862f79c1
bpo-44616: Mark all clean up instructions at end of named exception block as artificial (GH-27109) 2021-07-14 10:08:38 +01:00
Serhiy Storchaka f572cbf1fa
bpo-44608: Fix memory leak in _tkinter._flatten() (GH-27107)
if it is called with a sequence or set, but not list or tuple.
2021-07-14 08:19:18 +03:00
Serhiy Storchaka 81989058de
bpo-44606: Fix __instancecheck__ and __subclasscheck__ for the union type. (GH-27120)
* Fix issubclass() for None.
  E.g. issubclass(type(None), int | None) returns now True.
* Fix issubclass() for virtual subclasses.
  E.g. issubclass(dict, int | collections.abc.Mapping) returns now True.
* Fix crash in isinstance() if the check for one of items raises exception.
2021-07-14 07:35:39 +03:00
T. Wouters 0093876328
bpo-44630: Fix assertion errors in csv module (GH-27127)
Fix incorrect handling of exceptions when interpreting dialect objects in
the csv module. Not clearing exceptions between calls to
PyObject_GetAttrString() causes assertion failures in pydebug mode (or with
assertions enabled).

Add a minimal test that would've caught this (passing None as dialect, or
any object that isn't a csv.Dialect subclass, which the csv module allows
and caters to, even though it is not documented.) In pydebug mode, the test
triggers the assertion failure in the old code.

Contributed-By: T. Wouters [Google]
2021-07-13 15:56:45 -07:00
Serhiy Storchaka 054e9c84ac
bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
2021-07-13 22:27:50 +01:00
Konstantin-Glukhov 0ee0a740e1
bpo-44572: On Windows, disconnect STDIN in platform._syscmd_ver() to prevent erroneous STDIN consumption (GH-27092) 2021-07-13 20:21:48 +01:00
Clemens Brunner 6252670732
Fix typos in Mac/README.rst (#27108) 2021-07-13 18:25:12 +02:00
andrei kulakov 3b5b99da4b
bpo-43126: Expand docs on io.IOBase.readlines() method (#27061)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-13 16:07:56 +02:00
Kevin Follstad 48a5aa7f12
bpo-44514: Add doctest testcleanup for configparser and bz2 (#26909)
Add testcleanup section to configparser and bz2 documentation which
removes temporary files created in the filesystem when 'make doctest'
is run.
2021-07-13 15:57:05 +02:00
jsnklln 2924bb1a56
bpo-38741: Definition of multiple ']' in header configparser (GH-17129)
Co-authored-by: Jason Killen <jason.killen@windsorcircle.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
2021-07-13 15:54:06 +02:00
andrei kulakov d4a5f0b659
bpo-35113: clean up duplicate import and comment (#27073) 2021-07-13 15:42:56 +02:00