bpo-40268: Remove unused imports in pylifecycle.c (GH-19533)

Remove unused imports in files:

* initconfig.c
* main.c
* preconfig.h
* pylifecycle.c
* python.c
* pythonrun.c
This commit is contained in:
Victor Stinner 2020-04-15 04:01:58 +02:00 committed by GitHub
parent 361dcdcefc
commit 4f98f465f1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 59 additions and 71 deletions

View File

@ -1,22 +1,22 @@
/* Python interpreter main program */ /* Python interpreter main program */
#include "Python.h" #include "Python.h"
#include "pycore_initconfig.h" #include "pycore_initconfig.h" // _PyArgv
#include "pycore_interp.h" // _PyInterpreterState.sysdict #include "pycore_interp.h" // _PyInterpreterState.sysdict
#include "pycore_pathconfig.h" #include "pycore_pathconfig.h" // _PyPathConfig_ComputeSysPath0()
#include "pycore_pylifecycle.h" #include "pycore_pylifecycle.h" // _Py_PreInitializeFromPyArgv()
#include "pycore_pystate.h" // _PyInterpreterState_GET() #include "pycore_pystate.h" // _PyInterpreterState_GET()
/* Includes for exit_sigint() */ /* Includes for exit_sigint() */
#include <stdio.h> /* perror() */ #include <stdio.h> // perror()
#ifdef HAVE_SIGNAL_H #ifdef HAVE_SIGNAL_H
# include <signal.h> /* SIGINT */ # include <signal.h> // SIGINT
#endif #endif
#if defined(HAVE_GETPID) && defined(HAVE_UNISTD_H) #if defined(HAVE_GETPID) && defined(HAVE_UNISTD_H)
# include <unistd.h> /* getpid() */ # include <unistd.h> // getpid()
#endif #endif
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
# include <windows.h> /* STATUS_CONTROL_C_EXIT */ # include <windows.h> // STATUS_CONTROL_C_EXIT
#endif #endif
/* End of includes for exit_sigint() */ /* End of includes for exit_sigint() */

View File

@ -1,7 +1,6 @@
/* Minimal main program -- everything is loaded from the library */ /* Minimal main program -- everything is loaded from the library */
#include "Python.h" #include "Python.h"
#include "pycore_pylifecycle.h"
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
int int

View File

@ -1,14 +1,15 @@
#include "Python.h" #include "Python.h"
#include "osdefs.h" // DELIM #include "pycore_fileutils.h" // _Py_HasFileSystemDefaultEncodeErrors
#include "pycore_fileutils.h" #include "pycore_getopt.h" // _PyOS_GetOpt()
#include "pycore_getopt.h" #include "pycore_initconfig.h" // _PyStatus_OK()
#include "pycore_initconfig.h"
#include "pycore_interp.h" // _PyInterpreterState.runtime #include "pycore_interp.h" // _PyInterpreterState.runtime
#include "pycore_pathconfig.h" #include "pycore_pathconfig.h" // _Py_path_config
#include "pycore_pyerrors.h" #include "pycore_pyerrors.h" // _PyErr_Fetch()
#include "pycore_pylifecycle.h" #include "pycore_pylifecycle.h" // _Py_PreInitializeFromConfig()
#include "pycore_pymem.h" // _PyMem_SetDefaultAllocator() #include "pycore_pymem.h" // _PyMem_SetDefaultAllocator()
#include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_pystate.h" // _PyThreadState_GET()
#include "osdefs.h" // DELIM
#include <locale.h> // setlocale() #include <locale.h> // setlocale()
#ifdef HAVE_LANGINFO_H #ifdef HAVE_LANGINFO_H
# include <langinfo.h> // nl_langinfo(CODESET) # include <langinfo.h> // nl_langinfo(CODESET)

View File

@ -1,6 +1,6 @@
#include "Python.h" #include "Python.h"
#include "pycore_getopt.h" #include "pycore_getopt.h" // _PyOS_GetOpt()
#include "pycore_initconfig.h" #include "pycore_initconfig.h" // _PyArgv
#include "pycore_pymem.h" // _PyMem_GetAllocatorName() #include "pycore_pymem.h" // _PyMem_GetAllocatorName()
#include "pycore_runtime.h" // _PyRuntime_Initialize() #include "pycore_runtime.h" // _PyRuntime_Initialize()
#include <locale.h> // setlocale() #include <locale.h> // setlocale()

View File

@ -4,40 +4,29 @@
#include "Python-ast.h" #include "Python-ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */ #undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_ceval.h"
#include "pycore_context.h" #include "pycore_ceval.h" // _PyEval_FiniGIL()
#include "pycore_context.h" // _PyContext_Init()
#include "pycore_fileutils.h" // _Py_ResetForceASCII()
#include "pycore_import.h" // _PyImport_Cleanup() #include "pycore_import.h" // _PyImport_Cleanup()
#include "pycore_initconfig.h" #include "pycore_initconfig.h" // _PyStatus_OK()
#include "pycore_fileutils.h" #include "pycore_object.h" // _PyDebug_PrintTotalRefs()
#include "pycore_hamt.h" #include "pycore_pathconfig.h" // _PyConfig_WritePathConfig()
#include "pycore_object.h" #include "pycore_pyerrors.h" // _PyErr_Occurred()
#include "pycore_pathconfig.h" #include "pycore_pylifecycle.h" // _PyErr_Print()
#include "pycore_pyerrors.h"
#include "pycore_pylifecycle.h"
#include "pycore_pystate.h" // _PyThreadState_GET() #include "pycore_pystate.h" // _PyThreadState_GET()
#include "pycore_sysmodule.h" #include "pycore_sysmodule.h" // _PySys_ClearAuditHooks()
#include "pycore_traceback.h" #include "pycore_traceback.h" // _Py_DumpTracebackThreads()
#include "grammar.h"
#include "node.h" #include "grammar.h" // PyGrammar_RemoveAccelerators()
#include "token.h" #include <locale.h> // setlocale()
#include "parsetok.h"
#include "errcode.h"
#include "code.h"
#include "symtable.h"
#include "ast.h"
#include "marshal.h"
#include <locale.h>
#ifdef HAVE_SIGNAL_H #ifdef HAVE_SIGNAL_H
#include <signal.h> # include <signal.h> // SIG_IGN
#endif
#ifdef MS_WINDOWS
#include "malloc.h" /* for alloca */
#endif #endif
#ifdef HAVE_LANGINFO_H #ifdef HAVE_LANGINFO_H
#include <langinfo.h> # include <langinfo.h> // nl_langinfo(CODESET)
#endif #endif
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
@ -45,9 +34,11 @@
# include "windows.h" # include "windows.h"
extern PyTypeObject PyWindowsConsoleIO_Type; extern PyTypeObject PyWindowsConsoleIO_Type;
#define PyWindowsConsoleIO_Check(op) (PyObject_TypeCheck((op), &PyWindowsConsoleIO_Type)) # define PyWindowsConsoleIO_Check(op) \
(PyObject_TypeCheck((op), &PyWindowsConsoleIO_Type))
#endif #endif
_Py_IDENTIFIER(flush); _Py_IDENTIFIER(flush);
_Py_IDENTIFIER(name); _Py_IDENTIFIER(name);
_Py_IDENTIFIER(stdin); _Py_IDENTIFIER(stdin);

View File

@ -12,29 +12,25 @@
#include "Python-ast.h" #include "Python-ast.h"
#undef Yield /* undefine macro conflicting with <winbase.h> */ #undef Yield /* undefine macro conflicting with <winbase.h> */
#include "pycore_interp.h" // PyInterpreterState.importlib
#include "pycore_object.h"
#include "pycore_pyerrors.h"
#include "pycore_pylifecycle.h"
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_sysmodule.h"
#include "grammar.h"
#include "node.h"
#include "token.h"
#include "parsetok.h"
#include "errcode.h"
#include "code.h"
#include "symtable.h"
#include "ast.h"
#include "marshal.h"
#include <locale.h>
#ifdef HAVE_SIGNAL_H #include "pycore_interp.h" // PyInterpreterState.importlib
#include <signal.h> #include "pycore_object.h" // _PyDebug_PrintTotalRefs()
#endif #include "pycore_pyerrors.h" // _PyErr_Fetch
#include "pycore_pylifecycle.h" // _Py_UnhandledKeyboardInterrupt
#include "pycore_pystate.h" // _PyInterpreterState_GET()
#include "pycore_sysmodule.h" // _PySys_Audit()
#include "node.h" // node
#include "token.h" // INDENT
#include "parsetok.h" // perrdetail
#include "errcode.h" // E_EOF
#include "code.h" // PyCodeObject
#include "symtable.h" // PySymtable_BuildObject()
#include "ast.h" // PyAST_FromNodeObject()
#include "marshal.h" // PyMarshal_ReadLongFromFile()
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
#include "malloc.h" /* for alloca */ # include "malloc.h" // alloca()
#endif #endif
#ifdef MS_WINDOWS #ifdef MS_WINDOWS
@ -42,6 +38,7 @@
# include "windows.h" # include "windows.h"
#endif #endif
_Py_IDENTIFIER(builtins); _Py_IDENTIFIER(builtins);
_Py_IDENTIFIER(excepthook); _Py_IDENTIFIER(excepthook);
_Py_IDENTIFIER(flush); _Py_IDENTIFIER(flush);