allow the keyword else immediately after (no space) an integer (close… · python/cpython@c416162 · GitHub
Skip to content

Commit c416162

Browse files
committed
allow the keyword else immediately after (no space) an integer (closes #21642)
1 parent 024b2f5 commit c416162

3 files changed

Lines changed: 24 additions & 5 deletions

File tree

Lib/test/test_grammar.py

Lines changed: 6 additions & 0 deletions

Misc/NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ Release date: XXXX-XX-XX
1010
Core and Builtins
1111
-----------------
1212

13+
- Issue #21642: If the conditional if-else expression, allow an integer written
14+
with no space between itself and the ``else`` keyword (e.g. ``True if 42else
15+
False``) to be valid syntax.
16+
1317
- Issue #21523: Fix over-pessimistic computation of the stack effect of
1418
some opcodes in the compiler. This also fixes a quadratic compilation
1519
time issue noticeable when compiling code with a large number of "and"

Parser/tokenizer.c

Lines changed: 14 additions & 5 deletions

0 commit comments

Comments
 (0)