Don't create yaql context

In the yaql function, we create and store a yaql context object that we
keep during the lifetime of the function. This is only needed for
evaluation, so let yaql create the context itself, and don't reference
it so that it's garbage collected.

Change-Id: If3015cf85dfe966f4f113eb7f70ee3f3e36e5399
Related-Bug: #1626675
This commit is contained in:
Thomas Herve 2016-10-04 11:52:40 +02:00
parent 80b2fb3155
commit 0830318707
1 changed files with 1 additions and 2 deletions

View File

@ -1041,7 +1041,6 @@ class Yaql(function.Function):
def __init__(self, stack, fn_name, args):
super(Yaql, self).__init__(stack, fn_name, args)
self._yaql_context = yaql.create_context()
if not isinstance(self.args, collections.Mapping):
raise TypeError(_('Arguments to "%s" must be a map.') %
@ -1079,7 +1078,7 @@ class Yaql(function.Function):
def result(self):
statement = self._parse(function.resolve(self._expression))
data = function.resolve(self._data)
return statement.evaluate({'data': data}, self._yaql_context)
return statement.evaluate({'data': data})
class Equals(function.Function):