[3.10] bpo-44305: Improve syntax error for try blocks without except or finally (GH-26523) (GH-26524)

(cherry picked from commit b250f89bb7)

Co-authored-by: Pablo Galindo <Pablogsal@gmail.com>
This commit is contained in:
Pablo Galindo 2021-06-04 00:11:43 +01:00 committed by GitHub
parent 3283bf4519
commit e53f72a1b4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 554 additions and 440 deletions

View file

@ -274,6 +274,20 @@ have been incorporated. Some of the most notable ones:
(Contributed by Pablo Galindo in :issue:`43823`)
* ``try`` blocks without ``except`` or ``finally`` blocks:
.. code-block:: python
>>> try
... x = 2
... something = 3
File "<stdin>", line 3
something = 3
^^^^^^^^^
SyntaxError: expected 'except' or 'finally' block
(Contributed by Pablo Galindo in :issue:`44305`)
* Usage of ``=`` instead of ``==`` in comparisons:
.. code-block:: python