Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | gh-114053: Fix another edge case involving `get_type_hints`, PEP 695 and PEP ↵ | Alex Waygood | 2024-06-25 | 1 | -7/+16 |
| | | | | 563 (#120272) | ||||
* | gh-119180: PEP 649 compiler changes (#119361) | Jelle Zijlstra | 2024-06-11 | 1 | -4/+19 |
| | |||||
* | gh-119180: PEP 649: Add __annotate__ attributes (#119209) | Jelle Zijlstra | 2024-05-22 | 1 | -0/+1 |
| | |||||
* | Rename typing._collect_parameters (#118900) | Jelle Zijlstra | 2024-05-10 | 1 | -7/+17 |
| | | | | | | | | | | | Unfortunately, released versions of typing_extensions monkeypatch this function without the extra parameter, which makes it so things break badly if current main is used with typing_extensions. Fortunately, the monkeypatching is not needed on Python 3.13, because CPython now implements PEP 696. By renaming the function, we prevent the monkeypatch from breaking typing.py internals. We keep the old name (raising a DeprecationWarning) to help other external users who call it. | ||||
* | gh-118803: Remove `ByteString` from `typing` and `collections.abc` (#118804) | Nikita Sobolev | 2024-05-08 | 1 | -19/+0 |
| | |||||
* | gh-118772: Allow TypeVars without a default to follow those with a default ↵ | Jelle Zijlstra | 2024-05-08 | 1 | -10/+15 |
| | | | | when constructing aliases (#118774) | ||||
* | gh-118660: Add second type parameter to (Async)ContextManager (#118681) | Jelle Zijlstra | 2024-05-07 | 1 | -1/+1 |
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-118418: Deprecate failing to pass a value to the *type_params* parameter ↵ | Alex Waygood | 2024-05-07 | 1 | -11/+30 |
| | | | | of some private `typing` APIs (#118695) | ||||
* | gh-118647: Add defaults to typing.Generator and typing.AsyncGenerator (#118648) | Jelle Zijlstra | 2024-05-06 | 1 | -5/+16 |
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Nikita Sobolev <mail@sobolevn.me> | ||||
* | gh-118465: Add __firstlineno__ attribute to class (GH-118475) | Serhiy Storchaka | 2024-05-06 | 1 | -1/+1 |
| | | | | It is set by compiler with the line number of the first line of the class definition. | ||||
* | gh-116126: Implement PEP 696 (#116129) | Jelle Zijlstra | 2024-05-03 | 1 | -24/+71 |
| | | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com> | ||||
* | gh-118418: Use a default value for `type_params` in `typing._eval_type` ↵ | Nikita Sobolev | 2024-04-30 | 1 | -2/+2 |
| | | | | (#118431) | ||||
* | gh-118168: Fix Unpack interaction with builtin aliases (#118169) | Jelle Zijlstra | 2024-04-23 | 1 | -2/+3 |
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-114053: Fix bad interaction of PEP-695, PEP-563 and ``get_type_hints`` ↵ | Alex Waygood | 2024-04-19 | 1 | -8/+27 |
| | | | | | | (#118009) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> | ||||
* | gh-117516: Implement typing.TypeIs (#117517) | Jelle Zijlstra | 2024-04-09 | 1 | -11/+85 |
| | | | | | | See PEP 742. Co-authored-by: Carl Meyer <carl@oddbird.net> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com> | ||||
* | gh-117521: Improve typing.TypeGuard docstring (#117522) | Jelle Zijlstra | 2024-04-04 | 1 | -11/+14 |
| | |||||
* | gh-117110: Fix subclasses of typing.Any with custom constructors (#117111) | 傅立业(Chris Fu) | 2024-03-29 | 1 | -1/+1 |
| | |||||
* | gh-115775: Compiler adds __static_attributes__ field to classes (#115913) | Irit Katriel | 2024-03-26 | 1 | -1/+1 |
| | |||||
* | gh-116127: PEP-705: Add `ReadOnly` support for `TypedDict` (#116350) | Nikita Sobolev | 2024-03-12 | 1 | -10/+73 |
| | | | Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> | ||||
* | gh-89547: Support for nesting special forms like Final (#116096) | Mehdi Drissi | 2024-03-12 | 1 | -2/+2 |
| | |||||
* | gh-116325: Raise `SyntaxError` rather than `IndexError` on ForwardRef with ↵ | Nikita Sobolev | 2024-03-05 | 1 | -1/+1 |
| | | | | empty string arg (#116341) | ||||
* | gh-112281: Allow `Union` with unhashable `Annotated` metadata (#112283) | Nikita Sobolev | 2024-03-01 | 1 | -14/+31 |
| | | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-115165: Fix `typing.Annotated` for immutable types (#115213) | dave-shawley | 2024-02-09 | 1 | -1/+3 |
| | | | | The return value from an annotated callable can raise any exception from __setattr__ for the `__orig_class__` property. | ||||
* | gh-112903: Handle non-types in _BaseGenericAlias.__mro_entries__() (#115191) | Carl Meyer | 2024-02-09 | 1 | -1/+21 |
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-113320: Reduce the number of dangerous `getattr()` calls when ↵ | Alex Waygood | 2024-01-05 | 1 | -18/+28 |
| | | | | | | | constructing protocol classes (#113401) - Only attempt to figure out whether protocol members are "method members" or not if the class is marked as a runtime protocol. This information is irrelevant for non-runtime protocols; we can safely skip the risky introspection for them. - Only do the risky getattr() calls in one place (the runtime_checkable class decorator), rather than in three places (_ProtocolMeta.__init__, _ProtocolMeta.__instancecheck__ and _ProtocolMeta.__subclasscheck__). This reduces the number of locations in typing.py where the risky introspection could go wrong. - For runtime protocols, if determining whether a protocol member is callable or not fails, give a better error message. I think it's reasonable for us to reject runtime protocols that have members which raise strange exceptions when you try to access them. PEP-544 clearly states that all protocol member must be callable for issubclass() calls against the protocol to be valid -- and if a member raises when we try to access it, there's no way for us to figure out whether it's a callable member or not! | ||||
* | gh-113255: Clarify docs for `typing.reveal_type` (#113286) | Kir | 2023-12-20 | 1 | -2/+2 |
| | | | Co-authored-by: AlexWaygood <alex.waygood@gmail.com> | ||||
* | gh-74690: Avoid a costly type check where possible in ↵ | Alex Waygood | 2023-12-04 | 1 | -3/+19 |
| | | | | `_ProtocolMeta.__subclasscheck__` (#112717) | ||||
* | gh-74690: Optimise `isinstance()` and `issubclass()` calls against ↵ | Alex Waygood | 2023-12-04 | 1 | -3/+11 |
| | | | | runtime-checkable protocols by avoiding costly `super()` calls (#112708) | ||||
* | gh-112618: Make `Annotated` cache typed (#112619) | Nikita Sobolev | 2023-12-02 | 1 | -5/+6 |
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-112509: Fix keys being present in both required_keys and optional_keys in ↵ | Jelle Zijlstra | 2023-11-29 | 1 | -5/+20 |
| | | | | | TypedDict (#112512) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-111874: Call `__set_name__` on objects that define the method inside a ↵ | Alex Waygood | 2023-11-27 | 1 | -3/+18 |
| | | | | | `typing.NamedTuple` class dictionary as part of the creation of that class (#111876) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> | ||||
* | gh-112345: `typing.Protocol`: Let failed subclasscheck show non-method ↵ | Randolf Scholz | 2023-11-24 | 1 | -1/+6 |
| | | | | | members (#112344) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-112194: Convert more examples to doctests in `typing.py` (#112195) | Nikita Sobolev | 2023-11-17 | 1 | -31/+43 |
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-112155: Run `typing.py` doctests as part of `test_typing` (#112156) | Nikita Sobolev | 2023-11-16 | 1 | -2/+2 |
| | |||||
* | GH-112152: Fix typo in `typing.override` docstring (#112158) | Qua27 | 2023-11-16 | 1 | -1/+1 |
| | |||||
* | gh-110682: Ignore `__match_args__` from `__instancecheck__` in protocols ↵ | Nikita Sobolev | 2023-10-12 | 1 | -1/+2 |
| | | | | | (#110683) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | gh-110180: Remove unused `_PickleUsingNameMixin` class from `typing` (#110181) | Alex Waygood | 2023-10-01 | 1 | -7/+0 |
| | |||||
* | gh-109653: `typing.py`: improve import time by creating soft-deprecated ↵ | Alex Waygood | 2023-09-23 | 1 | -8/+18 |
| | | | | | members on demand (#109651) Co-authored-by: Thomas Grainger <tagrain@gmail.com> | ||||
* | gh-109543: Remove unnecessary hasattr check (#109544) | Jelle Zijlstra | 2023-09-20 | 1 | -2/+1 |
| | | | | Also added a new test case covering the scenario I thought this might be about. | ||||
* | gh-105509: Simplify implementation of `typing.Annotated` (#105510) | Alex Waygood | 2023-09-01 | 1 | -25/+13 |
| | |||||
* | gh-106309: Deprecate typing.no_type_check_decorator (#106312) | Alex Waygood | 2023-07-13 | 1 | -0/+2 |
| | |||||
* | gh-105974: Revert unintentional behaviour change for protocols with ↵ | Alex Waygood | 2023-06-23 | 1 | -32/+33 |
| | | | | non-callable members and custom `__subclasshook__` methods (#105976) | ||||
* | gh-105570: Deprecate unusual ways of creating empty TypedDicts (#105780) | Alex Waygood | 2023-06-14 | 1 | -2/+17 |
| | | | Deprecate two methods of creating typing.TypedDict classes with 0 fields using the functional syntax: `TD = TypedDict("TD")` and `TD = TypedDict("TD", None)`. Both will be disallowed in Python 3.15. To create a TypedDict class with 0 fields, either use `class TD(TypedDict): pass` or `TD = TypedDict("TD", {})`. | ||||
* | gh-105566: Deprecate unusual ways of creating `typing.NamedTuple` classes ↵ | Alex Waygood | 2023-06-14 | 1 | -3/+45 |
| | | | | | | | (#105609) Deprecate creating a typing.NamedTuple class using keyword arguments to denote the fields (`NT = NamedTuple("NT", x=int, y=str)`). This will be disallowed in Python 3.15. Use the class-based syntax or the functional syntax instead. Two methods of creating `NamedTuple` classes with 0 fields using the functional syntax are also deprecated, and will be disallowed in Python 3.15: `NT = NamedTuple("NT")` and `NT = NamedTuple("NT", None)`. To create a `NamedTuple` class with 0 fields, either use `class NT(NamedTuple): pass` or `NT = NamedTuple("NT", [])`. | ||||
* | gh-104873: Add typing.get_protocol_members and typing.is_protocol (#104878) | Jelle Zijlstra | 2023-06-14 | 1 | -0/+42 |
| | | | Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> | ||||
* | Miscellaneous improvements to the typing docs (#105529) | Alex Waygood | 2023-06-09 | 1 | -6/+6 |
| | | | Mostly, these are changes so that we use shorter sentences and shorter paragraphs. In particular, I've tried to make the first sentence introducing each object in the typing API short and declarative. | ||||
* | Further improve docs for `typing.Annotated` (#105498) | Alex Waygood | 2023-06-08 | 1 | -6/+8 |
| | |||||
* | typing: Improve documentation of generic classes and aliases (#105369) | Alex Waygood | 2023-06-07 | 1 | -3/+5 |
| | |||||
* | gh-105430: Remove `typing._Immutable` unused internal helper (#105434) | Nikita Sobolev | 2023-06-07 | 1 | -11/+0 |
| | |||||
* | gh-105286: Further improvements to `typing.py` docstrings (#105363) | Alex Waygood | 2023-06-07 | 1 | -25/+43 |
| |