[Scons-dev] Why are Builders excluded from env.Clone()?
Dirk Bächle
tshortik at gmx.de
Fri Dec 9 12:31:48 EST 2016
Hi Jonathon,
On 09.12.2016 18:03, Jonathon Reinhart wrote:
>
> [...]
>
> This behavior does appear to be intentional, however:
>
> builders = self._dict.get('BUILDERS', {})
>
> clone = copy.copy(self)
> # BUILDERS is not safe to do a simple copy
> clone._dict = semi_deepcopy_dict(self._dict, ['BUILDERS'])
> clone._dict['BUILDERS'] = BuilderDict(builders, clone)
>
please check issue #2821 (http://scons.tigris.org/issues/show_bug.cgi?id=2821) where the latest changes have been made in this area.
> BUILDERS is explicitly excluded in the semi_deepcopy_dict() call.
>
> My questions:
> - Why are Builders explicitly excluded from the env.Clone()?
Because it's possible that during the deep-copy, the original is altered too (see comment in BuilderDict::__semi_deepcopy__).
> - Would it be reasonable to add an optional argument to Clone()
> (e.g. really_deep) which causes Builders to not be excluded?
>
As the bug description reveals, no real cure has been found yet. If you have a solution that successfully deep-copies the BUILDERs
dict, and is guaranteed to leave the original environment intact...we'd definitely be happy to hear about it.
Best regards,
Dirk
More information about the Scons-dev
mailing list