From b81286536d9bf8efef5e2a355bf415ddb0893896 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Tue, 19 May 2026 00:23:17 -0400 Subject: [PATCH 1/3] Add support for Python 3.15 lazy import syntax. --- src/languages/python.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/languages/python.js b/src/languages/python.js index 2604889790..5c457a1003 100644 --- a/src/languages/python.js +++ b/src/languages/python.js @@ -32,6 +32,7 @@ export default function(hljs) { 'in', 'is', 'lambda', + 'lazy', 'match', 'nonlocal|10', 'not', From 1532ee86e2e10056dea18cc055992949949bdc93 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Tue, 19 May 2026 00:26:29 -0400 Subject: [PATCH 2/3] Add changelog entry. --- CHANGES.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGES.md b/CHANGES.md index b1413c29a5..3cbd9e1dee 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -26,6 +26,7 @@ Core Grammars: - enh(json) add json5 support [Kerry Shetline][] - fix(css) `unicode-range` parsing, issue #4253 [Kerry Shetline][] - fix(csharp) Support digit separators [te-ing][] +- enh(python) correctly highlight `lazy import` syntax from PEP 810 [Peter Bierma][] Documentation: @@ -55,6 +56,7 @@ CONTRIBUTORS [te-ing]: https://github.com/te-ing [Anthony Martin]: https://github.com/anthony-c-martin [NriotHrreion]: https://github.com/NriotHrreion +[Peter Bierma]: https://github.com/ZeroIntensity ## Version 11.11.1 From 5d391d885f2a0a3aa6f9affeb343bd3c70930a53 Mon Sep 17 00:00:00 2001 From: Peter Bierma Date: Tue, 19 May 2026 00:35:43 -0400 Subject: [PATCH 3/3] Add a test. --- test/markup/python/lazy-import.expect.txt | 2 ++ test/markup/python/lazy-import.txt | 2 ++ 2 files changed, 4 insertions(+) create mode 100644 test/markup/python/lazy-import.expect.txt create mode 100644 test/markup/python/lazy-import.txt diff --git a/test/markup/python/lazy-import.expect.txt b/test/markup/python/lazy-import.expect.txt new file mode 100644 index 0000000000..e1a5f56dd7 --- /dev/null +++ b/test/markup/python/lazy-import.expect.txt @@ -0,0 +1,2 @@ +lazy import foo +lazy from foo import bar diff --git a/test/markup/python/lazy-import.txt b/test/markup/python/lazy-import.txt new file mode 100644 index 0000000000..5eed07db70 --- /dev/null +++ b/test/markup/python/lazy-import.txt @@ -0,0 +1,2 @@ +lazy import foo +lazy from foo import bar