Commit Graph

24837 Commits

Author SHA1 Message Date
Dong-hee Na 635bfe8162
bpo-44661: Update property_descr_set to use vectorcall if possible. (GH-27206) 2021-07-19 19:13:27 +09:00
Irit Katriel aab1899c9d
bpo-41546: make pprint (like print) not write to stdout when it is None (GH-26810) 2021-07-19 10:19:02 +01:00
Jason R. Coombs 2c20558844
bpo-44554: refactor pdb targets (and internal tweaks) (GH-26992)
- Refactor module/script handling to share an interface (check method).
- Import functools and adjust tests for the new line number for find_function.
- Use cached_property for details.
- Add blurb.

Automerge-Triggered-By: GH:jaraco
2021-07-18 18:00:35 -07:00
Idan Moral 35b98e38b6
bpo-43086: Add handling for out-of-spec data in a2b_base64 (GH-24402)
binascii.a2b_base64 gains a strict_mode= parameter. When enabled it will raise an
error on input that deviates from the base64 spec in any way.  The default remains
False for backward compatibility.

Code reviews and minor tweaks by: Gregory P. Smith <greg@krypto.org> [Google]
2021-07-18 17:45:19 -07:00
Steven Hsu b494685b25
bpo-44561: Update hyperlinks in Doc/distributing/index.rst (#27032)
* Update hyperlinks in Doc/distributing/index.rst

Update three expired hyperlinks.

Closes bpo-44561.
2021-07-19 10:10:48 +10:00
Serhiy Storchaka 3ea5332a43
bpo-44633: Fix parameter substitution of the union type with wrong types. (GH-27218)
A TypeError is now raised instead of returning NotImplemented.
2021-07-18 12:10:19 +03:00
Hasan 689b05c628
bpo-42095: plistlib: Add tests that compare with plutil(1) (#27173)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-17 12:11:04 +02:00
Dong-hee Na d0b2b00c7d
bpo-43425: Remove test2to3 from Tools (#26981)
Co-authored-by: Łukasz Langa <lukasz@langa.pl>
2021-07-17 12:10:43 +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
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
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
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
Ł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
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
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
Shane Harvey d59d7374a3
bpo-34932: Add socket.TCP_KEEPALIVE for macOS (GH-25079) 2021-07-14 23:53:15 +01: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
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
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
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
Ammar Askar 9c3eaf88dc
bpo-43950: Add documentation for PEP-657 (GH-27047)
Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
Co-authored-by: Batuhan Taskaya <batuhanosmantaskaya@gmail.com>
2021-07-13 01:29:39 +01:00
Barry Warsaw f6954cdfc5
bpo-44613: Make importlib.metadata non-provisional (#27101)
* importlib.metadata is no longer provisional as of 3.10
* Add NEWS entry
2021-07-12 16:56:40 -07:00
andrei kulakov 248173cc04
bpo-43219: shutil.copyfile, raise a less confusing exception instead of IsADirectoryError (GH-27049)
Fixes the misleading IsADirectoryError to be FileNotFoundError.
2021-07-09 20:47:41 -07:00
Pablo Galindo Salgado f24777c2b3
bpo-44317: Improve tokenizer errors with more informative locations (GH-26555) 2021-07-10 01:29:29 +01:00
Filipe Laíns 91a8f8c16c
bpo-44446: support lineno being None in traceback.FrameSummary (GH-26781)
As of 088a15c49d, lineno is None instead
of -1 if there is no line number.

Signed-off-by: Filipe Laíns <lains@riseup.net>
2021-07-08 17:28:01 +01:00
Steve Dower bbf2fb6c7a
bpo-44582: Accelerate mimetypes.init on Windows with a native accelerator (GH-27059) 2021-07-08 16:48:42 +01:00
Erlend Egeberg Aasland a3739b207a
bpo-43908: Immutable types inherit vectorcall (GH-27001)
Heap types with the Py_TPFLAGS_IMMUTABLETYPE flag can now inherit the
PEP 590 vectorcall protocol.  Previously, this was only possible for static types.

Co-authored-by: Victor Stinner <vstinner@python.org>
2021-07-08 12:48:01 +02:00
Srinivas Reddy Thatiparthy (శ్రీనివాస్ రెడ్డి తాటిపర్తి) 58248d9437
bpo-41137: Use utf-8 encoding while reading .pdbrc files (GH-21263) 2021-07-08 16:16:08 +09:00
Ian Henriksen fed2fc4443
bpo-43895: Remove an unnecessary cache of shared object handles (GH-25487)
* Remove an unnecessary cache of shared object handles.
2021-07-07 16:26:06 -07:00
Rupert Tombs 6bd3ecfc27
bpo-44558: Match countOf `is`/`==` treatment to c (GH-27007) 2021-07-07 22:28:09 +09:00
Gabriele N. Tornetta 2f180ce2cb
bpo-44530: Add co_qualname field to PyCodeObject (GH-26941) 2021-07-07 12:21:51 +01:00
Yurii Karabas c45fa1a5d9
bpo-44490: Add __parameters__ and __getitem__ to types.Union (GH-26980)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
2021-07-06 11:04:33 -07:00
Sergey Fedoseev 7ac7a0c0f0
bpo-44022: Fix Sphinx role in NEWS entry (GH-27033) 2021-07-05 07:44:06 -07:00
Dong-hee Na 09302405d2
bpo-44558: Make the implementation consistency of operator.indexOf (GH-27012) 2021-07-05 18:04:36 +09:00
Ma Lin a9a69bb3ea
bpo-41486: zlib uses an UINT32_MAX sliding window for the output buffer (GH-26143)
* zlib uses an UINT32_MAX sliding window for the output buffer

These funtions have an initial output buffer size parameter:
- zlib.decompress(data, /, wbits=MAX_WBITS, bufsize=DEF_BUF_SIZE)
- zlib.Decompress.flush([length])

If the initial size > UINT32_MAX, use an UINT32_MAX sliding window, instead of clamping to UINT32_MAX.
Speed up when (the initial size == the actual size).

This fixes a memory consumption and copying performance regression in earlier 3.10 beta releases if someone used an output buffer larger than 4GiB with zlib.decompress.

Reviewed-by: Gregory P. Smith
2021-07-04 18:10:44 -07:00
Ken Jin d33943a6c3
bpo-44562: Remove invalid PyObject_GC_Del from error path of types.GenericAlias … (GH-27016) 2021-07-04 17:47:38 +01:00
Irit Katriel d968a638fc
bpo-34266: [pdb] handle ValueError from shlex.split() (GH-26656) 2021-07-03 16:33:35 +01:00
Ken Jin 1097384ce9
bpo-44553 : Implement GC methods for types.Union (GH-26993) 2021-07-03 15:12:11 +03:00
Ken Jin 2560c612c8
bpo-30256: [doc] Fix formatting error in news (GH-26994) 2021-07-02 17:53:11 +01:00