Skip to content

Commit 5fc7e12

Browse files
committed
pythongh-104146: Argument clinic: Remove dead code flagged by mypy's truthy-bool check
1 parent ac7605e commit 5fc7e12

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

Tools/clinic/clinic.py

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

888888
has_option_groups = parameters and (parameters[0].group or parameters[-1].group)
889-
default_return_converter = (not f.return_converter or
890-
f.return_converter.type == 'PyObject *')
891-
889+
default_return_converter = f.return_converter.type == 'PyObject *'
892890
new_or_init = f.kind.new_or_init
893891

894892
vararg: int | str = NO_VARARG
@@ -4428,7 +4426,7 @@ class DSLParser:
44284426
keyword_only: bool
44294427
positional_only: bool
44304428
group: int
4431-
parameter_state: int
4429+
parameter_state: ParamState
44324430
seen_positional_with_default: bool
44334431
indent: IndentStack
44344432
kind: FunctionKind
@@ -4790,8 +4788,6 @@ def state_modulename_name(self, line: str) -> None:
47904788
if not return_converter:
47914789
return_converter = CReturnConverter()
47924790

4793-
if not module:
4794-
fail("Undefined module used in declaration of {full_name.strip()!r}.")
47954791
self.function = Function(name=function_name, full_name=full_name, module=module, cls=cls, c_basename=c_basename,
47964792
return_converter=return_converter, kind=self.kind, coexist=self.coexist)
47974793
self.block.signatures.append(self.function)

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)