Skip to content

Commit

Permalink
Merge pull request #677 from hhatto/fix/issue-676
Browse files Browse the repository at this point in the history
fix: infinite loop in autopep8.fix_code without w50 ignore option
  • Loading branch information
hhatto authored Mar 3, 2023
2 parents 0415bed + b5dc17d commit 42c680f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions autopep8.py
Original file line number Diff line number Diff line change
Expand Up @@ -3488,6 +3488,16 @@ def fix_code(source, options=None, encoding=None, apply_config=False):
"""
options = _get_options(options, apply_config)
# normalize
options.ignore = [opt.upper() for opt in options.ignore]
options.select = [opt.upper() for opt in options.select]

# check ignore args
# NOTE: If W50x is not included, add W50x because the code
# correction result is indefinite.
ignore_opt = options.ignore
if not {"W50", "W503", "W504"} & set(ignore_opt):
options.ignore.append("W50")

if not isinstance(source, str):
source = source.decode(encoding or get_encoding())
Expand Down

0 comments on commit 42c680f

Please sign in to comment.