mirror of
https://github.com/python/cpython.git
synced 2025-07-28 13:44:43 +00:00
[3.9] bpo-39934: Account for control blocks in 'except' in compiler. (GH-22395) (GH-23303)
* bpo-39934: backport PR 22395 to 3.9
This commit is contained in:
parent
05a5d697f4
commit
48a9c0eb2a
3 changed files with 23 additions and 8 deletions
|
@ -946,6 +946,15 @@ pass
|
|||
except SyntaxError:
|
||||
self.fail("Empty line after a line continuation character is valid.")
|
||||
|
||||
@support.cpython_only
|
||||
def test_nested_named_except_blocks(self):
|
||||
code = ""
|
||||
for i in range(12):
|
||||
code += f"{' '*i}try:\n"
|
||||
code += f"{' '*(i+1)}raise Exception\n"
|
||||
code += f"{' '*i}except Exception as e:\n"
|
||||
code += f"{' '*4*12}pass"
|
||||
self._check_error(code, "too many statically nested blocks")
|
||||
|
||||
def test_barry_as_flufl_with_syntax_errors(self):
|
||||
# The "barry_as_flufl" rule can produce some "bugs-at-a-distance" if
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue