mirror of
https://github.com/python/cpython.git
synced 2025-10-21 14:12:27 +00:00
bpo-36142: Add _PyPreConfig_ReadFromArgv() (GH-12173)
The new function is now responsible to parse -E and -I command line arguments.
This commit is contained in:
parent
cad1f747da
commit
6dcb54228e
8 changed files with 209 additions and 52 deletions
|
@ -43,6 +43,16 @@ wchar_t *_PyOS_optarg = NULL; /* optional argument */
|
|||
|
||||
static wchar_t *opt_ptr = L"";
|
||||
|
||||
/* Python command line short and long options */
|
||||
|
||||
#define SHORT_OPTS L"bBc:dEhiIJm:OqRsStuvVW:xX:?"
|
||||
|
||||
static const _PyOS_LongOption longopts[] = {
|
||||
{L"check-hash-based-pycs", 1, 0},
|
||||
{NULL, 0, 0},
|
||||
};
|
||||
|
||||
|
||||
void _PyOS_ResetGetOpt(void)
|
||||
{
|
||||
_PyOS_opterr = 1;
|
||||
|
@ -51,8 +61,7 @@ void _PyOS_ResetGetOpt(void)
|
|||
opt_ptr = L"";
|
||||
}
|
||||
|
||||
int _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring,
|
||||
const _PyOS_LongOption *longopts, int *longindex)
|
||||
int _PyOS_GetOpt(int argc, wchar_t **argv, int *longindex)
|
||||
{
|
||||
wchar_t *ptr;
|
||||
wchar_t option;
|
||||
|
@ -128,7 +137,7 @@ int _PyOS_GetOpt(int argc, wchar_t **argv, wchar_t *optstring,
|
|||
return '_';
|
||||
}
|
||||
|
||||
if ((ptr = wcschr(optstring, option)) == NULL) {
|
||||
if ((ptr = wcschr(SHORT_OPTS, option)) == NULL) {
|
||||
if (_PyOS_opterr)
|
||||
fprintf(stderr, "Unknown option: -%c\n", (char)option);
|
||||
return '_';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue