Skip to content

Conversation

@mwichmann
Copy link
Collaborator

Eliminate a kwarg explain from the call to Builder() for Mkdir. Arg is not used (maybe it was in the past, though have not found the evidence for this), which meant we had an override dict in this case. Suprisingly, this ended up in the override logic a lot in a build of a large sample project - over 2000 extra calls to scons_subst_once that weren't needed.

Builder and Executor both have places where they call Override(). While the Override factory indeed returns quickly if the override dict is empty, avoid the function call entirely in this case by checking (there was an old TODO comment to this effect in Builder.__init__.py).

The Executor init method declared multiple paramters with mutable defaults, which means they "persist". While there's no evidence this is calling a real problem, eliminate part of this footgun by defaulting overridelist and builder_kw to None and checking for that (targets and sources still default to a mutable empty list, a TBD perhaps).

There are no user-visible effects to these changes; existing tests have been run and indicate no impacts. Thus, there are no doc or test changes included.

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

@mwichmann mwichmann added the maintenance Tasks to maintain internal SCons code/tools label Nov 20, 2025
Eliminate a kwarg 'explain' from the call to Builder() for Mkdir.  Arg is
not used (maybe it was in the past, though have not found the evidence
for this), which meant we had an override dict in this case. Suprisingly,
this ended up in the override logic a *lot* in a build of a large sample
project - over 2000 extra calls to scons_subst_once that weren't needed.

Builder and Executor both have places where they call Override().
While the Override factory indeed returns quickly if the override dict
is empty, avoid the function call entirely in this case by checking
(there was an old TODO comment to this effect in Builder.__init__.py).

The Executor init method declared multiple paramters with mutable
defaults, which means they "persist". While there's no evidence this
is calling a real problem, eliminate part of this footgun by defaulting
overridelist and builder_kw to None and checking for that (targets and
sources still default to a mutable empty list, a TBD perhaps).

Signed-off-by: Mats Wichmann <[email protected]>
@mwichmann mwichmann force-pushed the maint/less-overrides branch from 99bbead to 4f3501f Compare November 21, 2025 13:50
@mwichmann mwichmann moved this to In review in Next Release Nov 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintenance Tasks to maintain internal SCons code/tools

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

1 participant