mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
Fix bug 1764407 - the -i switch now does the right thing when using the -m switch
This commit is contained in:
parent
b90f52e932
commit
1a42ece0c7
4 changed files with 102 additions and 66 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue