summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGreg Ward <gward@python.net>2000-08-07 00:45:51 (GMT)
committerGreg Ward <gward@python.net>2000-08-07 00:45:51 (GMT)
commit0fd2dd6db0a279546747a43c777522b266e7734d (patch)
tree48e0ad292e8bbd04250c331fcfa9c8533a807442 /Lib
parentf9d20c37864316e0cd343e0b9bbac638a7590ad5 (diff)
downloadcpython-0fd2dd6db0a279546747a43c777522b266e7734d.zip
cpython-0fd2dd6db0a279546747a43c777522b266e7734d.tar.gz
cpython-0fd2dd6db0a279546747a43c777522b266e7734d.tar.bz2
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).
Diffstat (limited to 'Lib')
-rw-r--r--Lib/distutils/fancy_getopt.py5
1 files changed, 5 insertions, 0 deletions
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 @@ 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