| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
| |
(cherry picked from commit 75177358a62afeabd1d3aa0e9f395c2b9d4495ca)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|
|
|
|
|
|
|
|
| |
* fix typo - double spelled word 'use'
* change methods names to the infinitive form
(cherry picked from commit 90a6e56e5663233fe986331ef3f10422fe57dcbc)
Co-authored-by: Max Zhenzhera <59729293+maxzhenzhera@users.noreply.github.com>
|
|
|
|
|
|
| |
Co-authored-by: Serhiy Storchaka <3659035+serhiy-storchaka@users.noreply.github.com>
(cherry picked from commit 6442a9dd212fa18343db21849cf05c0181662c1f)
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
|
|
|
|
|
|
|
|
| |
list[int].__class__ returned type, and isinstance(list[int], type)
returned True. It caused numerous problems in code that checks
isinstance(x, type).
(cherry picked from commit f9433fff476aa13af9cb314fcc6962055faa4085)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
TypeVar and TypeVarTuple parameters (alt) (GH-93412) (GH-93746)
For example:
A[T, *Ts][*tuple[int, ...]] -> A[int, *tuple[int, ...]]
A[*Ts, T][*tuple[int, ...]] -> A[*tuple[int, ...], int]
(cherry picked from commit 3473817106c23eca7341c931453da0341c367e1d)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(GH-92335) (#92484)
* gh-91162: Fix substitution of unpacked tuples in generic aliases (GH-92335)
(cherry picked from commit 9d25db9db1617f012d7dba118b5b8f2b9e25e116)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
* Regenerate ABI file
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
|
|
|
|
|
|
| |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit f20a6a54fb041507a334ad71706974960d1b473f)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
|
|
|
|
|
| |
(cherry picked from commit eef47d5bc79469c2d5328d6f5a9732e44a49dd5a)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
|
|
|
|
|
| |
(GH-92582)
(cherry picked from commit 4739997e141c4c84bd2241d4d887c3c658d92700)
Co-authored-by: Matthew Rahtz <matthew.rahtz@gmail.com>
|
|
|
|
|
|
| |
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Yurii Karabas <1998uriyyo@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
|
|
| |
This mirrors logic in typing.get_args. The trickiness comes from how we
flatten args in collections.abc.Callable, see
https://bugs.python.org/issue42195
|
| |
|
|
|
|
| |
Co-authored-by: Matthew Rahtz <mrahtz@gmail.com>
|
| |
|
|
|
|
|
|
|
| |
Copied from typing-extensions (python/typing#1054, python/typing#1120).
Documentation is intentionally omitted, so we can focus on getting the
runtime part in before the feature freeze.
|
|
|
|
|
| |
Closes #90633
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
|
|
| |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
|
|
| |
Based on suggestions by Guido van Rossum, Spencer Brown, and Alex Waygood.
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Guido van Rossum <gvanrossum@gmail.com>
Co-authored-by: Ken Jin <kenjin4096@gmail.com>
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
I talked to @davidfstr and I offered to implement the runtime part of PEP 655
to make sure we can get it in before the feature freeze. We're going to defer
the documentation to a separate PR, because it can wait until after the feature
freeze.
The runtime implementation conveniently already exists in typing-extensions,
so I largely copied that.
Co-authored-by: David Foster <david@dafoster.net>
|
|
|
| |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
| |
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
|
|
|
| |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
| |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
|
|
|
|
| |
The goal here is to reduce potential confusion between
`assert_type(val, type)` and `assert isinstance(val, typ)`.
The former is meant to ask a type checker to confirm a fact, the latter
is meant to tell a type checker a fact. The behaviour of the latter more
closely resembles what I'd expect from the prior phrasing of
"assert [something] to the type checker".
|
|
|
|
| |
I noticed that TypeVar and ParamSpec put their name in a __name__
attribute, but TypeVarTuple doesn't. Let's be consistent.
|
|
|
|
|
| |
* get_args(Tuple[()]) now returns () instead of ((),).
* Tuple[Unpack[Ts]][()] now returns the result equal to Tuple[()].
|
|
|
|
| |
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: David Foster <david@dafoster.net>
|
|
|
| |
We also remove all the tests that check for integer literals.
|
| |
|
|
|
|
|
|
| |
Add methods __typing_subst__() in TypeVar and ParamSpec.
Simplify code by using more object-oriented approach, especially
the C code for types.GenericAlias and the Python code for
collections.abc.Callable.
|
|
|
|
|
|
|
|
|
|
| |
GH-26091 added the _typevar_types and _paramspec_tvars instance
variables to _GenericAlias. However, they were not propagated
consistently. This commit addresses the most prominent deficiency
identified in bpo-46581 (namely their absence from
_GenericAlias.copy_with), but there could be others.
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
|
|
|
|
| |
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
| |
Co-authored-by: Alex Waygood <alex.waygood@gmail.com>
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
|
|
|
|
|
|
| |
This removes discrepancy between list["int"] and List["int"].
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
| |
|
| |
|
|
|
|
| |
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
There are several changes:
1. We now don't explicitly check for any base / sub types, because new name check covers it
2. I've also checked that `no_type_check` do not modify foreign functions. It was the same as with `type`s
3. I've also covered `except TypeError` in `no_type_check` with a simple test case, it was not covered at all
4. I also felt like adding `lambda` test is a good idea: because `lambda` is a bit of both in class bodies: a function and an assignment
<!-- issue-number: [bpo-46571](https://bugs.python.org/issue46571) -->
https://bugs.python.org/issue46571
<!-- /issue-number -->
|
|
|
|
|
|
|
|
|
| |
The `module` parameter carries semantic information about the forward ref.
Forward refs are different if they refer to different module even if they
have the same name. This affects the `__eq__`, `__repr__` and `__hash__` methods.
Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Ken Jin <28750310+Fidget-Spinner@users.noreply.github.com>
|
|
|
|
|
|
| |
Closes python/typing#981
https://bugs.python.org/issue46066
|
|
|
|
|
|
|
|
| |
The module parameter carries semantic information about the forward ref.
Show to the user that forward refs with same argument but different
module are different.
Co-authored-by: Andreas Hangauer <andreas.hangauer@siemens.com>
Co-authored-by: blurb-it[bot] <43283697+blurb-it[bot]@users.noreply.github.com>
|
| |
|
| |
|
|
|
|
| |
Co-authored-by: Pradeep Kumar Srinivasan <gohanpra@gmail.com>
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
|
|
| |
(These should arguably be docstrings per convention in the rest of the file, but it doesn't really matter.)
|
| |
|
| |
|
|
|
|
| |
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
|