gh-89855: Improve support of non-ASCII identifiers in IDLE#29381
Draft
serhiy-storchaka wants to merge 1 commit into
Draft
gh-89855: Improve support of non-ASCII identifiers in IDLE#29381serhiy-storchaka wants to merge 1 commit into
serhiy-storchaka wants to merge 1 commit into
Conversation
Member
Author
|
It is a draft. Needed tests. |
serhiy-storchaka
commented
Nov 3, 2021
| # all ASCII chars that may be the first char of an identifier | ||
| _ASCII_ID_FIRST_CHARS = frozenset(string.ascii_letters + "_") | ||
|
|
||
| # lookup table for whether 7-bit ASCII chars are valid in a Python identifier |
Member
Author
There was a problem hiding this comment.
_IS_ASCII_ID_CHAR[ord(c)] is slower than c in _ASCII_ID_CHARS.
| while i > 0 and line[i-1] in self.wordchars: | ||
| i = i-1 | ||
| return line[i:] | ||
| m = _LAST_WORD_RE.search(line) |
Member
Author
There was a problem hiding this comment.
Need to test with long lines.
|
This PR is stale because it has been open for 30 days with no activity. |
Contributor
|
This missed the boat for inclusion in Python 3.9 which accepts security fixes only as of today. |
Gmacky957
approved these changes
Aug 27, 2022
Gmacky957
approved these changes
Aug 27, 2022
|
This PR is stale because it has been open for 30 days with no activity. |
Replace ASCII-only identifier character sets and lookup tables in
autocomplete, autoexpand, editor, hyperparser and undo with the more
general ("a" + char).isidentifier() test or a Unicode-aware regular
expression. Non-ASCII identifiers (e.g. "café" or "Ångström") are now
handled correctly when autocompleting, autoexpanding, highlighting
errors and merging undo operations.
260543f to
0775327
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.