Commit 2887d8c
* gh-151464: exclude '<>' token from tokenize output
Was:
```
$ echo '1 <> 2' | python -m tokenize
1,0-1,1: NUMBER '1'
1,2-1,4: OP '<>'
1,5-1,6: NUMBER '2'
1,6-1,7: NEWLINE '\n'
2,0-2,0: ENDMARKER ''
```
Now (regardless on ``__future__.barry_as_FLUFL`` import):
```
$ echo '1 <> 2' | ./python -m tokenize
1,0-1,1: NUMBER '1'
1,2-1,3: OP '<'
1,3-1,4: OP '>'
1,5-1,6: NUMBER '2'
1,6-1,7: NEWLINE '\n'
2,0-2,0: ENDMARKER ''
```
in accordance with the Grammar:
https://docs.python.org/3.14/reference/lexical_analysis.html#operators-and-delimiters
Also adds a custom error message for ``<>`` ("not equal" in Pascal
and Python 2).
* +1
* address review: lowercase and move invalid rule
* address review: news
* address review: move test_guido_as_bdfl_ineq_tokens()
* address review: revert _PyTokenizer_From* changes
* + revert unrelated change
* address review: remove whatsnew entry
(cherry picked from commit 198bc76)
1 parent 13b1659 commit 2887d8c
10 files changed
Lines changed: 312 additions & 182 deletions
File tree
- Grammar
- Lib/test
- Misc/NEWS.d/next/Core_and_Builtins
- Parser
- lexer
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
794 | 794 | | |
795 | 795 | | |
796 | 796 | | |
| 797 | + | |
797 | 798 | | |
798 | 799 | | |
799 | 800 | | |
| |||
1643 | 1644 | | |
1644 | 1645 | | |
1645 | 1646 | | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3592 | 3592 | | |
3593 | 3593 | | |
3594 | 3594 | | |
| 3595 | + | |
| 3596 | + | |
| 3597 | + | |
| 3598 | + | |
| 3599 | + | |
| 3600 | + | |
| 3601 | + | |
| 3602 | + | |
| 3603 | + | |
| 3604 | + | |
| 3605 | + | |
| 3606 | + | |
| 3607 | + | |
| 3608 | + | |
| 3609 | + | |
| 3610 | + | |
| 3611 | + | |
| 3612 | + | |
| 3613 | + | |
| 3614 | + | |
| 3615 | + | |
| 3616 | + | |
| 3617 | + | |
| 3618 | + | |
3595 | 3619 | | |
3596 | 3620 | | |
3597 | 3621 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1233 | 1233 | | |
1234 | 1234 | | |
1235 | 1235 | | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
1236 | 1250 | | |
1237 | 1251 | | |
1238 | 1252 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
2095 | 2096 | | |
2096 | 2097 | | |
2097 | 2098 | | |
| 2099 | + | |
2098 | 2100 | | |
2099 | 2101 | | |
2100 | 2102 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1245 | 1245 | | |
1246 | 1246 | | |
1247 | 1247 | | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
1248 | 1251 | | |
1249 | 1252 | | |
1250 | 1253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
138 | 138 | | |
139 | 139 | | |
140 | 140 | | |
| 141 | + | |
141 | 142 | | |
142 | 143 | | |
143 | 144 | | |
| |||
0 commit comments