Skip to content

Commit 3b8438e

Browse files
bstaleticdrmoose
authored andcommitted
Do sys.path workaround in C++ rather than eval.
1 parent fb3de9f commit 3b8438e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

include/pybind11/embed.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ inline void set_interpreter_argv(int argc, char** argv, bool add_current_dir_to_
158158
// to work around CVE-2008-5983
159159
PySys_SetArgv(argc, pysys_argv);
160160
if (!add_current_dir_to_path)
161-
PyRun_SimpleString("import sys; sys.path.pop(0)\n");
161+
PyList_PopItem(py::module::import("sys").attr("path").ptr(), 0);
162162
#else
163163
PySys_SetArgvEx(argc, pysys_argv, add_current_dir_to_path ? 1 : 0);
164164
#endif

0 commit comments

Comments
 (0)