Skip to content

Commit bf4c65d

Browse files
committed
Use the configparser backport for Python 2
This fixes a problem we were having with comments inside values, which is fixed in Python 3's configparser. Close #828
1 parent 16cfdf7 commit bf4c65d

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ ChangeLog for Pylint
1010

1111
Close #852
1212

13+
* Use the configparser backport for Python 2
14+
15+
This fixes a problem we were having with comments inside values, which is fixed
16+
in Python 3's configparser.
17+
Close #828
18+
1319
* A new error was added, 'invalid-length-returned', when the `__len__`
1420
special method returned something else than a non-negative number.
1521

pylint/__pkginfo__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
if sys.platform == 'win32':
3535
install_requires.append('colorama')
36+
if sys.version_info[0] == 2:
37+
install_requires.append('configparser')
3638

3739

3840
license = 'GPL'

pylint/checkers/typecheck.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ def open(self):
322322
# (surrounded by quote `"` and followed by a comma `,`)
323323
# REQUEST,aq_parent,"[a-zA-Z]+_set{1,2}"' =>
324324
# ('REQUEST', 'aq_parent', '[a-zA-Z]+_set{1,2}')
325-
if isinstance(self.config.generated_members, str):
325+
if isinstance(self.config.generated_members, six.string_types):
326326
gen = shlex.shlex(self.config.generated_members)
327327
gen.whitespace += ','
328328
gen.wordchars += '[]-+'

pylint/config.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
import sys
3636
import time
3737

38-
from six.moves import configparser
38+
try:
39+
import configparser
40+
except ImportError:
41+
from six.moves import configparser
3942
from six.moves import range
4043

4144
from pylint import utils

0 commit comments

Comments
 (0)