From 555c368ad1f9e29dc15a018f795312d8b6a7fa0e Mon Sep 17 00:00:00 2001 From: Johan Dahlin Date: Mon, 12 Nov 2007 21:58:15 +0000 Subject: Set the default value of old_args to 0, so we don't end up slicing with 2007-11-12 Johan Dahlin * gobject/option.py (OptionParser.parse_args): Set the default value of old_args to 0, so we don't end up slicing with None. Fixes #496278 (Vincent Untz) svn path=/trunk/; revision=718 --- ChangeLog | 6 ++++++ gobject/option.py | 2 +- tests/test_option.py | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 37acecb..2e55527 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-11-12 Johan Dahlin + + * gobject/option.py (OptionParser.parse_args): + Set the default value of old_args to 0, so we don't end + up slicing with None. Fixes #496278 (Vincent Untz) + 2007-11-06 Johan Dahlin * gobject/option.py (OptionParser.parse_args): Merge in values diff --git a/gobject/option.py b/gobject/option.py index 5930274..91424c9 100644 --- a/gobject/option.py +++ b/gobject/option.py @@ -316,7 +316,7 @@ class OptionParser(optparse.OptionParser): largs.extend(context.parse([sys.argv[0]] + rargs)) def parse_args(self, args=None, values=None): - old_args = args + old_args = args or 0 try: options, args = optparse.OptionParser.parse_args( self, args, values) diff --git a/tests/test_option.py b/tests/test_option.py index 2301553..69e1766 100644 --- a/tests/test_option.py +++ b/tests/test_option.py @@ -65,6 +65,9 @@ class TestOption(unittest.TestCase): ["test_option.py", "--", "-xxx"]) #self.assertEquals(args, ["-xxx"]) + def testParseArgs(self): + options, args = self.parser.parse_args() + def testParseArgsGroup(self): group = self._create_group() -- cgit