Skip to content

Commit 1a199b5

Browse files
authored
PEP 746: small clarification to specification. (#3828)
1 parent e8273d3 commit 1a199b5

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

peps/pep-0746.rst

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,10 @@ The protocol being introduced would be defined as follows if it were to be defin
6363
When a static type checker encounters a type expression of the form ``Annotated[T, M1, M2, ...]``,
6464
it should enforce that for each metadata element in ``M1, M2, ...``, one of the following is true:
6565

66-
* The metadata element evaluates to a type that does not have a ``__supports_type__`` method; or
67-
* The metadata element evaluates to an object ``M`` that has a ``__supports_type__`` method, and
68-
a call to ``M.__supports_type__(T)`` type checks without errors (i.e., ``T`` is assignable to the
69-
parameter type of the ``__supports_type__`` method), and that call does not
70-
evaluate to ``Literal[False]``.
66+
* The metadata element evaluates to an object that does not have a ``__supports_type__`` attribute; or
67+
* The metadata element evaluates to an object ``M`` that implements the ``SupportsType`` protocol;
68+
and, with ``T`` instantiated to a value ``v``, a call to ``M.__supports_type__(v)`` type checks without errors;
69+
and that call does not evaluate to ``Literal[False]``.
7170

7271
The body of the ``__supports_type__`` method is not used to check the validity of the metadata
7372
and static type checkers can ignore it. However, tools that use the annotation at

0 commit comments

Comments
 (0)