homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author barry
Recipients Arfrever, barry, benjamin.peterson, bethard, chris.jerdonek, georg.brandl, python-dev, r.david.murray
Date 2012年09月12日.14:04:28
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <20120912100426.3cc5d2c7@limelight.wooz.org>
In-reply-to <1347446378.45.0.756311283048.issue15906@psf.upfronthosting.co.za>
Content
On Sep 12, 2012, at 10:39 AM, R. David Murray wrote:
>diff --git a/Lib/argparse.py b/Lib/argparse.py
>--- a/Lib/argparse.py
>+++ b/Lib/argparse.py
>@@ -1962,7 +1962,8 @@
> # only if it was defined already in the namespace
> if (action.default is not None and
> hasattr(namespace, action.dest) and
>- action.default is getattr(namespace, action.dest)):
>+ action.default is getattr(namespace, action.dest) and
>+ isinstance(action.default, str)):
> setattr(namespace, action.dest,
> self._get_value(action, action.default))
For me, this results in the following failure.
[307/371/1] test_argparse
NS(foo='foo_converted')
Namespace(foo=0)
NS(foo='foo_converted')
Namespace(foo=0)
test test_argparse failed -- Traceback (most recent call last):
 File "/home/barry/projects/python/cpython/Lib/test/test_argparse.py", line 4608, in test_type_function_call_with_non_string_default
 self.assertEqual(NS(foo='foo_converted'), args)
 File "/home/barry/projects/python/cpython/Lib/test/test_argparse.py", line 29, in assertEqual
 super(TestCase, self).assertEqual(obj1, obj2)
AssertionError: NS(foo='foo_converted') != Namespace(foo=0)
This test was added for the issue #12776 and #11839 fix, and it's pretty
obvious why it fails. In the test, default=0 (i.e. a non-string).
Do you think test_type_function_call_with_non_string_default() is a valid test
of expected semantics? If not, then the test should be removed, and the
changeset for #12667 and #11839 should be re-evaluated, at least to determine
whether accurate tests of those bugs were applied.
If that test is removed, then the above suggested change can be made to fix
#15906.
History
Date User Action Args
2012年09月12日 14:04:32barrysetrecipients: + barry, georg.brandl, bethard, benjamin.peterson, Arfrever, r.david.murray, chris.jerdonek, python-dev
2012年09月12日 14:04:30barrylinkissue15906 messages
2012年09月12日 14:04:28barrycreate

AltStyle によって変換されたページ (->オリジナル) /