Skip to content

jinja2.Markup() fails without deprecation warning #1438

@encukou

Description

@encukou

There might not be anything to do now, but the code that issues a DeprecationWarning since 3.0.0rc2 fails with an exception when jinja2.utils.Markup is used without arguments. The previous RC worked.

>>> import jinja2
>>> jinja2.Markup()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: __new__() missing 1 required positional argument: 'base'

The correct fix is to switch to markupsafe, but the exception makes it hard to find if an application uses Markup() first.

>>> import markupsafe
>>> markupsafe.Markup()
Markup('')

While looking for the cause, I found that documentation for the autoescape argument for jinja2.Environment mentions Markup without much context; is that an issue?

Environment:

  • Python version: 3.11.0a0
  • Jinja version: 3.0.0

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions