File: src/BTrees/BTreeTemplate.c
Function: BTree_pop
Error: returning (PyObject*)NULL without setting an exception
1779 static PyObject *
1780 BTree_pop(BTree *self, PyObject *args)
1781 {
1782   PyObject *key;
1783   PyObject *failobj = NULL; /* default */
1784   PyObject *value;          /* return value */
1785 
1786   if (! PyArg_UnpackTuple(args, "pop", 1, 2, &key, &failobj))
when PyArg_UnpackTuple() successfully unpacks 1 argument(s)
taking False path
1787     return NULL;
1788 
1789   value = _BTree_get(self, key, 0);
when _BTree_get() succeeds
1790   if (value != NULL) {
taking True path
1791     /* Delete key and associated value. */
1792     if (_BTree_set(self, key, NULL, 0, 0) < 0) {
when considering range: -0x80000000 <= value <= -1
taking True path
1793       Py_DECREF(value);
when taking True path
1794       return NULL;;
1795     }
1796     return value;
1797   }
1798 
1799   /* The key isn't in the tree.  If that's not due to a KeyError exception,
1800    * pass back the unexpected exception.
1801    */
1802   if (! PyErr_ExceptionMatches(PyExc_KeyError))
1803     return NULL;
1804 
1805   if (failobj != NULL) {
1806     /* Clear the KeyError and return the explicit default. */
1807     PyErr_Clear();
1808     Py_INCREF(failobj);
1809     return failobj;
1810   }
1811 
1812   /* No default given.  The only difference in this case is the error
1813    * message, which depends on whether the tree is empty.
1814    */
1815   if (BTree_length_or_nonzero(self, 1) == 0) /* tree is empty */
1816     PyErr_SetString(PyExc_KeyError, "pop(): BTree is empty");
1817   return NULL;
1818 }
returning (PyObject*)NULL without setting an exception
found 3 similar trace(s) to this