csound/csound-sanitize-sys.patch

23 lines
730 B
Diff

--- a/frontends/CsoundVST/Shell.cpp
+++ b/frontends/CsoundVST/Shell.cpp
@@ -211,6 +211,8 @@ namespace csound
void Shell::main(int argc, char **argv)
{
PySys_SetArgv_(argc, argv);
+ /* Sanitize sys.path */
+ PyRun_SimpleString_("import sys; sys.path = filter(None, sys.path)");
}
void Shell::initialize()
--- a/frontends/CsoundVST/ScoreGeneratorVst.cpp
+++ b/frontends/CsoundVST/ScoreGeneratorVst.cpp
@@ -427,6 +427,8 @@
Shell::open();
char *argv[] = {"",""};
PySys_SetArgv(1, argv);
+ /* Sanitize sys.path */
+ PyRun_SimpleString("import sys; sys.path = filter(None, sys.path)");
PyObject *mainModule = PyImport_ImportModule("__main__");
result = runScript("import sys\n");
if(result)