[Scons-users] env.Dictionary bug? doc problem?
Bill Deegan
bill at baddogconsulting.com
Mon Jul 23 11:13:00 EDT 2018
Any internal non-test impact?
On Mon, Jul 23, 2018 at 7:46 AM, Mats Wichmann <mats at wichmann.us> wrote:
> On 07/23/2018 07:51 AM, Mats Wichmann wrote:
> > On 07/22/2018 12:26 PM, Bill Deegan wrote:
> >> Can you check if any internal usage depends on this slicing behavior?
> >>
> >> -Bill
> >
> > Plenty of impacts.
> >
> > A bunch of tests are written to the idea that Dictionary(key) returns
> > key's value, not a subset of the dictionary.
>
> looks like there's also an expectation that Dictionary() returns a view,
> not a new dictionary, such that modifying something through a Dictionary
> call "sticks". See the below test code - the modification of env2
> through its Dictionary() - this will not work if Dictionary returns a
> newly constructed dict, as I had imagined.
>
> # Ensure that lists and dictionaries are
> # deep copied, but not instances.
> class TestA(object):
> pass
> env1 = self.TestEnvironment(XXX=TestA(), YYY = [ 1, 2, 3 ],
> ZZZ = { 1:2, 3:4 })
> env2=env1.Clone()
> env2.Dictionary('YYY').append(4)
> env2.Dictionary('ZZZ')[5] = 6
> assert env1.Dictionary('XXX') is env2.Dictionary('XXX')
> assert 4 in env2.Dictionary('YYY')
> assert not 4 in env1.Dictionary('YYY')
> assert 5 in env2.Dictionary('ZZZ')
> assert 5 not in env1.Dictionary('ZZZ')
>
> Not really sure what to do with this.
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20180723/885cc01f/attachment.html>
More information about the Scons-users
mailing list