summaryrefslogtreecommitdiff
path: root/bitbake
diff options
context:
space:
mode:
authorRichard Purdie <rpurdie@linux.intel.com>2010-09-26 15:33:19 +0800
committerRichard Purdie <rpurdie@linux.intel.com>2010-09-28 12:05:15 +0100
commitd85dc37b736f789780e9ceefc00ed16e0db7d90a (patch)
tree9605bfc9ead4333bb0f8b32fb08b2f91b644d480 /bitbake
parentcf09c7a1e35a0dc3219fa196e8811c50957be4a2 (diff)
downloadopenembedded-core-d85dc37b736f789780e9ceefc00ed16e0db7d90a.tar.gz
openembedded-core-d85dc37b736f789780e9ceefc00ed16e0db7d90a.tar.bz2
openembedded-core-d85dc37b736f789780e9ceefc00ed16e0db7d90a.zip
codeparser.py: Fix storing of hash values as object references can be corrupted
Signed-off-by: Richard Purdie <rpurdie@linux.intel.com>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/codeparser.py19
1 files changed, 11 insertions, 8 deletions
diff --git a/bitbake/lib/bb/codeparser.py b/bitbake/lib/bb/codeparser.py
index 7d40835cb8..ba3009212b 100644
--- a/bitbake/lib/bb/codeparser.py
+++ b/bitbake/lib/bb/codeparser.py
@@ -4,7 +4,7 @@ from bb import msg, utils
import ast
import codegen
-PARSERCACHE_VERSION = 1
+PARSERCACHE_VERSION = 2
try:
import cPickle as pickle
@@ -177,11 +177,11 @@ class PythonParser():
def parse_python(self, node):
- h = hash(node)
+ h = hash(str(node))
if h in pythonparsecache:
- self.references = pythonparsecache[h].references
- self.execs = pythonparsecache[h].execs
+ self.references = pythonparsecache[h]["refs"]
+ self.execs = pythonparsecache[h]["execs"]
return
code = compile(check_indent(str(node)), "<string>", "exec",
@@ -196,7 +196,9 @@ class PythonParser():
self.references.update(visitor.var_execs)
self.execs = visitor.direct_func_calls
- pythonparsecache[h] = self
+ pythonparsecache[h] = {}
+ pythonparsecache[h]["refs"] = self.references
+ pythonparsecache[h]["execs"] = self.execs
class ShellParser():
def __init__(self):
@@ -209,10 +211,10 @@ class ShellParser():
commands it executes.
"""
- h = hash(value)
+ h = hash(str(value))
if h in shellparsecache:
- self.execs = shellparsecache[h].execs
+ self.execs = shellparsecache[h]["execs"]
return self.execs
try:
@@ -224,7 +226,8 @@ class ShellParser():
self.process_tokens(token)
self.execs = set(cmd for cmd in self.allexecs if cmd not in self.funcdefs)
- shellparsecache[h] = self
+ shellparsecache[h] = {}
+ shellparsecache[h]["execs"] = self.execs
return self.execs