Message138515
Parsing arguments with argparse fails with an IndexError when one of the arguments is the empty string (''). This is caused by an access to the zero'th element of the argument value, without a preceding length check.
Fixed by the below patch:
Index: Lib/argparse.py
===================================================================
--- Lib/argparse.py
+++ Lib/argparse.py
@@ -1967,7 +1967,7 @@ class ArgumentParser(_AttributeHolder, _
for arg_string in arg_strings:
# for regular arguments, just add them back into the list
- if arg_string[0] not in self.fromfile_prefix_chars:
+ if len(arg_string) == 0 or arg_string[0] not in self.fromfile_prefix_chars:
new_arg_strings.append(arg_string)
# replace arguments referencing files with the file content |
|
Date |
User |
Action |
Args |
2011-06-17 15:40:06 | bjacobs | set | recipients:
+ bjacobs |
2011-06-17 15:40:06 | bjacobs | set | messageid: <1308325206.77.0.428682614263.issue12353@psf.upfronthosting.co.za> |
2011-06-17 15:40:06 | bjacobs | link | issue12353 messages |
2011-06-17 15:40:05 | bjacobs | create | |
|