Add py::exec() as a shortcut for py::eval<py::eval_statements>()

This commit is contained in:
Dean Moldovan
2017-04-30 01:53:06 +02:00
parent 0c4e0372a3
commit 076c738641
3 changed files with 25 additions and 12 deletions

View File

@@ -62,6 +62,15 @@ object eval(const char (&s)[N], object global = object(), object local = object(
return eval<mode>(expr, global, local);
}
inline void exec(str expr, object global = object(), object local = object()) {
eval<eval_statements>(expr, global, local);
}
template <size_t N>
void exec(const char (&s)[N], object global = object(), object local = object()) {
eval<eval_statements>(s, global, local);
}
template <eval_mode mode = eval_statements>
object eval_file(str fname, object global = object(), object local = object()) {
if (!global) {