summaryrefslogtreecommitdiff
path: root/django/utils/datastructures.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2017-09-07 08:16:21 -0400
committerGitHub <noreply@github.com>2017-09-07 08:16:21 -0400
commit6e4c6281dbb7ee12bcdc22620894edb4e9cf623f (patch)
tree1c21218d4b6f00c499f18943d5190ebe7b5248c9 /django/utils/datastructures.py
parent8b2515a450ef376b9205029090af0a79c8341bd7 (diff)
Reverted "Fixed #27818 -- Replaced try/except/pass with contextlib.suppress()."
This reverts commit 550cb3a365dee4edfdd1563224d5304de2a57fda because try/except performs better.
Diffstat (limited to 'django/utils/datastructures.py')
-rw-r--r--django/utils/datastructures.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
index 7713b08e8c..127c6dc774 100644
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -1,6 +1,5 @@
import copy
from collections import OrderedDict
-from contextlib import suppress
class OrderedSet:
@@ -19,8 +18,10 @@ class OrderedSet:
del self.dict[item]
def discard(self, item):
- with suppress(KeyError):
+ try:
self.remove(item)
+ except KeyError:
+ pass
def __iter__(self):
return iter(self.dict)