Bug 441540 - [python3] `yield from` expression not recognised
Summary: [python3] `yield from` expression not recognised
Status: RESOLVED FIXED
Alias: None
Product: frameworks-syntax-highlighting
Classification: Frameworks and Libraries
Component: syntax (show other bugs)
Version: 5.85.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-08-25 18:27 UTC by geisserml
Modified: 2021-08-30 20:30 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
yield from (25.92 KB, image/png)
2021-08-25 18:29 UTC, geisserml
Details

Note You need to log in before you can comment on or make changes to this bug.
Description geisserml 2021-08-25 18:27:21 UTC
SUMMARY

The `yield from` expression got introduced with Python 3.3, but Kate syntax highlighting does not recognise it properly. `from` is marked in the same way as the from expression of imports, altough it should rather be the colour and style of `yield`.

Example:
```python3
from concurrent.futures import ThreadPoolExecutor

def potentise(base):
    return base**3

bases = [i for i in range(1, 1000)]

def run():
    with ThreadPoolExecutor(4) as pool:
        yield from pool.map(potentise, bases)

if __name__ == '__main__':
    for n in run():
        print(n)
```

More extensive information can be found in this article:
http://simeonvisser.com/posts/python-3-using-yield-from-in-generators-part-1.html

STEPS TO REPRODUCE
1. Copy the above code snippet to Kate
2. Set Programming Language to Python

OBSERVED RESULT
The from of `yield from` has the same colour and style as the from of the import.

EXPECTED RESULT
The from of `yield from` should look the same as `yield`.

SOFTWARE/OS VERSIONS
Operating System: KDE neon 5.22
KDE Plasma Version: 5.22.4
KDE Frameworks Version: 5.85.0
Qt Version: 5.15.3
Kernel Version: 5.11.0-27-generic (64-bit)
Graphics Platform: Wayland

Other information
Not sure whether I chose the right component
Comment 1 geisserml 2021-08-25 18:29:34 UTC
Created attachment 141047 [details]
yield from
Comment 2 Bug Janitor Service 2021-08-30 08:28:46 UTC
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/syntax-highlighting/-/merge_requests/249
Comment 3 Christoph Cullmann 2021-08-30 20:30:27 UTC
Git commit 439f8cbfe0b5d1f931c2233d1790e1280170c24c by Christoph Cullmann, on behalf of Jan Paul Batrina.
Committed on 30/08/2021 at 20:30.
Pushed by cullmann into branch 'master'.

Python: Add "yield from" keyword

M  +9    -0    autotests/folding/test.py.fold
M  +9    -0    autotests/html/test.py.dark.html
M  +9    -0    autotests/html/test.py.html
M  +9    -0    autotests/input/test.py
M  +9    -0    autotests/reference/test.py.ref
M  +15   -2    data/syntax/python.xml

https://invent.kde.org/frameworks/syntax-highlighting/commit/439f8cbfe0b5d1f931c2233d1790e1280170c24c