The escape function does not wrap a return value of __html__ method as Markup.
Expected behaviour documented in README.rst:
>>> class Foo(object):
... def __html__(self):
... return '<strong>Nice</strong>'
...
>>> escape(Foo())
Markup(u'<strong>Nice</strong>')
Actual behaviour:
>>> from markupsafe import escape
>>> class Foo(object):
... def __html__(self):
... return '<strong>Nice</strong>'
...
>>> escape(Foo())
'<strong>Nice</strong>'
I am using the 1.0 version I get same result for both native and speedups implementations.
>>> import markupsafe
>>> markupsafe.__version__
'1.0'
>>> from markupsafe._speedups import escape
>>> escape(Foo())
'<strong>Nice</strong>'
>>> from markupsafe._native import escape
>>> escape(Foo())
'<strong>Nice</strong>'