Skip to content

gh-104146: Argument clinic: Remove dead code flagged by mypy's truthy-bool check #107627

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions Tools/clinic/clinic.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,9 +886,7 @@ def output_templates(
converters = [p.converter for p in parameters]

has_option_groups = parameters and (parameters[0].group or parameters[-1].group)
default_return_converter = (not f.return_converter or
f.return_converter.type == 'PyObject *')

default_return_converter = f.return_converter.type == 'PyObject *'
new_or_init = f.kind.new_or_init

vararg: int | str = NO_VARARG
Expand Down Expand Up @@ -4428,7 +4426,7 @@ class DSLParser:
keyword_only: bool
positional_only: bool
group: int
parameter_state: int
parameter_state: ParamState
seen_positional_with_default: bool
indent: IndentStack
kind: FunctionKind
Expand Down Expand Up @@ -4790,8 +4788,6 @@ def state_modulename_name(self, line: str) -> None:
if not return_converter:
return_converter = CReturnConverter()

if not module:
fail("Undefined module used in declaration of {full_name.strip()!r}.")
self.function = Function(name=function_name, full_name=full_name, module=module, cls=cls, c_basename=c_basename,
return_converter=return_converter, kind=self.kind, coexist=self.coexist)
self.block.signatures.append(self.function)
Expand Down
2 changes: 1 addition & 1 deletion Tools/clinic/mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ python_version = 3.10
# and be strict!
strict = True
strict_concatenate = True
enable_error_code = ignore-without-code,redundant-expr
enable_error_code = ignore-without-code,redundant-expr,truthy-bool
warn_unreachable = True