set_ops.c 351 B

1234567891011121314151617
  1. // Set primitive operations
  2. //
  3. // These are registered in mypyc.primitives.set_ops.
  4. #include <Python.h>
  5. #include "CPy.h"
  6. bool CPySet_Remove(PyObject *set, PyObject *key) {
  7. int success = PySet_Discard(set, key);
  8. if (success == 1) {
  9. return true;
  10. }
  11. if (success == 0) {
  12. _PyErr_SetKeyError(key);
  13. }
  14. return false;
  15. }