Skip to content

Commit

Permalink
Merge pull request #261 from pallets/remove-deprecated-code
Browse files Browse the repository at this point in the history
remove deprecated code
  • Loading branch information
davidism committed Nov 5, 2021
2 parents db9fa82 + 7856c3d commit 00ada4b
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 43 deletions.
2 changes: 2 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down
2 changes: 0 additions & 2 deletions src/markupsafe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 0 additions & 12 deletions src/markupsafe/_native.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
19 changes: 0 additions & 19 deletions src/markupsafe/_speedups.c
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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 */
};

Expand Down
5 changes: 0 additions & 5 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 0 additions & 5 deletions tests/test_markupsafe.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 00ada4b

Please sign in to comment.