From ba9a3eadaff3b96608129380c0874636772da716 Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Wed, 10 Aug 2022 10:22:09 -0400 Subject: [PATCH] Revert "Disallow repeat calls to .initialize in one place." This reverts commit 3e4c7a78b337b1894daef40c7d2a980dd7ef18ce. --- distutils/_msvccompiler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/distutils/_msvccompiler.py b/distutils/_msvccompiler.py index 491fe87c78..ade80056e9 100644 --- a/distutils/_msvccompiler.py +++ b/distutils/_msvccompiler.py @@ -222,6 +222,7 @@ def __init__(self, verbose=0, dry_run=0, force=0): super().__init__(verbose, dry_run, force) # target platform (.plat_name is consistent with 'bdist') self.plat_name = None + self.initialized = False @classmethod def _configure(cls, vc_env): @@ -236,9 +237,8 @@ def _parse_path(val): return [dir.rstrip(os.sep) for dir in val.split(os.pathsep) if dir] def initialize(self, plat_name=None): - def _repeat_call_error(plat_name=None): - raise AssertionError("repeat initialize not allowed") - self.initialize = _repeat_call_error + # multi-init means we would need to check platform same each time... + assert not self.initialized, "don't init multiple times" if plat_name is None: plat_name = get_platform() # sanity check for platforms to prevent obscure errors later. @@ -314,6 +314,8 @@ def _repeat_call_error(plat_name=None): (CCompiler.SHARED_LIBRARY, True): self.ldflags_static_debug, } + self.initialized = True + # -- Worker methods ------------------------------------------------ def object_filenames(self, source_filenames, strip_dir=0, output_dir=''):