From 5aa6964a5ca60dff5c5ab40b968d92b49bd13b3d Mon Sep 17 00:00:00 2001 From: Alex Waygood Date: Wed, 26 Jul 2023 21:12:18 +0100 Subject: [PATCH] gh-104050: Argument clinic: Annotate `str_converter_key()` (#107294) --- Tools/clinic/clinic.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/Tools/clinic/clinic.py b/Tools/clinic/clinic.py index 2d804c96f86c3c..34cc4014b35b43 100755 --- a/Tools/clinic/clinic.py +++ b/Tools/clinic/clinic.py @@ -3624,10 +3624,14 @@ class buffer: pass class rwbuffer: pass class robuffer: pass -def str_converter_key(types, encoding, zeroes): +StrConverterKeyType = tuple[frozenset[type], bool, bool] + +def str_converter_key( + types: TypeSet, encoding: bool | str | None, zeroes: bool +) -> StrConverterKeyType: return (frozenset(types), bool(encoding), bool(zeroes)) -str_converter_argument_map: dict[str, str] = {} +str_converter_argument_map: dict[StrConverterKeyType, str] = {} class str_converter(CConverter): type = 'const char *'