FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

[3.13] gh-85560: Fix IDLE paren matching with "else" or "yield" at the start of a continuation line (GH-157693) by miss-islington · Pull Request #157961 · python/cpython · GitHub

Repository navigation

[3.13] gh-85560: Fix IDLE paren matching with "else" or "yield" at the start of a continuation line (GH-157693) - #157961

Merged
terryjreedy merged 1 commit into
python:3.13from
miss-islington:backport-2073473-3.13
Sep 22, 2026
Merged

terryjreedy merged 1 commit into
python:3.13from
miss-islington:backport-2073473-3.13

Conversation

miss-islington commented Sep 22, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

pyparse._synchre took any line starting with else or yield for the start of a statement, so the parenthesis containing a conditional expression or a yield expression continued on such a line ((1 if x\n else 0), (\n yield x)) was not found by Show Surrounding Parens. An else statement is always followed by a colon, a conditional expression never, so else now counts as a statement start only when followed by :. A yield statement cannot be told from a yield expression, so yield is removed from the list; it only served to shorten the parsed text. On the other hand, with, del, global, nonlocal, pass and finally, which cannot start a continuation line, are added.
(cherry picked from commit 2073473)

Co-authored-by: Serhiy Storchaka storchaka@gmail.com

… start of a continuation line (pythonGH-157693)

`pyparse._synchre` took any line starting with `else` or `yield` for the start of a statement, so the parenthesis containing a conditional expression or a yield expression continued on such a line (`(1 if x\n else 0)`, `(\n yield x)`) was not found by Show Surrounding Parens. An `else` statement is always followed by a colon, a conditional expression never, so `else` now counts as a statement start only when followed by `:`. A `yield` statement cannot be told from a yield expression, so `yield` is removed from the list; it only served to shorten the parsed text. On the other hand, `with`, `del`, `global`, `nonlocal`, `pass` and `finally`, which cannot start a continuation line, are added.
(cherry picked from commit 2073473)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL