Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions include/pybind11/detail/function_record_pyobject.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "common.h"

#include <cstring>
#include <utility>

PYBIND11_NAMESPACE_BEGIN(PYBIND11_NAMESPACE)
PYBIND11_NAMESPACE_BEGIN(detail)
Expand Down Expand Up @@ -188,9 +189,11 @@ inline PyObject *reduce_ex_impl(PyObject *self, PyObject *, PyObject *) {
&& PyModule_Check(rec->scope.ptr()) != 0) {
object scope_module = get_scope_module(rec->scope);
if (scope_module) {
return make_tuple(reinterpret_borrow<object>(PyEval_GetBuiltins())["eval"],
make_tuple(str("__import__('importlib').import_module('")
+ scope_module + str("')")))
auto builtins = reinterpret_borrow<dict>(PyEval_GetBuiltins());
auto builtins_eval = builtins["eval"];
auto reconstruct_args = make_tuple(str("__import__('importlib').import_module('")
+ scope_module + str("')"));
return make_tuple(std::move(builtins_eval), std::move(reconstruct_args))
.release()
.ptr();
}
Expand Down
Loading