mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
gh-103997: Automatically dedent the argument to "-c" (#103998)
Co-authored-by: sunmy2019 <59365878+sunmy2019@users.noreply.github.com> Co-authored-by: Kirill Podoprigora <80244920+Eclips4@users.noreply.github.com> Co-authored-by: Inada Naoki <songofacandy@gmail.com> Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
This commit is contained in:
parent
50e518e886
commit
fc0ec29889
7 changed files with 266 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
#include "pycore_pylifecycle.h" // _Py_PreInitializeFromPyArgv()
|
||||
#include "pycore_pystate.h" // _PyInterpreterState_GET()
|
||||
#include "pycore_pythonrun.h" // _PyRun_AnyFileObject()
|
||||
#include "pycore_unicodeobject.h" // _PyUnicode_Dedent()
|
||||
|
||||
/* Includes for exit_sigint() */
|
||||
#include <stdio.h> // perror()
|
||||
|
@ -244,6 +245,11 @@ pymain_run_command(wchar_t *command)
|
|||
return pymain_exit_err_print();
|
||||
}
|
||||
|
||||
Py_SETREF(unicode, _PyUnicode_Dedent(unicode));
|
||||
if (unicode == NULL) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
bytes = PyUnicode_AsUTF8String(unicode);
|
||||
Py_DECREF(unicode);
|
||||
if (bytes == NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue