]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-104146: Argument clinic: Remove dead code flagged by mypy's `truthy-bool` check...
authorAlex Waygood <Alex.Waygood@Gmail.com>
Fri, 4 Aug 2023 13:28:13 +0000 (14:28 +0100)
committerGitHub <noreply@github.com>
Fri, 4 Aug 2023 13:28:13 +0000 (13:28 +0000)
Tools/clinic/clinic.py
Tools/clinic/mypy.ini

index ee5e0ef70f20f982c1b33a2e6f096719a9251335..6c5a2c7c857c53d7cab727786b07ffd4b36b6d56 100755 (executable)
@@ -886,9 +886,7 @@ class CLanguage(Language):
         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
@@ -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
@@ -4790,8 +4788,6 @@ class DSLParser:
         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)
index 4cfc05bec01608ef163ab9da31905422aa1c924d..b1fdad673c61a10a77f2615b2f67e000dae911a0 100644 (file)
@@ -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