]> granicus.if.org Git - python/commitdiff
Fix so we clear or reinitialize various data structures before populating
authorGreg Ward <gward@python.net>
Mon, 7 Aug 2000 00:45:51 +0000 (00:45 +0000)
committerGreg Ward <gward@python.net>
Mon, 7 Aug 2000 00:45:51 +0000 (00:45 +0000)
(allows the same FancyGetopt object to be used multiple times with different
option tables).

Lib/distutils/fancy_getopt.py

index 6adfc819c2df5c70c3e0f7d1823d61509692eaca..a62bc0df752af65cb222b8fad9aadb4eec3180fe 100644 (file)
@@ -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