Skip to content
Myr

fix Markup subclass

Before adoption: this commit came in with the history the project adopted, so no landing records it.

str subclass must override __new__ instead of __init__

authored by David Lord · committed by David Lord · parent d77a91b · Browse files · 1 file+2 added−2 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+2 added−2 removed

  • other:+2 added−2 removed

1 file+2 added−2 removed

modified:src/jinja2/utils.py+2 added-2 removed
831 unmodified lines
832 return f"<Namespace {self.__attrs!r}>"833834835class Markup(markupsafe.Markup):836 def __init__(self, *args, **kwargs):836 def __new__(cls, base, encoding=None, errors="strict"):837 warnings.warn(838 "'jinja2.Markup' is deprecated and will be removed in Jinja"839 " 3.1. Import 'markupsafe.Markup' instead.",840 DeprecationWarning,841 stacklevel=2,842 )843 super().__init__(*args, **kwargs)843 return super().__new__(cls, base, encoding, errors)844845846def escape(s):847 warnings.warn(
6 unmodified lines