| 252 | } |
| 253 | |
| 254 | inline int64_t unpackLong(PyObject* obj) { |
| 255 | int overflow; |
| 256 | long long value = PyLong_AsLongLongAndOverflow(obj, &overflow); |
| 257 | if (value == -1 && PyErr_Occurred()) { |
| 258 | throw std::runtime_error( |
| 259 | "python occur error, maybe the id input is not standard"); |
| 260 | } |
| 261 | if (overflow != 0) { |
| 262 | throw std::runtime_error("Overflow when unpacking long"); |
| 263 | } |
| 264 | return (int64_t)value; |
| 265 | } |
| 266 | |
| 267 | static void set_worker_pids(PyObject* id, PyObject* tuple_item) { |
| 268 | int64_t key = unpackLong(id); |
no outgoing calls
no test coverage detected