Skip to content

Commit

Permalink
Use BTree_ShouldSuppressKeyError
Browse files Browse the repository at this point in the history
  • Loading branch information
jamadden committed Apr 10, 2021
1 parent 1b02aab commit fb615ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
10 changes: 2 additions & 8 deletions src/BTrees/SetTemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,7 @@ Set_discard(Bucket* self, PyObject* args)
return NULL;

if (_bucket_set(self, key, NULL, 0, 1, 0) < 0) {
/* XXX: After PR#162, this should change to
BTree_ShouldSuppressKeyError() */
PyObject* exc_type = PyErr_Occurred();
if (exc_type == PyExc_KeyError) {
if (BTree_ShouldSuppressKeyError()) {
PyErr_Clear();
}
else if (PyErr_ExceptionMatches(PyExc_TypeError)) {
Expand Down Expand Up @@ -462,10 +459,7 @@ set_isub(Bucket* self, PyObject* other)
}
}
if (_bucket_set(self, v, NULL, 0, 1, 0) < 0) {
/* XXX: With PR#162 this can be changed to
BTree_ShouldSuppressKeyError() */
PyObject* exc_type = PyErr_Occurred();
if (exc_type == PyExc_KeyError) {
if (BTree_ShouldSuppressKeyError()) {
PyErr_Clear();
}
else {
Expand Down
10 changes: 2 additions & 8 deletions src/BTrees/TreeSetTemplate.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,7 @@ TreeSet_discard(BTree *self, PyObject *args)
return NULL;

if (_BTree_set(self, key, NULL, 0, 1) < 0) {
/* XXX: After PR#162, this should change to
BTree_ShouldSuppressKeyError() */
PyObject* exc_type = PyErr_Occurred();
if (exc_type == PyExc_KeyError) {
if (BTree_ShouldSuppressKeyError()) {
PyErr_Clear();
}
else if (PyErr_ExceptionMatches(PyExc_TypeError)) {
Expand Down Expand Up @@ -382,10 +379,7 @@ TreeSet_isub(BTree* self, PyObject* other)
}
}
if (_BTree_set(self, v, NULL, 0, 1) < 0) {
/* XXX: With PR#162 this can be changed to
BTree_ShouldSuppressKeyError() */
PyObject* exc_type = PyErr_Occurred();
if (exc_type == PyExc_KeyError) {
if (BTree_ShouldSuppressKeyError()) {
PyErr_Clear();
}
else {
Expand Down

0 comments on commit fb615ef

Please sign in to comment.