diff options
author | Leonard Richardson <leonardr@segfault.org> | 2019-01-06 19:39:06 -0500 |
---|---|---|
committer | Leonard Richardson <leonardr@segfault.org> | 2019-01-06 19:39:06 -0500 |
commit | 32845f6877557ec75a0c7791bf50da619d06536b (patch) | |
tree | db93987520e57d796e8d3ecceb275c86a01a31e2 | |
parent | 9c99d3050584a088b1d066aca0c21d04f87775b0 (diff) | |
download | beautifulsoup4-32845f6877557ec75a0c7791bf50da619d06536b.tar.gz |
Tried even harder to avoid the deprecation warning originally fixed in
4.6.1. [bug=1778909]
-rw-r--r-- | CHANGELOG | 5 | ||||
-rw-r--r-- | bs4/element.py | 8 |
2 files changed, 8 insertions, 5 deletions
@@ -1,4 +1,4 @@ -= 4.7.1 (Unreleased) += 4.7.1 (20190106) * Fixed a significant performance problem introduced in 4.7.0. [bug=1810617] @@ -8,6 +8,9 @@ * Beautiful Soup will no longer try to keep track of namespaces that are not defined with a prefix; this can confuse soupselect. [bug=1810680] +* Tried even harder to avoid the deprecation warning originally fixed in + 4.6.1. [bug=1778909] + = 4.7.0 (20181231) * Beautiful Soup's CSS Selector implementation has been replaced by a diff --git a/bs4/element.py b/bs4/element.py index 5718d31..547b8ba 100644 --- a/bs4/element.py +++ b/bs4/element.py @@ -217,7 +217,7 @@ class PageElement(object): if formatter is None: output = s else: - if callable(formatter): + if isinstance(formatter, Callable): # Backwards compatibility -- you used to pass in a formatting method. output = formatter(s) else: @@ -1138,7 +1138,7 @@ class Tag(PageElement): # First off, turn a string formatter into a Formatter object. This # will stop the lookup from happening over and over again. - if not isinstance(formatter, Formatter) and not callable(formatter): + if not isinstance(formatter, Formatter) and not isinstance(formatter, Callable): formatter = self._formatter_for_name(formatter) attrs = [] if self.attrs: @@ -1243,7 +1243,7 @@ class Tag(PageElement): """ # First off, turn a string formatter into a Formatter object. This # will stop the lookup from happening over and over again. - if not isinstance(formatter, Formatter) and not callable(formatter): + if not isinstance(formatter, Formatter) and not isinstance(formatter, Callable): formatter = self._formatter_for_name(formatter) pretty_print = (indent_level is not None) @@ -1425,7 +1425,7 @@ class SoupStrainer(object): def _normalize_search_value(self, value): # Leave it alone if it's a Unicode string, a callable, a # regular expression, a boolean, or None. - if (isinstance(value, unicode) or callable(value) or hasattr(value, 'match') + if (isinstance(value, unicode) or isinstance(value, Callable) or hasattr(value, 'match') or isinstance(value, bool) or value is None): return value |