Skip to content

gh-89855: Improve support of non-ASCII identifiers in IDLE#29381

Draft
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:idle-nonascii-identifiers
Draft

gh-89855: Improve support of non-ASCII identifiers in IDLE#29381
serhiy-storchaka wants to merge 1 commit into
python:mainfrom
serhiy-storchaka:idle-nonascii-identifiers

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Nov 3, 2021

Copy link
Copy Markdown
Member

@serhiy-storchaka

Copy link
Copy Markdown
Member Author

It is a draft. Needed tests.

# 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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_IS_ASCII_ID_CHAR[ord(c)] is slower than c in _ASCII_ID_CHARS.

Comment thread Lib/idlelib/autoexpand.py
while i > 0 and line[i-1] in self.wordchars:
i = i-1
return line[i:]
m = _LAST_WORD_RE.search(line)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to test with long lines.

@github-actions

github-actions Bot commented Dec 4, 2021

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Dec 4, 2021
@ambv

ambv commented May 17, 2022

Copy link
Copy Markdown
Contributor

This missed the boat for inclusion in Python 3.9 which accepts security fixes only as of today.

@terryjreedy terryjreedy changed the title bpo-45692: Improve support of non-ASCII identifiers in IDLE gh-89855: Improve support of non-ASCII identifiers in IDLE Sep 18, 2022
@hugovk hugovk removed the needs backport to 3.10 only security fixes label Apr 7, 2023
@serhiy-storchaka serhiy-storchaka added needs backport to 3.12 only security fixes needs backport to 3.13 bugs and security fixes and removed needs backport to 3.11 only security fixes labels May 9, 2024
@tomasr8 tomasr8 removed the needs backport to 3.12 only security fixes label Apr 10, 2025
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.14 bugs and security fixes label May 8, 2025
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Apr 10, 2026
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label May 11, 2026
@serhiy-storchaka serhiy-storchaka added the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label May 30, 2026
@github-actions github-actions Bot removed the stale Stale PR or inactive for long period of time. label Jun 4, 2026
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.
@serhiy-storchaka serhiy-storchaka force-pushed the idle-nonascii-identifiers branch from 260543f to 0775327 Compare June 30, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting core review needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes type-feature A feature request or enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants