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