diff options
author | Pablo Galindo <Pablogsal@gmail.com> | 2021-04-21 14:28:21 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-21 14:28:21 (GMT) |
commit | 56c95dfe271b1242bdc8163d4677e311552c00cb (patch) | |
tree | 05ece745311032fba0f63e2cbd9a69c54b7e3ada /Doc/whatsnew | |
parent | b0544ba77cf86074fb1adde00558c67ca75eeea1 (diff) | |
download | cpython-56c95dfe271b1242bdc8163d4677e311552c00cb.zip cpython-56c95dfe271b1242bdc8163d4677e311552c00cb.tar.gz cpython-56c95dfe271b1242bdc8163d4677e311552c00cb.tar.bz2 |
bpo-43859: Improve the error message for IndentationError exceptions (GH-25431)
Diffstat (limited to 'Doc/whatsnew')
-rw-r--r-- | Doc/whatsnew/3.10.rst | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Doc/whatsnew/3.10.rst b/Doc/whatsnew/3.10.rst index 9ae9fe8..4695c0e 100644 --- a/Doc/whatsnew/3.10.rst +++ b/Doc/whatsnew/3.10.rst @@ -273,6 +273,23 @@ have been incorporated. Some of the most notable ones: (Contributed by Pablo Galindo in :issue:`41064`) +IndentationErrors +~~~~~~~~~~~~~~~~~ + +Many :exc:`IndentationError` exceptions now have more context regarding what kind of block +was expecting an indentation, including the location of the statement: + +.. code-block:: python + + >>> def foo(): + ... if lel: + ... x = 2 + File "<stdin>", line 3 + x = 2 + ^ + IndentationError: expected an indented block after 'if' statement in line 2 + + AttributeErrors ~~~~~~~~~~~~~~~ |