diff options
-rw-r--r-- | prolog/engine.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/prolog/engine.py b/prolog/engine.py index bd1fb1d..d61c43b 100644 --- a/prolog/engine.py +++ b/prolog/engine.py @@ -132,8 +132,11 @@ def check_answers(engine, query, answers, timeout=10): start = time.monotonic() try: + # Limit inferences for each solution to curb unbounded recursion. + limited = '''(call_with_inference_limit(({}), 100000, _ILR), + _ILR \= inference_limit_exceeded)'''.format(query) # Run the query. - reply, output = ask(engine, query, timeout) + reply, output = ask(engine, limited, timeout) answer, error, more = process_answer(reply) if not check_answer(answer): return False |