From b90852e6e3deac24bf6885b7cacb3d1848c8551e Mon Sep 17 00:00:00 2001 From: Avasam Date: Sun, 2 Nov 2025 14:20:08 -0500 Subject: [PATCH 1/2] type Command.force --- distutils/cmd.py | 2 +- distutils/command/build_ext.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/distutils/cmd.py b/distutils/cmd.py index 072f0f72..f2b5b964 100644 --- a/distutils/cmd.py +++ b/distutils/cmd.py @@ -102,7 +102,7 @@ def __init__(self, dist: Distribution) -> None: # timestamps, but methods defined *here* assume that # 'self.force' exists for all commands. So define it here # just to be safe. - self.force = None + self.force: bool | None = None # The 'help' flag is just used for command-line parsing, so # none of that complicated bureaucracy is needed. diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py index 85560be6..5e676adb 100644 --- a/distutils/command/build_ext.py +++ b/distutils/command/build_ext.py @@ -109,7 +109,7 @@ class build_ext(Command): ('help-compiler', None, "list available compilers", show_compilers), ] - def initialize_options(self): + def initialize_options(self) -> None: self.extensions = None self.build_lib = None self.plat_name = None @@ -125,7 +125,7 @@ def initialize_options(self): self.rpath = None self.link_objects = None self.debug = None - self.force = None + self.force: bool = None # Should always be set in finalize_options self.compiler = None self.swig = None self.swig_cpp = None From 73400e105ff23ffe2972a1335f54fd016ceef3a0 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 8 Jul 2026 12:23:19 -0400 Subject: [PATCH 2/2] Also override build_lib, plat_name, and build_temp. --- distutils/command/build_ext.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/distutils/command/build_ext.py b/distutils/command/build_ext.py index 5e676adb..01181bbe 100644 --- a/distutils/command/build_ext.py +++ b/distutils/command/build_ext.py @@ -111,9 +111,9 @@ class build_ext(Command): def initialize_options(self) -> None: self.extensions = None - self.build_lib = None - self.plat_name = None - self.build_temp = None + self.build_lib: str = None # Should always be set in finalize_options + self.plat_name: str = None # Should always be set in finalize_options + self.build_temp: str = None # Should always be set in finalize_options self.inplace = False self.package = None