Skip to content

Instantly share code, notes, and snippets.

@rcurtin
Created February 7, 2018 00:27
Show Gist options
  • Save rcurtin/42385b2d723697824ddb371bfd42eb93 to your computer and use it in GitHub Desktop.
Save rcurtin/42385b2d723697824ddb371bfd42eb93 to your computer and use it in GitHub Desktop.
Fix too-early programName access
diff --git a/src/mlpack/bindings/python/py_option.hpp b/src/mlpack/bindings/python/py_option.hpp
index b25be68a4..e85e8fb52 100644
--- a/src/mlpack/bindings/python/py_option.hpp
+++ b/src/mlpack/bindings/python/py_option.hpp
@@ -69,7 +69,8 @@ class PyOption
data.value = boost::any(defaultValue);
// Restore the parameters for this program.
- CLI::RestoreSettings(programName, false);
+ if (identifier != "verbose" && identifier != "copy_all_inputs")
+ CLI::RestoreSettings(programName, false);
// Set the function pointers that we'll need. All of these function
// pointers will be used by both the program that generates the pyx, and
@@ -94,7 +95,8 @@ class PyOption
// import more than one .so that uses CLI, so we have to keep the options
// separate. programName is a global variable from mlpack_main.hpp.
CLI::Add(std::move(data));
- CLI::StoreSettings(programName);
+ if (identifier != "verbose" && identifier != "copy_all_inputs")
+ CLI::StoreSettings(programName);
CLI::ClearSettings();
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment