GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Relax TypeVar default ordering constraints · Issue #118772 · python/cpython Closed Labels 3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixestopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error DescriptionBug reportBug description:% ./python.exe Python 3.14.0a0 (heads/main-dirty:891fd12e52, May 8 2024, 09:02:37) [Clang 14.0.0 (clang-1400.0.29.202)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> from typing import * >>> T = TypeVar("T") >>> T_dflt = TypeVar("T_dflt", default=int) >>> Callable[[T_dflt], T] Traceback (most recent call last): File "<python-input-3>", line 1, in <module> Callable[[T_dflt], T] ~~~~~~~~^^^^^^^^^^^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 1717, in __getitem__ return self.__getitem_inner__(params) ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 431, in inner return func(*args, **kwds) File "/Users/jelle/py/cpython/Lib/typing.py", line 1730, in __getitem_inner__ return self.copy_with(params) ~~~~~~~~~~~~~~^^^^^^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 1702, in copy_with return _CallableGenericAlias(self.__origin__, params, name=self._name, inst=self._inst) File "/Users/jelle/py/cpython/Lib/typing.py", line 1419, in __init__ self.__parameters__ = _collect_parameters(args) ~~~~~~~~~~~~~~~~~~~^^^^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 296, in _collect_parameters raise TypeError(f'Type parameter {t!r} without a default' ' follows type parameter with a default') TypeError: Type parameter ~T without a default follows type parameter with a default This can reasonably happen if you have a generic class generic over a TypeVar with a default, and that TypeVar appears in a Callable parameter type annotation: We encountered this in Hypothesis. cc @Gobot1234 CPython versions tested on:CPython main branch Operating systems tested on:macOS Linked PRsActivity
MetadataMetadataAssigneesLabels3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixestopic-typingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error ProjectsMilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |