Some comments about style. I don’t know the argparse test machinery very well, but the patch looks good to me. http://codereview.appspot.com/3251041/diff/2001/Lib/argparse.py File Lib/argparse.py (right): http://codereview.appspot.com/3251041/diff/2001/Lib/argparse.py#newcode1134 Lib/argparse.py:1134: err = _sys.exc_info()[1] Why are you using sys.exc_info instead of catching the exception instance on the previous line? http://codereview.appspot.com/3251041/diff/2001/Lib/argparse.py#newcode2235 Lib/argparse.py:2235: err = _sys.exc_info()[1] Ditto. http://codereview.appspot.com/3251041/diff/2001/Lib/test/test_argparse.py File Lib/test/test_argparse.py (right): http://codereview.appspot.com/3251041/diff/2001/Lib/test/test_argparse.py#new... Lib/test/test_argparse.py:58: file = open(file_path, 'w') Please use a with statement. http://codereview.appspot.com/3251041/diff/2001/Lib/test/test_argparse.py#new... Lib/test/test_argparse.py:61: import stat Please avoid imports at the function level.
http://codereview.appspot.com/3251041/diff/2001/Lib/argparse.py File Lib/argparse.py (right): http://codereview.appspot.com/3251041/diff/2001/Lib/argparse.py#newcode1134 Lib/argparse.py:1134: err = _sys.exc_info()[1] On 2010/11/25 11:28:06, merwok wrote: > Why are you using sys.exc_info instead of catching the exception instance on the > previous line? I presume it's done to support both 2.7 and 3.x version in a single code base.
updated patch attached to bug http://bugs.python.org/issue9509 http://codereview.appspot.com/3251041/diff/2001/Lib/test/test_argparse.py File Lib/test/test_argparse.py (right): http://codereview.appspot.com/3251041/diff/2001/Lib/test/test_argparse.py#new... Lib/test/test_argparse.py:58: file = open(file_path, 'w') On 2010/11/25 11:28:06, merwok wrote: > Please use a with statement. Done. http://codereview.appspot.com/3251041/diff/2001/Lib/test/test_argparse.py#new... Lib/test/test_argparse.py:61: import stat On 2010/11/25 11:28:06, merwok wrote: > Please avoid imports at the function level. Done.