Skip to content

Commit

Permalink
fix exact str check (#469)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidism authored Oct 8, 2024
2 parents b529164 + 7add29c commit 54bb00b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ Version 3.0.1
Unreleased

- Address compiler warnings that became errors in GCC 14. :issue:`466`
- Fix compatibility with proxy objects. :issue:`467`


Version 3.0.0
Expand Down
4 changes: 3 additions & 1 deletion src/markupsafe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,9 @@ def escape(s: t.Any, /) -> Markup:
"""
# If the object is already a plain string, skip __html__ check and string
# conversion. This is the most common use case.
if s.__class__ is str:
# Use type(s) instead of s.__class__ because a proxy object may be reporting
# the __class__ of the proxied value.
if type(s) is str:
return Markup(_escape_inner(s))

if hasattr(s, "__html__"):
Expand Down

0 comments on commit 54bb00b

Please sign in to comment.