File tree Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Expand file tree Collapse file tree 2 files changed +10
-12
lines changed Original file line number Diff line number Diff line change @@ -1716,17 +1716,15 @@ class UnhosedConfigParser(ConfigParser.RawConfigParser):
1716
1716
mysection = 'supervisord'
1717
1717
1718
1718
def __init__ (self , * args , ** kwargs ):
1719
- # inline_comment_prefixes was added in Python 3 but its default makes
1720
- # RawConfigParser behave differently than it did on Python 2. This
1721
- # makes it behave the same by default on Python 2 and 3.
1722
- if (not PY2 ) and ('inline_comment_prefixes' not in kwargs ):
1723
- kwargs ['inline_comment_prefixes' ] = (';' , '#' )
1724
-
1725
- # strict was added in Python 3 but its default makes RawConfigParser
1726
- # behave differently than it did on Python 2. This makes it behave
1727
- # the same by default on Python 2 and 3.
1719
+ # inline_comment_prefixes and strict were added in Python 3 but their
1720
+ # defaults make RawConfigParser behave differently than it did on
1721
+ # Python 2. We make it work like 2 by default for backwards compat.
1728
1722
if not PY2 :
1729
- kwargs ['strict' ] = False
1723
+ if 'inline_comment_prefixes' not in kwargs :
1724
+ kwargs ['inline_comment_prefixes' ] = (';' , '#' )
1725
+
1726
+ if 'strict' not in kwargs :
1727
+ kwargs ['strict' ] = False
1730
1728
1731
1729
ConfigParser .RawConfigParser .__init__ (self , * args , ** kwargs )
1732
1730
Original file line number Diff line number Diff line change @@ -316,7 +316,7 @@ def test_options_ignores_inline_comments(self):
316
316
options = instance .configroot .supervisorctl
317
317
self .assertEqual (options .serverurl , 'http://localhost:9001' )
318
318
319
- def test_options_parsers_as_nonstrict_for_py2_py3_compat (self ):
319
+ def test_options_parses_as_nonstrict_for_py2_py3_compat (self ):
320
320
text = lstrip ("""
321
321
[supervisorctl]
322
322
serverurl=http://localhost:9001 ;duplicate
@@ -703,7 +703,7 @@ def test_options_ignores_inline_comments(self):
703
703
options = instance .configroot .supervisord
704
704
self .assertEqual (options .identifier , 'foo' )
705
705
706
- def test_options_parsers_as_nonstrict_for_py2_py3_compat (self ):
706
+ def test_options_parses_as_nonstrict_for_py2_py3_compat (self ):
707
707
text = lstrip ("""
708
708
[supervisord]
709
709
You can’t perform that action at this time.
0 commit comments