Skip to content

Commit 0ad381c

Browse files
committed
pythongh-104146: Argument clinic: Remove dead code flagged by mypy's truthy-bool check
1 parent 2ba7c7f commit 0ad381c

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Diff for: Tools/clinic/clinic.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -884,9 +884,7 @@ def output_templates(
884884
converters = [p.converter for p in parameters]
885885

886886
has_option_groups = parameters and (parameters[0].group or parameters[-1].group)
887-
default_return_converter = (not f.return_converter or
888-
f.return_converter.type == 'PyObject *')
889-
887+
default_return_converter = f.return_converter.type == 'PyObject *'
890888
new_or_init = f.kind.new_or_init
891889

892890
vararg: int | str = NO_VARARG
@@ -4422,7 +4420,7 @@ class DSLParser:
44224420
keyword_only: bool
44234421
positional_only: bool
44244422
group: int
4425-
parameter_state: int
4423+
parameter_state: ParamState
44264424
seen_positional_with_default: bool
44274425
indent: IndentStack
44284426
kind: FunctionKind
@@ -4776,8 +4774,6 @@ def state_modulename_name(self, line: str) -> None:
47764774
if not return_converter:
47774775
return_converter = CReturnConverter()
47784776

4779-
if not module:
4780-
fail("Undefined module used in declaration of " + repr(full_name.strip()) + ".")
47814777
self.function = Function(name=function_name, full_name=full_name, module=module, cls=cls, c_basename=c_basename,
47824778
return_converter=return_converter, kind=self.kind, coexist=self.coexist)
47834779
self.block.signatures.append(self.function)

Diff for: Tools/clinic/mypy.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,5 @@ python_version = 3.10
88
# and be strict!
99
strict = True
1010
strict_concatenate = True
11-
enable_error_code = ignore-without-code,redundant-expr
11+
enable_error_code = ignore-without-code,redundant-expr,truthy-bool
1212
warn_unreachable = True

0 commit comments

Comments
 (0)