zenlotus / argparse

Automatically exported from code.google.com/p/argparse
Other
0 stars 0 forks source link

pypi version does not handle empty arguments when fromfile_prefix_chars set (python issue 12353) #89

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

>>> import argparse
>>> parser = argparse.ArgumentParser(fromfile_prefix_chars='@')
>>> parser.parse_args([''])

What is the expected output? What do you see instead?

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/site-packages/argparse-1.2.1-py2.6.egg/argparse.py", line 1703, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/usr/lib/python2.6/site-packages/argparse-1.2.1-py2.6.egg/argparse.py", line 1735, in parse_known_args
    namespace, args = self._parse_known_args(args, namespace)
  File "/usr/lib/python2.6/site-packages/argparse-1.2.1-py2.6.egg/argparse.py", line 1747, in _parse_known_args
    arg_strings = self._read_args_from_files(arg_strings)
  File "/usr/lib/python2.6/site-packages/argparse-1.2.1-py2.6.egg/argparse.py", line 1985, in _read_args_from_files
    if arg_string[0] not in self.fromfile_prefix_chars:
IndexError: string index out of range

What version of the product are you using? On what operating system?

1.2.1, CentOS 5 w/ Python 2.6.8 from EPEL repository.

Original issue reported on code.google.com by will...@shallum.net on 15 Jan 2014 at 5:16