MCPcopy Create free account
hub / github.com/Oneflow-Inc/oneflow / PyUnpackLong

Function PyUnpackLong

oneflow/api/python/functional/common.cpp:410–416  ·  view source on GitHub ↗

int64_t

Source from the content-addressed store, hash-verified

408
409// int64_t
410Maybe<int64_t> PyUnpackLong(PyObject* py_obj) {
411 int overflow = -1;
412 long long val = PyLong_AsLongLongAndOverflow(py_obj, &overflow);
413 if (val == -1 && PyErr_Occurred()) { return Error::RuntimeError() << "Python exception occurs"; }
414 if (overflow != 0) { return Error::RuntimeError() << "Overflow when unpacking long"; }
415 return (int64_t)val;
416}
417
418} // namespace functional
419} // namespace one

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected