From e425bd75177ffb7f098bdb0618b4a5ba3211fe52 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Thu, 14 Dec 2017 23:48:12 -0800 Subject: [PATCH] move pygetopt.h to internal (closes bpo-32264) (#4830) --- Include/internal/pygetopt.h | 19 +++++++++++++ Include/pygetopt.h | 28 ------------------- Makefile.pre.in | 2 +- .../2017-12-12-23-09-46.bpo-32264.ahRlOI.rst | 1 + Modules/main.c | 3 +- PCbuild/pythoncore.vcxproj | 2 +- PCbuild/pythoncore.vcxproj.filters | 2 +- Python/getopt.c | 2 +- 8 files changed, 25 insertions(+), 34 deletions(-) create mode 100644 Include/internal/pygetopt.h delete mode 100644 Include/pygetopt.h create mode 100644 Misc/NEWS.d/next/C API/2017-12-12-23-09-46.bpo-32264.ahRlOI.rst diff --git a/Include/internal/pygetopt.h b/Include/internal/pygetopt.h new file mode 100644 index 00000000000..df6f18354ee --- /dev/null +++ b/Include/internal/pygetopt.h @@ -0,0 +1,19 @@ +#ifndef Py_INTERNAL_PYGETOPT_H +#define Py_INTERNAL_PYGETOPT_H + +int _PyOS_opterr; +int _PyOS_optind; +wchar_t *_PyOS_optarg; + +void _PyOS_ResetGetOpt(void); + +typedef struct { + const wchar_t *name; + int has_arg; + int val; +} _PyOS_LongOption; + +int _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring, + const _PyOS_LongOption *longopts, int *longindex); + +#endif /* !Py_INTERNAL_PYGETOPT_H */ diff --git a/Include/pygetopt.h b/Include/pygetopt.h deleted file mode 100644 index 3e3fe364901..00000000000 --- a/Include/pygetopt.h +++ /dev/null @@ -1,28 +0,0 @@ - -#ifndef Py_PYGETOPT_H -#define Py_PYGETOPT_H -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef Py_LIMITED_API -PyAPI_DATA(int) _PyOS_opterr; -PyAPI_DATA(int) _PyOS_optind; -PyAPI_DATA(wchar_t *) _PyOS_optarg; - -PyAPI_FUNC(void) _PyOS_ResetGetOpt(void); - -typedef struct { - const wchar_t *name; - int has_arg; - int val; -} _PyOS_LongOption; - -PyAPI_FUNC(int) _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring, - const _PyOS_LongOption *longopts, int *longindex); -#endif /* !Py_LIMITED_API */ - -#ifdef __cplusplus -} -#endif -#endif /* !Py_PYGETOPT_H */ diff --git a/Makefile.pre.in b/Makefile.pre.in index fcce62f2577..4fe9affe0d2 100644 --- a/Makefile.pre.in +++ b/Makefile.pre.in @@ -987,7 +987,6 @@ PYTHON_HEADERS= \ $(srcdir)/Include/pyhash.h \ $(srcdir)/Include/pylifecycle.h \ $(srcdir)/Include/pymath.h \ - $(srcdir)/Include/pygetopt.h \ $(srcdir)/Include/pymacro.h \ $(srcdir)/Include/pymem.h \ $(srcdir)/Include/pyport.h \ @@ -1017,6 +1016,7 @@ PYTHON_HEADERS= \ $(srcdir)/Include/internal/ceval.h \ $(srcdir)/Include/internal/gil.h \ $(srcdir)/Include/internal/mem.h \ + $(srcdir)/Include/internal/pygetopt.h \ $(srcdir)/Include/internal/pystate.h \ $(srcdir)/Include/internal/warnings.h \ $(DTRACE_HEADERS) diff --git a/Misc/NEWS.d/next/C API/2017-12-12-23-09-46.bpo-32264.ahRlOI.rst b/Misc/NEWS.d/next/C API/2017-12-12-23-09-46.bpo-32264.ahRlOI.rst new file mode 100644 index 00000000000..5033d61a676 --- /dev/null +++ b/Misc/NEWS.d/next/C API/2017-12-12-23-09-46.bpo-32264.ahRlOI.rst @@ -0,0 +1 @@ +Moved the pygetopt.h header into internal/, since it has no public APIs. diff --git a/Modules/main.c b/Modules/main.c index 339a0f5e681..6b602cf9b77 100644 --- a/Modules/main.c +++ b/Modules/main.c @@ -3,6 +3,7 @@ #include "Python.h" #include "osdefs.h" #include "internal/import.h" +#include "internal/pygetopt.h" #include "internal/pystate.h" #include @@ -27,8 +28,6 @@ #define PYTHONHOMEHELP "/lib/pythonX.X" #endif -#include "pygetopt.h" - #define COPYRIGHT \ "Type \"help\", \"copyright\", \"credits\" or \"license\" " \ "for more information." diff --git a/PCbuild/pythoncore.vcxproj b/PCbuild/pythoncore.vcxproj index 1dca3ccca1d..25651d00049 100644 --- a/PCbuild/pythoncore.vcxproj +++ b/PCbuild/pythoncore.vcxproj @@ -150,7 +150,7 @@ - + diff --git a/PCbuild/pythoncore.vcxproj.filters b/PCbuild/pythoncore.vcxproj.filters index 969ba0850b2..42b2fc3ea7c 100644 --- a/PCbuild/pythoncore.vcxproj.filters +++ b/PCbuild/pythoncore.vcxproj.filters @@ -234,7 +234,7 @@ Include - + Include diff --git a/Python/getopt.c b/Python/getopt.c index de32ad4d8cb..e8d7e523c2e 100644 --- a/Python/getopt.c +++ b/Python/getopt.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include "internal/pygetopt.h" #ifdef __cplusplus extern "C" {