mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Fix so we clear or reinitialize various data structures before populating
(allows the same FancyGetopt object to be used multiple times with different option tables).
This commit is contained in:
parent
f9d20c3786
commit
0fd2dd6db0
1 changed files with 5 additions and 0 deletions
|
@ -93,6 +93,7 @@ class FancyGetopt:
|
|||
|
||||
|
||||
def _build_index (self):
|
||||
self.option_index.clear()
|
||||
for option in self.option_table:
|
||||
self.option_index[option[0]] = option
|
||||
|
||||
|
@ -153,6 +154,10 @@ class FancyGetopt:
|
|||
the option table. Called by 'getopt()' before it can do
|
||||
anything worthwhile."""
|
||||
|
||||
self.long_opts = []
|
||||
self.short_opts = []
|
||||
self.short2long.clear()
|
||||
|
||||
for option in self.option_table:
|
||||
try:
|
||||
(long, short, help) = option
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue