summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2019-01-06 19:39:06 -0500
committerLeonard Richardson <leonardr@segfault.org>2019-01-06 19:39:06 -0500
commit32845f6877557ec75a0c7791bf50da619d06536b (patch)
treedb93987520e57d796e8d3ecceb275c86a01a31e2
parent9c99d3050584a088b1d066aca0c21d04f87775b0 (diff)
downloadbeautifulsoup4-32845f6877557ec75a0c7791bf50da619d06536b.tar.gz
Tried even harder to avoid the deprecation warning originally fixed in
4.6.1. [bug=1778909]
-rw-r--r--CHANGELOG5
-rw-r--r--bs4/element.py8
2 files changed, 8 insertions, 5 deletions
diff --git a/CHANGELOG b/CHANGELOG
index 389b949..d3c8578 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -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