pygments: WARNING: Lexing literal_block '...' as "ini" resulted in an error at token: '}'

I originally filed this at sphinx, but guess it better fits here. It might be related to the 2.19 release as it first popped up today.

Describe the bug

A part of our docs that didn’t change since quite a while suddenly causes a warning from the ini lexer and thus sphinx terminates with rc 1 (which leads to termination of our CI pipeline).

data-structures.rst:971: WARNING: Lexing literal_block '...' as "ini" resulted in an error at token: '}'.

Details see there:

https://github.com/borgbackup/borg/pull/8625

I didn’t see anything problematic in that ini section, even the {} were nested correctly.

Problematic text

[cache]
version = 1
repository = 3c4...e59
manifest = 10e...21c
timestamp = 2017-06-01T21:31:39.699514
key_type = 2
previous_location = /path/to/repo

[integrity]
manifest = 10e...21c
files = {"algorithm": "XXH64", "digests": {"HashHeader": "eab...39e3", "final": "e2a...b24"}}

Environment Information

Platform:              darwin; (macOS-15.2-arm64-arm-64bit-Mach-O)
Python version:        3.13.1 (main, Dec  3 2024, 17:59:52) [Clang 16.0.0 (clang-1600.0.26.4)])
Python implementation: CPython
Sphinx version:        8.1.3
Docutils version:      0.21.2
Jinja2 version:        3.1.5
Pygments version:      2.19.0

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 17 (2 by maintainers)

Commits related to this issue

Most upvoted comments

You’re welcome 😃 I’ll try to package 2.19.1 this evening, mostly to give the US a chance to run into more regressions.

Thanks a lot! I’ll guess we’re good now, will include this in 2.19.1.

Agreed, this is messed up. I don’t know what grammar we’re implementing there (I’ve been poking around it for a bit) and this requires a proper mode for escaped strings, which requires a proper refactor of the IniLexer.

As I wrote in #2835, this isn’t really an ini file at this stage, and I doubt the parsing was more sensible previously. I’m ok with reverting the whole thing, but I wonder if this wouldn’t be better handled as TOML.

CC @birkenfeld @jeanas for more input.