Skip to content

Cleanup Python/getopt.c: add _PyOS_GetOpt structure - #158362

Open
vstinner wants to merge 1 commit into
python:mainfrom
vstinner:getopt
Open

vstinner wants to merge 1 commit into
python:mainfrom
vstinner:getopt

Conversation

@vstinner

Copy link
Copy Markdown
Member

Replace global variables with a new _PyOS_GetOpt structure:

  • _PyOS_opterr: getopt->error
  • _PyOS_optind: getopt->index
  • _PyOS_optarg: getopt->arg

Changes:

  • Rename _PyOS_ResetGetOpt() to _PyOS_GetOpt_Init(). Add argc and argv parameters.
  • Don't expose longindex in the structure, it's only used internally.
  • Move _PyOS_LongOption structure from the internal C API to getopt.c.

Replace global variables with a new _PyOS_GetOpt structure:

* _PyOS_opterr: getopt->error
* _PyOS_optind: getopt->index
* _PyOS_optarg: getopt->arg

Changes:

* Rename _PyOS_ResetGetOpt() to _PyOS_GetOpt_Init(). Add argc and
  argv parameters.
* Don't expose longindex in the structure, it's only used internally.
* Move _PyOS_LongOption structure from the internal C API to
  getopt.c.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant