Subject: bug#51362: python font-lock-mode in emacs 28 seems broken

From: Jeff Spencer <[email-masked]>
Date: Sun, 24 Oct 2021 17:37:39 -0500

Here is a somewhat minimal example. What is weird is it is inconsistent. If
I save this as `test.py` and load it none of the `snapshot_spec` are
colored, but they are just normal text. If on the line where snapshot_spec
is defined I delete the tuple part of input_tuple it will be highlighted
correctly and remains that way. Then if I go back up and I for example
delete `| datetime` then it goes back to no color.

```
from __future__ import annotations

from datetime import datetime

import pandas as pd

def make_snapshot_temp(input_tuple: tuple, window: int, date: str |
datetime) -> None:

    snapshot_spec = pd.DataFrame(input_tuple, columns=["lead_id"])
    snapshot_spec["snapshot_to_date"] = pd.to_datetime(date)

    if window == 0:
        snapshot_spec["snapshot_from_date"] = pd.to_datetime("2017-04-01")
        snapshot_spec["snapshot_window"] = "all-time"

    return snapshot_spec
```

On Sun, Oct 24, 2021 at 7:45 AM Stefan Kangas <[email-masked]> wrote:

> Jeff Spencer <[email-masked]> writes:
>
> > If you look at the link below it doesn't highlight the `post_split_...`
> > variable but it does highlight the `df_train` variable below it
> > correctly. The link shows my settings, but this happens when starting
> > with emacs -Q as well. It seems the syntax highlighting got messed up
> > with the addition of the f-strings code.
>
> Do you have an example file or snippet where font-lock fails?
>