Skip to content

Commit e89f507

Browse files
committed
Fix mypy
1 parent a3f0c76 commit e89f507

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

Modules/clinic/_asynciomodule.c.h

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Tools/clinic/clinic.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2205,7 +2205,7 @@ def print_block(
22052205
*,
22062206
core_includes: bool = False,
22072207
limited_capi: bool,
2208-
header_includes: dict[str, str],
2208+
header_includes: dict[str, tuple[str, str]],
22092209
) -> None:
22102210
input = block.input
22112211
output = block.output
@@ -2238,14 +2238,13 @@ def print_block(
22382238
# Emit optional "#include" directives for C headers
22392239
output += '\n'
22402240

2241-
def sort_key(item):
2241+
def sort_key(item: tuple[str, tuple[str, str]]) -> tuple[str, str]:
22422242
include, reason_condition = item
22432243
reason, condition = reason_condition
22442244
# '#if' is before 'NO_CONDITION'
22452245
return (condition or 'NO_CONDITION', include)
22462246

2247-
current_condition = None
2248-
2247+
current_condition = ''
22492248
for include, reason_condition in sorted(header_includes.items(), key=sort_key):
22502249
reason, condition = reason_condition
22512250
if condition != current_condition:
@@ -2477,7 +2476,7 @@ def __init__(
24772476
self.functions: list[Function] = []
24782477
# dict: include name => reason
24792478
# Example: 'pycore_long.h' => '_PyLong_UnsignedShort_Converter()'
2480-
self.includes: dict[str, str] = {}
2479+
self.includes: dict[str, tuple[str, str]] = {}
24812480

24822481
self.line_prefix = self.line_suffix = ''
24832482

@@ -2551,7 +2550,7 @@ def add_include(self, name: str, reason: str, condition: str | None = None) -> N
25512550
# no need to list all of them.
25522551
return
25532552

2554-
self.includes[name] = (reason, condition)
2553+
self.includes[name] = (reason, condition or '')
25552554

25562555
def add_destination(
25572556
self,

0 commit comments

Comments
 (0)