From 5a226f8bb4437640e9791d7fcef6d3a62db52aeb Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Thu, 11 Dec 2014 10:34:49 +0100 Subject: PrologEngine: disable autoload Turns out unix:dup/2 exists and is autoloaded if the student solution for dup/2 does not contain the predicate with this name; this can mess up subsequent tests. --- prolog/engine.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'prolog') diff --git a/prolog/engine.py b/prolog/engine.py index f94a6ab..26215f8 100644 --- a/prolog/engine.py +++ b/prolog/engine.py @@ -89,13 +89,19 @@ class PrologEngine(object): 'message_to_string/2': PL_predicate(b'message_to_string', 2, None), 'read_term_from_atom/3': PL_predicate(b'read_term_from_atom', 3, None), 'safe_goal/1': PL_predicate(b'safe_goal', 1, None), - 'set_prolog_stack/2': PL_predicate(b'set_prolog_stack', 2, None) + 'set_prolog_flag/2': PL_predicate(b'set_prolog_flag', 2, None), + 'set_prolog_stack/2': PL_predicate(b'set_prolog_stack', 2, None), + 'use_module/1': PL_predicate(b'use_module', 1, None) } self.err_flags = PL_Q_NODEBUG|PL_Q_CATCH_EXCEPTION # Load the sandbox and compatibility library. self.call('consult/1', [Term(Atom('prolog/lib.pl'))]) + # Load the time module (for call_with_time_limit) then disable autoload. + self.call('use_module/1', [Term('library(time)')]) + self.call('set_prolog_flag/2', [Term('autoload'), Term('false')]) + # Increase memory limits. self.call('set_prolog_stack/2', [Term('global'), Term('limit(2*10**9)')]) self.call('set_prolog_stack/2', [Term('local'), Term('limit(2*10**9)')]) -- cgit v1.2.1