Message 138889 - Python tracker (original) (raw)

Your unit test isn't consistent with the other unit tests in that set, which makes me suspicious that it isn't testing what we need to test.

That is because I did not try to understand the machinery behind the argparse unit tests completely. I did not want to create an extra unit test class just for this one test.

Also, there are unit tests for this case further up in the test file (TestEmptyAndSpaceContainingArguments). I haven't been able to reproduce the bug.

Did you run the unit tests from my patch?

Can you post a short program that reproduces the failure?

Here you go:

from argparse import ArgumentParser parser = ArgumentParser(fromfile_prefix_chars="@") parser.parse_args([""])

This gives me

Traceback (most recent call last): File "", line 1, in File "/opt/python3/lib/python3.3/argparse.py", line 1726, in parse_args args, argv = self.parse_known_args(args, namespace) File "/opt/python3/lib/python3.3/argparse.py", line 1758, in parse_known_args namespace, args = self._parse_known_args(args, namespace) File "/opt/python3/lib/python3.3/argparse.py", line 1770, in _parse_known_args arg_strings = self._read_args_from_files(arg_strings) File "/opt/python3/lib/python3.3/argparse.py", line 2003, in _read_args_from_files if arg_string[0] not in self.fromfile_prefix_chars: IndexError: string index out of range