Skip to content

Commit 42c680f

Browse files
authored
Merge pull request #677 from hhatto/fix/issue-676
fix: infinite loop in autopep8.fix_code without w50 ignore option
2 parents 0415bed + b5dc17d commit 42c680f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

autopep8.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3488,6 +3488,16 @@ def fix_code(source, options=None, encoding=None, apply_config=False):
34883488
34893489
"""
34903490
options = _get_options(options, apply_config)
3491+
# normalize
3492+
options.ignore = [opt.upper() for opt in options.ignore]
3493+
options.select = [opt.upper() for opt in options.select]
3494+
3495+
# check ignore args
3496+
# NOTE: If W50x is not included, add W50x because the code
3497+
# correction result is indefinite.
3498+
ignore_opt = options.ignore
3499+
if not {"W50", "W503", "W504"} & set(ignore_opt):
3500+
options.ignore.append("W50")
34913501

34923502
if not isinstance(source, str):
34933503
source = source.decode(encoding or get_encoding())

0 commit comments

Comments
 (0)