summaryrefslogtreecommitdiff
path: root/ext/pybind11/include/pybind11/eval.h
diff options
context:
space:
mode:
Diffstat (limited to 'ext/pybind11/include/pybind11/eval.h')
-rw-r--r--ext/pybind11/include/pybind11/eval.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/ext/pybind11/include/pybind11/eval.h b/ext/pybind11/include/pybind11/eval.h
index 204427d77..5b2b98272 100644
--- a/ext/pybind11/include/pybind11/eval.h
+++ b/ext/pybind11/include/pybind11/eval.h
@@ -95,8 +95,15 @@ object eval_file(str fname, object global = object(), object local = object()) {
pybind11_fail("File \"" + fname_str + "\" could not be opened!");
}
+#if PY_VERSION_HEX < 0x03000000 && defined(PYPY_VERSION)
+ PyObject *result = PyRun_File(f, fname_str.c_str(), start, global.ptr(),
+ local.ptr());
+ (void) closeFile;
+#else
PyObject *result = PyRun_FileEx(f, fname_str.c_str(), start, global.ptr(),
local.ptr(), closeFile);
+#endif
+
if (!result)
throw error_already_set();
return reinterpret_steal<object>(result);