Fix bug 1764407 - the -i switch now does the right thing when using the -m switch

This commit is contained in:
Nick Coghlan 2007-08-25 10:50:41 +00:00
parent b90f52e932
commit 1a42ece0c7
4 changed files with 102 additions and 66 deletions

View file

@ -149,17 +149,16 @@ static int RunModule(char *module)
fprintf(stderr, "Could not import runpy module\n");
return -1;
}
runmodule = PyObject_GetAttrString(runpy, "run_module");
runmodule = PyObject_GetAttrString(runpy, "_run_module_as_main");
if (runmodule == NULL) {
fprintf(stderr, "Could not access runpy.run_module\n");
fprintf(stderr, "Could not access runpy._run_module_as_main\n");
Py_DECREF(runpy);
return -1;
}
runargs = Py_BuildValue("sOsO", module,
Py_None, "__main__", Py_True);
runargs = Py_BuildValue("(s)", module);
if (runargs == NULL) {
fprintf(stderr,
"Could not create arguments for runpy.run_module\n");
"Could not create arguments for runpy._run_module_as_main\n");
Py_DECREF(runpy);
Py_DECREF(runmodule);
return -1;