summaryrefslogtreecommitdiff
path: root/bs4/element.py
diff options
context:
space:
mode:
authorLeonard Richardson <leonardr@segfault.org>2016-07-18 20:20:00 -0400
committerLeonard Richardson <leonardr@segfault.org>2016-07-18 20:20:00 -0400
commitd152430325e8ebbf5a5be46c4c0a3f8489c119ff (patch)
tree95b7d9b2d6a57193db4f1ddbe7bc4dd145cb7e72 /bs4/element.py
parent8ffca2780147d03908210d8869b3c86a46906652 (diff)
The argument to now works correctly, though it's
not implemented very efficiently. [bug=1520530]
Diffstat (limited to 'bs4/element.py')
-rw-r--r--bs4/element.py5
1 files changed, 2 insertions, 3 deletions
diff --git a/bs4/element.py b/bs4/element.py
index 84c4a6e..7a3aa52 100644
--- a/bs4/element.py
+++ b/bs4/element.py
@@ -1537,13 +1537,12 @@ class Tag(PageElement):
# don't include it in the context more than once.
new_context.append(candidate)
new_context_ids.add(id(candidate))
- if limit and len(new_context) >= limit:
- break
elif self._select_debug:
print " FAILURE %s %s" % (candidate.name, repr(candidate.attrs))
-
current_context = new_context
+ if limit and len(current_context) >= limit:
+ current_context = current_context[:limit]
if self._select_debug:
print "Final verdict:"