Fixed #29: Parsers: Implement parsing memoization
Fixed #77 : Parser: ShortTermMemoryParser should be called separately Fixed #78 : Remove VariableNode usage Fixed #79 : ConceptManager: Implement compile caching Fixed #80 : SheerkaExecute : parsers_key is not correctly computed Fixed #81 : ValidateConceptEvaluator : Validate concept's where and pre clauses right after the parsing Fixed #82 : SheerkaIsAManager: isa() failed when the set as a body Fixed #83 : ValidateConceptEvaluator : Support BNF and SYA Concepts Fixed #84 : ExpressionParser: Implement the parser as a standard parser Fixed #85 : Services: Give order to services Fixed #86 : cannot manage smart_get_attr(the short, color)
This commit is contained in:
@@ -79,7 +79,8 @@ class PythonEvaluator(OneReturnValueEvaluator):
|
||||
# or if EVAL_QUESTION_REQUESTED is explicit
|
||||
# We need to disable the functions that may alter the state
|
||||
# It's a poor way to have source code security check
|
||||
expression_only = context.in_context(BuiltinConcepts.EVAL_QUESTION_REQUESTED)
|
||||
expression_only = context.in_context(BuiltinConcepts.EVAL_QUESTION_REQUESTED) or \
|
||||
context.in_context(BuiltinConcepts.VALIDATION_ONLY_REQUESTED)
|
||||
|
||||
if not expression_only:
|
||||
attr_under_eval = context.get_parents(lambda ec: ec.action == BuiltinConcepts.EVALUATING_ATTRIBUTE)
|
||||
@@ -92,6 +93,11 @@ class PythonEvaluator(OneReturnValueEvaluator):
|
||||
my_globals = self.get_globals(context, node, expression_only)
|
||||
debugger.debug_var("globals", my_globals)
|
||||
except MethodAccessError as ex:
|
||||
# Quick and dirty,
|
||||
# When VALIDATION_ONLY_REQUESTED is enabled, it's normal to have some NameError exceptions
|
||||
if context.in_context(BuiltinConcepts.VALIDATION_ONLY_REQUESTED):
|
||||
return sheerka.ret(self.name, False, BuiltinConcepts.METHOD_ACCESS_ERROR, parents=[return_value])
|
||||
|
||||
eval_error = PythonEvalError(ex,
|
||||
node.source,
|
||||
traceback.format_exc() if get_trace_back else None,
|
||||
|
||||
Reference in New Issue
Block a user