MCPcopy Create free account
hub / github.com/SamuraiT/mecab-python3 / SWIG_PyNumber_AsPyHash

Function SWIG_PyNumber_AsPyHash

src/MeCab/MeCab_wrap.cpp:2647–2662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2645}
2646
2647SWIGINTERN Py_hash_t
2648SWIG_PyNumber_AsPyHash(PyObject *obj) {
2649 Py_hash_t result = -1;
2650#if PY_VERSION_HEX < 0x03020000
2651 if (PyInt_Check(obj))
2652 result = PyInt_AsLong(obj);
2653 else if (PyLong_Check(obj))
2654 result = PyLong_AsLong(obj);
2655#else
2656 if (PyNumber_Check(obj))
2657 result = PyNumber_AsSsize_t(obj, NULL);
2658#endif
2659 else
2660 PyErr_Format(PyExc_TypeError, "Wrong type for hash function");
2661 return PyErr_Occurred() ? -1 : result;
2662}
2663
2664SWIGINTERN int
2665SwigPyBuiltin_BadInit(PyObject *self, PyObject *SWIGUNUSEDPARM(args), PyObject *SWIGUNUSEDPARM(kwds)) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected