summaryrefslogtreecommitdiff
path: root/prolog
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2014-12-11 10:34:49 +0100
committerAleš Smodiš <aless@guru.si>2015-08-11 14:26:00 +0200
commit5a226f8bb4437640e9791d7fcef6d3a62db52aeb (patch)
tree4ad7da7991254a91e0908cb758a1644f7289f14e /prolog
parent9999cc8c54f5307baca61a1178e97e94dfa932ac (diff)
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.
Diffstat (limited to 'prolog')
-rw-r--r--prolog/engine.py8
1 files changed, 7 insertions, 1 deletions
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)')])