All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] data_smart: Don't use mutable objects as default args
@ 2015-01-29 14:35 Richard Purdie
  2015-01-29 16:10 ` Christopher Larson
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Purdie @ 2015-01-29 14:35 UTC (permalink / raw)
  To: bitbake-devel

These only have one instance created which means your subsequent datastores
can contain echos of previous ones. Obviously this is not the behaviour
we want/expect. It doesn't affect bitbake too badly as we only have one
datastore, it does massively potentially break our selftests though.

Thanks to Tim Amsell for pointing out the now obvious problem!

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>

diff --git a/bitbake/lib/bb/data_smart.py b/bitbake/lib/bb/data_smart.py
index 68d273b..b1ea33f 100644
--- a/bitbake/lib/bb/data_smart.py
+++ b/bitbake/lib/bb/data_smart.py
@@ -296,9 +296,14 @@ class VariableHistory(object):
                 self.variables[var] = []
 
 class DataSmart(MutableMapping):
-    def __init__(self, special = COWDictBase.copy(), seen = COWDictBase.copy() ):
+    def __init__(self, special = None, seen = None ):
         self.dict = {}
 
+        if special is None:
+            special = COWDictBase.copy()
+        if seen is None:
+            seen = COWDictBase.copy()
+
         self.inchistory = IncludeHistory()
         self.varhistory = VariableHistory(self)
         self._tracking = False




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] data_smart: Don't use mutable objects as default args
  2015-01-29 14:35 [PATCH] data_smart: Don't use mutable objects as default args Richard Purdie
@ 2015-01-29 16:10 ` Christopher Larson
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Larson @ 2015-01-29 16:10 UTC (permalink / raw)
  To: Richard Purdie; +Cc: bitbake-devel

[-- Attachment #1: Type: text/plain, Size: 770 bytes --]

On Thu, Jan 29, 2015 at 7:35 AM, Richard Purdie <
richard.purdie@linuxfoundation.org> wrote:

> These only have one instance created which means your subsequent datastores
> can contain echos of previous ones. Obviously this is not the behaviour
> we want/expect. It doesn't affect bitbake too badly as we only have one
> datastore, it does massively potentially break our selftests though.
>
> Thanks to Tim Amsell for pointing out the now obvious problem!
>
> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
>

Wow, obvious indeed, once you look at it. Nicely spotted, Tim.
-- 
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics

[-- Attachment #2: Type: text/html, Size: 1219 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-29 16:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-01-29 14:35 [PATCH] data_smart: Don't use mutable objects as default args Richard Purdie
2015-01-29 16:10 ` Christopher Larson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.