diff --git a/CHANGES.rst b/CHANGES.rst index 3f986246..9c483ef9 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -3,6 +3,8 @@ Version 2.1.0 Unreleased +- Remove ``soft_unicode``, which was previously deprecated. Use + ``soft_str`` instead. :pr:`261` - Raise error on missing single placeholder during string interpolation. :issue:`225` diff --git a/src/markupsafe/__init__.py b/src/markupsafe/__init__.py index d1bf1876..ae39f917 100644 --- a/src/markupsafe/__init__.py +++ b/src/markupsafe/__init__.py @@ -285,9 +285,7 @@ def __float__(self) -> float: from ._speedups import escape as escape from ._speedups import escape_silent as escape_silent from ._speedups import soft_str as soft_str - from ._speedups import soft_unicode except ImportError: from ._native import escape as escape from ._native import escape_silent as escape_silent # noqa: F401 from ._native import soft_str as soft_str # noqa: F401 - from ._native import soft_unicode # noqa: F401 diff --git a/src/markupsafe/_native.py b/src/markupsafe/_native.py index 6f7eb7a8..8117b271 100644 --- a/src/markupsafe/_native.py +++ b/src/markupsafe/_native.py @@ -61,15 +61,3 @@ def soft_str(s: t.Any) -> str: return str(s) return s - - -def soft_unicode(s: t.Any) -> str: - import warnings - - warnings.warn( - "'soft_unicode' has been renamed to 'soft_str'. The old name" - " will be removed in MarkupSafe 2.1.", - DeprecationWarning, - stacklevel=2, - ) - return soft_str(s) diff --git a/src/markupsafe/_speedups.c b/src/markupsafe/_speedups.c index 44967b1f..3c463fb8 100644 --- a/src/markupsafe/_speedups.c +++ b/src/markupsafe/_speedups.c @@ -254,19 +254,6 @@ soft_str(PyObject *self, PyObject *s) } -static PyObject* -soft_unicode(PyObject *self, PyObject *s) -{ - PyErr_WarnEx( - PyExc_DeprecationWarning, - "'soft_unicode' has been renamed to 'soft_str'. The old name" - " will be removed in MarkupSafe 2.1.", - 2 - ); - return soft_str(self, s); -} - - static PyMethodDef module_methods[] = { { "escape", @@ -308,12 +295,6 @@ static PyMethodDef module_methods[] = { ">>> escape(soft_str(value))\n" "Markup('<User 1>')\n" }, - { - "soft_unicode", - (PyCFunction)soft_unicode, - METH_O, - "" - }, {NULL, NULL, 0, NULL} /* Sentinel */ }; diff --git a/tests/conftest.py b/tests/conftest.py index 13f938ce..d040ea8b 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -35,8 +35,3 @@ def escape_silent(_mod): @pytest.fixture(scope="session") def soft_str(_mod): return _mod.soft_str - - -@pytest.fixture(scope="session") -def soft_unicode(_mod): - return _mod.soft_unicode diff --git a/tests/test_markupsafe.py b/tests/test_markupsafe.py index 1d4ac2e2..2f138854 100644 --- a/tests/test_markupsafe.py +++ b/tests/test_markupsafe.py @@ -184,8 +184,3 @@ def test_soft_str(soft_str): assert type(soft_str("")) is str assert type(soft_str(Markup())) is Markup assert type(soft_str(15)) is str - - -def test_soft_unicode_deprecated(soft_unicode): - with pytest.warns(DeprecationWarning): - assert type(soft_unicode(Markup())) is Markup