Skip to content

Commit

Permalink
Argument Clinic: fix bare "type" in annotations
Browse files Browse the repository at this point in the history
Bare "type" in annotations should be equivalent to "type[Any]"; see
https://discuss.python.org/t/inconsistencies-between-type-and-type/37404
and python/mypy#16366. It's better to use "type[object]", which is
safer and unambiguous.
  • Loading branch information
JelleZijlstra committed Dec 10, 2023
1 parent 23df46a commit 5fa931a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -3184,7 +3184,7 @@ def closure(f: CConverterClassT) -> CConverterClassT:

class CConverterAutoRegister(type):
def __init__(
cls, name: str, bases: tuple[type, ...], classdict: dict[str, Any]
cls, name: str, bases: tuple[type[object], ...], classdict: dict[str, Any]
) -> None:
converter_cls = cast(type["CConverter"], cls)
add_c_converter(converter_cls)
Expand Down Expand Up @@ -4347,7 +4347,7 @@ class buffer: pass
class rwbuffer: pass
class robuffer: pass

StrConverterKeyType = tuple[frozenset[type], bool, bool]
StrConverterKeyType = tuple[frozenset[type[object]], bool, bool]

def str_converter_key(
types: TypeSet, encoding: bool | str | None, zeroes: bool
Expand Down Expand Up @@ -4846,7 +4846,7 @@ class CReturnConverterAutoRegister(type):
def __init__(
cls: ReturnConverterType,
name: str,
bases: tuple[type, ...],
bases: tuple[type[object], ...],
classdict: dict[str, Any]
) -> None:
add_c_return_converter(cls)
Expand Down

0 comments on commit 5fa931a

Please sign in to comment.