mirror of
https://github.com/python/cpython.git
synced 2025-10-27 19:54:38 +00:00
(py-parse-state-re): Remove the "if" from the regular expression.
This fixes an indentation bug reported by Jeremy when seeing multiple
list comprehensions like so:
[x for x in seq
if blah(x)]
# ...
[y for y in seq
if blah(y)]
The reason this broke is because this regexp caused the "find a safe
parsing start location higher up in the file" test to erroneously find
the if in the listcomp. I think the other keywords in this regexp are
fine and good enough.
After a weekend of testing, I can't find any adverse effects.
This commit is contained in:
parent
5c458052f0
commit
644991fa35
1 changed files with 1 additions and 1 deletions
|
|
@ -3148,7 +3148,7 @@ local bindings to py-newline-and-indent."))
|
|||
;; Helper functions
|
||||
(defvar py-parse-state-re
|
||||
(concat
|
||||
"^[ \t]*\\(if\\|elif\\|else\\|while\\|def\\|class\\)\\>"
|
||||
"^[ \t]*\\(elif\\|else\\|while\\|def\\|class\\)\\>"
|
||||
"\\|"
|
||||
"^[^ #\t\n]"))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue