Skip to content

Commit cee9efc

Browse files
committed
Use classmethod for a class method
1 parent 16fed35 commit cee9efc

File tree

3 files changed

+4
-2
lines changed

3 files changed

+4
-2
lines changed

Diff for: CHANGES.rst

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Release 8.0.2 (in development)
44
Bugs fixed
55
----------
66

7+
* Fix the ``pygments.Formatter.__class_getitem__`` patch.
8+
Patch by Adam Turner.
79

810
Release 8.0.1 (released Jul 30, 2024)
911
=====================================

Diff for: sphinx/highlighting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
if tuple(map(int, pygments.__version__.split('.')))[:2] < (2, 18):
3535
from pygments.formatter import Formatter # NoQA: F811
3636

37-
Formatter.__class_getitem__ = lambda cls, name: cls # type: ignore[attr-defined]
37+
Formatter.__class_getitem__ = classmethod(lambda cls, name: cls) # type: ignore[attr-defined]
3838

3939
logger = logging.getLogger(__name__)
4040

Diff for: tests/test_highlighting.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
if tuple(map(int, pygments.__version__.split('.')))[:2] < (2, 18):
1313
from pygments.formatter import Formatter
14-
Formatter.__class_getitem__ = lambda cls, name: cls # type: ignore[attr-defined]
14+
Formatter.__class_getitem__ = classmethod(lambda cls, name: cls) # type: ignore[attr-defined]
1515

1616

1717
class MyLexer(RegexLexer):

0 commit comments

Comments
 (0)