diff options
author | John Wiegley <johnw@newartisans.com> | 2009-02-08 21:16:29 -0400 |
---|---|---|
committer | John Wiegley <johnw@newartisans.com> | 2009-02-08 21:16:29 -0400 |
commit | 3924a3da10145ede4a831a58ac184d3658d48aca (patch) | |
tree | 3384088b961869f75ed60268f3145cec67b7fa36 /python/pyinterp.cc | |
parent | d4d7090f3c673f092fdc2bba54e41582c85cff8b (diff) | |
download | ledger-3924a3da10145ede4a831a58ac184d3658d48aca.tar.gz ledger-3924a3da10145ede4a831a58ac184d3658d48aca.tar.bz2 ledger-3924a3da10145ede4a831a58ac184d3658d48aca.zip |
pyinterp.cc shares global session; accept full paths passed to --import.
Diffstat (limited to 'python/pyinterp.cc')
-rw-r--r-- | python/pyinterp.cc | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/python/pyinterp.cc b/python/pyinterp.cc index 3648cdf4..fcd5d2c6 100644 --- a/python/pyinterp.cc +++ b/python/pyinterp.cc @@ -35,9 +35,12 @@ namespace ledger { using namespace boost::python; +shared_ptr<python_interpreter_t> python_session; + void export_chain(); void export_commodity(); void export_entry(); +void export_expr(); void export_flags(); void export_format(); void export_global(); @@ -57,6 +60,7 @@ void initialize_for_python() export_chain(); export_commodity(); export_entry(); + export_expr(); export_flags(); export_format(); export_global(); @@ -269,8 +273,7 @@ value_t python_interpreter_t::functor_t::operator()(call_scope_t& args) } else if (PyObject * err = PyErr_Occurred()) { PyErr_Print(); - throw_(calc_error, - "Failed call to Python function '" << name << "': " << err); + throw_(calc_error, "Failed call to Python function '" << name << "'"); } else { assert(false); } @@ -287,18 +290,4 @@ value_t python_interpreter_t::functor_t::operator()(call_scope_t& args) return NULL_VALUE; } -value_t python_interpreter_t::lambda_t::operator()(call_scope_t& args) -{ - try { - assert(args.size() == 1); - value_t item = args[0]; - return call<value_t>(func.ptr(), item); - } - catch (const error_already_set&) { - PyErr_Print(); - throw_(calc_error, "Failed to evaluate Python lambda expression"); - } - return NULL_VALUE; -} - } // namespace ledger |