Re: Why are Builders excluded from env.Clone()?

Dirk Bächle <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.devel
Message-ID <[email protected]>
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.