Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 49dc0dd

Browse files
committedAug 17, 2023
Fix asset class string interface membership testing
1 parent 8512855 commit 49dc0dd

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed
 

‎CHANGES

+3
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ Release 7.2.2 (in development)
44
Bugs fixed
55
----------
66

7+
* Fixed membership testing (``in``) for the :py:class:`str` interface
8+
of the asset classes (``_CascadingStyleSheet`` and ``_JavaScript``),
9+
which several extensions relied upon.
710

811
Release 7.2.1 (released Aug 17, 2023)
912
=====================================

‎sphinx/builders/html/_assets.py

+8
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ def __str__(self):
3636
f'{attr})')
3737

3838
def __eq__(self, other):
39+
if isinstance(other, str):
40+
warnings.warn('The str interface for _CascadingStyleSheet objects is deprecated. '
41+
'Use css.filename instead.', RemovedInSphinx90Warning, stacklevel=2)
42+
return self.filename == other
3943
if not isinstance(other, _CascadingStyleSheet):
4044
return NotImplemented
4145
return (self.filename == other.filename
@@ -88,6 +92,10 @@ def __str__(self):
8892
f'{attr})')
8993

9094
def __eq__(self, other):
95+
if isinstance(other, str):
96+
warnings.warn('The str interface for _JavaScript objects is deprecated. '
97+
'Use js.filename instead.', RemovedInSphinx90Warning, stacklevel=2)
98+
return self.filename == other
9199
if not isinstance(other, _JavaScript):
92100
return NotImplemented
93101
return (self.filename == other.filename

0 commit comments

Comments
 (0)
Please sign in to comment.