From a125f24d29fd8275be7283a2edca9abc125703d7 Mon Sep 17 00:00:00 2001 From: John Wiegley Date: Thu, 1 Mar 2012 23:40:02 -0600 Subject: Allow --options to be added by the user in Python --- src/pyinterp.cc | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/pyinterp.cc') diff --git a/src/pyinterp.cc b/src/pyinterp.cc index 048f5a39..3157079a 100644 --- a/src/pyinterp.cc +++ b/src/pyinterp.cc @@ -419,10 +419,19 @@ expr_t::ptr_op_t python_interpreter_t::lookup(const symbol_t::kind_t kind, } break; - case symbol_t::OPTION: + case symbol_t::OPTION: { if (option_t * handler = lookup_option(name.c_str())) return MAKE_OPT_HANDLER(python_interpreter_t, handler); + + string option_name(string("option_") + name); + if (is_initialized && main_nspace.has_key(option_name.c_str())) { + DEBUG("python.interp", "Python lookup option: " << option_name); + + if (python::object obj = main_nspace.get(option_name.c_str())) + return WRAP_FUNCTOR(functor_t(obj, option_name)); + } break; + } case symbol_t::PRECOMMAND: { const char * p = name.c_str(); -- cgit v1.2.3