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).
diff --git a/Lib/distutils/fancy_getopt.py b/Lib/distutils/fancy_getopt.py
index 6adfc81..a62bc0d 100644
--- a/Lib/distutils/fancy_getopt.py
+++ b/Lib/distutils/fancy_getopt.py
@@ -93,6 +93,7 @@
def _build_index (self):
+ self.option_index.clear()
for option in self.option_table:
self.option_index[option[0]] = option
@@ -153,6 +154,10 @@
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