We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents b529164 + 7add29c commit 54bb00bCopy full SHA for 54bb00b
CHANGES.rst
@@ -4,6 +4,7 @@ Version 3.0.1
4
Unreleased
5
6
- Address compiler warnings that became errors in GCC 14. :issue:`466`
7
+- Fix compatibility with proxy objects. :issue:`467`
8
9
10
Version 3.0.0
src/markupsafe/__init__.py
@@ -34,7 +34,9 @@ def escape(s: t.Any, /) -> Markup:
34
"""
35
# If the object is already a plain string, skip __html__ check and string
36
# conversion. This is the most common use case.
37
- if s.__class__ is str:
+ # Use type(s) instead of s.__class__ because a proxy object may be reporting
38
+ # the __class__ of the proxied value.
39
+ if type(s) is str:
40
return Markup(_escape_inner(s))
41
42
if hasattr(s, "__html__"):
0 commit comments