According to the documentation of "argparse.Action", a keyword 'bool' is not allowed for type argument, but it doesn't raise no errors. One possible way to fix this issue is to check in the "argparse._ActionsContainer.add_argument" method.
Thank you for your response. My patch makes raise error by minimal change, but it may be better to raise NameError as in a case specifying "type=string" in 2.7.2. Similar to the case "type=bool", specifications, such as "type=unicode" or "type=long", don't raise errors. Because the set of problematic keywords are different between 2.7.x and 3.3.x, I have no idea to completely fix this problem.
I can't find anywhere in the documentation where type=bool, type=unicode or type=long are disallowed. They shouldn't be disallowed. If you want to pass type=bool, argparse should not stop you. And it currently doesn't: >>> parser = argparse.ArgumentParser() >>> parser.add_argument('foo', type=bool) >>> parser.parse_args(['']) Namespace(foo=False) >>> parser.parse_args(['x']) Namespace(foo=True)
> - type -- The type which the command-line arguments should be converted > to, should be one of 'string', 'int', 'float', 'complex' or a > callable object that accepts a single string argument. If None, > 'string' is assumed. I misunderstood this sentence in the docstring of arcparse.Action because `bool` or `unicode` is not appeared in this list, which are callables. So, I close this issue.