mirror of
https://github.com/python/cpython.git
synced 2026-10-28 18:35:21 +08:00
* 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 198bc76836)
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>