Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3d76ed8

Browse files
committed
Fix pymain_run_stdin() in Modules/main.c to call pymain_start_pyrepl() instead of pymain_run_module(L"_pyrepl", 0)
This change is an equivalent to the one done inhttps://github.com/python/cpython/pull/120904/files#diff-79e40dbd94b164b5f42a960224cc7496e33c189b4c66a6810904eda7d703b6f2R600Two callers of `pymain_start_pyrepl` differs in whether the PYTHONSTARTUP script is already executed or not, so pythonstartup argument is added to `pymain_start_pyrepl` to control whether it should be executed in it or not.
1 parentb681275 commit3d76ed8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

‎Modules/main.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ pymain_run_command(wchar_t *command)
269269

270270

271271
staticint
272-
pymain_start_pyrepl(void)
272+
pymain_start_pyrepl(intpythonstartup)
273273
{
274274
intres=0;
275275
PyObject*console=NULL;
@@ -306,7 +306,7 @@ pymain_start_pyrepl(void)
306306
gotodone;
307307
}
308308
if (!PyDict_SetItemString(kwargs,"mainmodule",main_module)
309-
&& !PyDict_SetItemString(kwargs,"pythonstartup",_PyLong_GetOne())) {
309+
&& !PyDict_SetItemString(kwargs,"pythonstartup",pythonstartup ?Py_True :Py_False)) {
310310
console_result=PyObject_Call(console,empty_tuple,kwargs);
311311
if (console_result==NULL) {
312312
res=pymain_exit_err_print();
@@ -570,7 +570,7 @@ pymain_run_stdin(PyConfig *config)
570570
intrun=PyRun_AnyFileExFlags(stdin,"<stdin>",0,&cf);
571571
return (run!=0);
572572
}
573-
returnpymain_run_module(L"_pyrepl",0);
573+
returnpymain_start_pyrepl(0);
574574
}
575575

576576

@@ -603,7 +603,7 @@ pymain_repl(PyConfig *config, int *exitcode)
603603
*exitcode= (run!=0);
604604
return;
605605
}
606-
intrun=pymain_start_pyrepl();
606+
intrun=pymain_start_pyrepl(1);
607607
*exitcode= (run!=0);
608608
return;
609609
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp