diff options
author | David Lord <davidism@gmail.com> | 2021-11-05 09:25:25 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-11-05 09:56:37 -0700 |
commit | 7856c3d945a969bc94a19989dda61c3d50ac2adb (patch) | |
tree | d2d7ef4dcbe41ad95cff5d22450e4df7c248226e | |
parent | db9fa82733607017fc93fe2a53178bf7527dfde8 (diff) | |
download | markupsafe-7856c3d945a969bc94a19989dda61c3d50ac2adb.tar.gz |
remove deprecated code
-rw-r--r-- | CHANGES.rst | 2 | ||||
-rw-r--r-- | src/markupsafe/__init__.py | 2 | ||||
-rw-r--r-- | src/markupsafe/_native.py | 12 | ||||
-rw-r--r-- | src/markupsafe/_speedups.c | 19 | ||||
-rw-r--r-- | tests/conftest.py | 5 | ||||
-rw-r--r-- | tests/test_markupsafe.py | 5 |
6 files changed, 2 insertions, 43 deletions
diff --git a/CHANGES.rst b/CHANGES.rst index 3f98624..9c483ef 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 d1bf187..ae39f91 100644 --- a/src/markupsafe/__init__.py +++ b/src/markupsafe/__init__.py @@ -285,9 +285,7 @@ try: 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 6f7eb7a..8117b27 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 44967b1..3c463fb 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 13f938c..d040ea8 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 1d4ac2e..2f13885 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 |