Generated by Cython 0.25.2
Yellow lines hint at Python interaction.
Click on a line that starts with a "+" to see the C code that Cython generated for it.
Raw output: mmh3object.cpp
01: from libc.string cimport strlen
02: from libc.stdint cimport uint32_t, int32_t
03:
+04: cdef int hash_func(char* s):
static int __pyx_f_10mmh3object_hash_func(char *__pyx_v_s) {
uint32_t __pyx_v_seed;
int32_t __pyx_v_result[1];
int __pyx_r;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("hash_func", 0);
/* … */
/* function exit code */
__pyx_L0:;
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
+05: cdef uint32_t seed = 0;
__pyx_v_seed = 0;
06: cdef int32_t result[1];
07:
+08: MurmurHash3_x86_32(s, strlen(s), seed, result)
MurmurHash3_x86_32(__pyx_v_s, strlen(__pyx_v_s), __pyx_v_seed, __pyx_v_result);
09:
+10: return result[0]
__pyx_r = (__pyx_v_result[0]); goto __pyx_L0;
11:
+12: hash_True = hash_func(b"True")
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(((char *)"True"))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash_True, __pyx_t_1) < 0) __PYX_ERR(0, 12, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+13: hash_False = hash_func(b"False")
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(((char *)"False"))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash_False, __pyx_t_1) < 0) __PYX_ERR(0, 13, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+14: hash_None = hash_func(b"None")
__pyx_t_1 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(((char *)"None"))); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_1); if (PyDict_SetItem(__pyx_d, __pyx_n_s_hash_None, __pyx_t_1) < 0) __PYX_ERR(0, 14, __pyx_L1_error) __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
15:
+16: cpdef mmh3object(o):
static PyObject *__pyx_pw_10mmh3object_1mmh3object(PyObject *__pyx_self, PyObject *__pyx_v_o); /*proto*/
static PyObject *__pyx_f_10mmh3object_mmh3object(PyObject *__pyx_v_o, CYTHON_UNUSED int __pyx_skip_dispatch) {
PyTypeObject *__pyx_v_t = NULL;
PyObject *__pyx_v_e = NULL;
PyObject *__pyx_v_k = NULL;
PyObject *__pyx_v_v = NULL;
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mmh3object", 0);
/* … */
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_3);
__Pyx_XDECREF(__pyx_t_5);
__Pyx_XDECREF(__pyx_t_9);
__Pyx_XDECREF(__pyx_t_12);
__Pyx_XDECREF(__pyx_t_13);
__Pyx_AddTraceback("mmh3object.mmh3object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = 0;
__pyx_L0:;
__Pyx_XDECREF(__pyx_v_t);
__Pyx_XDECREF(__pyx_v_e);
__Pyx_XDECREF(__pyx_v_k);
__Pyx_XDECREF(__pyx_v_v);
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
/* Python wrapper */
static PyObject *__pyx_pw_10mmh3object_1mmh3object(PyObject *__pyx_self, PyObject *__pyx_v_o); /*proto*/
static char __pyx_doc_10mmh3object_mmh3object[] = "\n Makes a hash from a dictionary, list, tuple or set to any level, that contains\n only other hashable types (including any lists, tuples, sets, and\n dictionaries).\n ";
static PyObject *__pyx_pw_10mmh3object_1mmh3object(PyObject *__pyx_self, PyObject *__pyx_v_o) {
PyObject *__pyx_r = 0;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mmh3object (wrapper)", 0);
__pyx_r = __pyx_pf_10mmh3object_mmh3object(__pyx_self, ((PyObject *)__pyx_v_o));
/* function exit code */
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
static PyObject *__pyx_pf_10mmh3object_mmh3object(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_o) {
PyObject *__pyx_r = NULL;
__Pyx_RefNannyDeclarations
__Pyx_RefNannySetupContext("mmh3object", 0);
__Pyx_XDECREF(__pyx_r);
__pyx_t_1 = __pyx_f_10mmh3object_mmh3object(__pyx_v_o, 0); if (unlikely(!__pyx_t_1)) __PYX_ERR(0, 16, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_1);
__pyx_r = __pyx_t_1;
__pyx_t_1 = 0;
goto __pyx_L0;
/* function exit code */
__pyx_L1_error:;
__Pyx_XDECREF(__pyx_t_1);
__Pyx_AddTraceback("mmh3object.mmh3object", __pyx_clineno, __pyx_lineno, __pyx_filename);
__pyx_r = NULL;
__pyx_L0:;
__Pyx_XGIVEREF(__pyx_r);
__Pyx_RefNannyFinishContext();
return __pyx_r;
}
17: """
18: Makes a hash from a dictionary, list, tuple or set to any level, that contains
19: only other hashable types (including any lists, tuples, sets, and
20: dictionaries).
21: """
22:
+23: if o is True:
__pyx_t_1 = (__pyx_v_o == Py_True);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* … */
}
+24: return hash_True
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_hash_True); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 24, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
25:
+26: elif o is False:
__pyx_t_2 = (__pyx_v_o == Py_False);
__pyx_t_1 = (__pyx_t_2 != 0);
if (__pyx_t_1) {
/* … */
}
+27: return hash_False
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_hash_False); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 27, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
28:
+29: elif o is None:
__pyx_t_1 = (__pyx_v_o == Py_None);
__pyx_t_2 = (__pyx_t_1 != 0);
if (__pyx_t_2) {
/* … */
}
+30: return hash_None
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s_hash_None); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 30, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0;
31:
+32: t = type(o)
__Pyx_INCREF(((PyObject *)Py_TYPE(__pyx_v_o)));
__pyx_v_t = ((PyTypeObject*)((PyObject *)Py_TYPE(__pyx_v_o)));
33:
+34: if t is str or t is unicode or t is int or t is long or t is float:
__pyx_t_1 = (__pyx_v_t == (&PyString_Type));
__pyx_t_4 = (__pyx_t_1 != 0);
if (!__pyx_t_4) {
} else {
__pyx_t_2 = __pyx_t_4;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_4 = (__pyx_v_t == (&PyUnicode_Type));
__pyx_t_1 = (__pyx_t_4 != 0);
if (!__pyx_t_1) {
} else {
__pyx_t_2 = __pyx_t_1;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_1 = (__pyx_v_t == (&PyInt_Type));
__pyx_t_4 = (__pyx_t_1 != 0);
if (!__pyx_t_4) {
} else {
__pyx_t_2 = __pyx_t_4;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_4 = (__pyx_v_t == (&PyLong_Type));
__pyx_t_1 = (__pyx_t_4 != 0);
if (!__pyx_t_1) {
} else {
__pyx_t_2 = __pyx_t_1;
goto __pyx_L5_bool_binop_done;
}
__pyx_t_1 = (__pyx_v_t == (&PyFloat_Type));
__pyx_t_4 = (__pyx_t_1 != 0);
__pyx_t_2 = __pyx_t_4;
__pyx_L5_bool_binop_done:;
if (__pyx_t_2) {
/* … */
}
+35: return hash_func(bytes(repr(o)))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyObject_Repr(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 35, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 35, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
36:
+37: elif t is tuple or t is list:
__pyx_t_4 = (__pyx_v_t == (&PyTuple_Type));
__pyx_t_1 = (__pyx_t_4 != 0);
if (!__pyx_t_1) {
} else {
__pyx_t_2 = __pyx_t_1;
goto __pyx_L10_bool_binop_done;
}
__pyx_t_1 = (__pyx_v_t == (&PyList_Type));
__pyx_t_4 = (__pyx_t_1 != 0);
__pyx_t_2 = __pyx_t_4;
__pyx_L10_bool_binop_done:;
if (__pyx_t_2) {
/* … */
}
+38: return hash_func(bytes(repr([mmh3object(e) for e in o])))
__Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { __pyx_t_3 = __pyx_v_o; __Pyx_INCREF(__pyx_t_3); __pyx_t_7 = 0; __pyx_t_8 = NULL; } else { __pyx_t_7 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 38, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_7); __Pyx_INCREF(__pyx_t_9); __pyx_t_7++; if (unlikely(0 < 0)) __PYX_ERR(0, 38, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_7); __pyx_t_7++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { __pyx_t_9 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 38, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_9); } __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __pyx_f_10mmh3object_mmh3object(__pyx_v_e, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 38, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 38, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
39:
+40: elif t is dict:
__pyx_t_2 = (__pyx_v_t == (&PyDict_Type));
__pyx_t_4 = (__pyx_t_2 != 0);
if (__pyx_t_4) {
/* … */
}
+41: return hash_func(bytes(repr(sorted([(k, mmh3object(v)) for k, v in o.iteritems()]))))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_7 = 0; if (unlikely(__pyx_v_o == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); __PYX_ERR(0, 41, __pyx_L1_error) } __pyx_t_12 = __Pyx_dict_iterator(__pyx_v_o, 0, __pyx_n_s_iteritems, (&__pyx_t_10), (&__pyx_t_11)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = __pyx_t_12; __pyx_t_12 = 0; while (1) { __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_9, __pyx_t_10, &__pyx_t_7, &__pyx_t_12, &__pyx_t_13, NULL, __pyx_t_11); if (unlikely(__pyx_t_14 == 0)) break; if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GOTREF(__pyx_t_13); __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = __pyx_f_10mmh3object_mmh3object(__pyx_v_v, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_k); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_13); __pyx_t_13 = 0; if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_t_15 = PyList_Sort(__pyx_t_5); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 41, __pyx_L1_error) __pyx_t_3 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 41, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 41, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
42:
+43: elif t is set or t is frozenset:
__pyx_t_2 = (__pyx_v_t == (&PySet_Type));
__pyx_t_1 = (__pyx_t_2 != 0);
if (!__pyx_t_1) {
} else {
__pyx_t_4 = __pyx_t_1;
goto __pyx_L16_bool_binop_done;
}
__pyx_t_1 = (__pyx_v_t == (&PyFrozenSet_Type));
__pyx_t_2 = (__pyx_t_1 != 0);
__pyx_t_4 = __pyx_t_2;
__pyx_L16_bool_binop_done:;
if (__pyx_t_4) {
/* … */
}
+44: return hash_func(bytes(repr(sorted([mmh3object(e) for e in o]))))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { __pyx_t_9 = __pyx_v_o; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0; __pyx_t_8 = NULL; } else { __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 44, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_9))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_12 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 44, __pyx_L1_error) #else __pyx_t_12 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 44, __pyx_L1_error) #else __pyx_t_12 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); #endif } } else { __pyx_t_12 = __pyx_t_8(__pyx_t_9); if (unlikely(!__pyx_t_12)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 44, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_12); } __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __pyx_f_10mmh3object_mmh3object(__pyx_v_e, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_t_15 = PyList_Sort(__pyx_t_5); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 44, __pyx_L1_error) __pyx_t_3 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 44, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 44, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
45:
+46: elif isinstance(o, (tuple, list)):
__pyx_t_2 = PyTuple_Check(__pyx_v_o); __pyx_t_1 = (__pyx_t_2 != 0); if (!__pyx_t_1) { } else { __pyx_t_4 = __pyx_t_1; goto __pyx_L20_bool_binop_done; } __pyx_t_1 = PyList_Check(__pyx_v_o); __pyx_t_2 = (__pyx_t_1 != 0); __pyx_t_4 = __pyx_t_2; __pyx_L20_bool_binop_done:; __pyx_t_2 = (__pyx_t_4 != 0); if (__pyx_t_2) { /* … */ }
+47: return hash_func(bytes(repr([mmh3object(e) for e in o])))
__Pyx_XDECREF(__pyx_r); __pyx_t_5 = PyList_New(0); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { __pyx_t_3 = __pyx_v_o; __Pyx_INCREF(__pyx_t_3); __pyx_t_10 = 0; __pyx_t_8 = NULL; } else { __pyx_t_10 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = Py_TYPE(__pyx_t_3)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 47, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_3))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_9 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 47, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_10); __Pyx_INCREF(__pyx_t_9); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 47, __pyx_L1_error) #else __pyx_t_9 = PySequence_ITEM(__pyx_t_3, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); #endif } } else { __pyx_t_9 = __pyx_t_8(__pyx_t_3); if (unlikely(!__pyx_t_9)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 47, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_9); } __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = __pyx_f_10mmh3object_mmh3object(__pyx_v_e, 0); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); if (unlikely(__Pyx_ListComp_Append(__pyx_t_5, (PyObject*)__pyx_t_9))) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 47, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 47, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
48:
+49: elif isinstance(o, (set, frozenset)):
__pyx_t_4 = PySet_Check(__pyx_v_o);
__pyx_t_1 = (__pyx_t_4 != 0);
if (!__pyx_t_1) {
} else {
__pyx_t_2 = __pyx_t_1;
goto __pyx_L24_bool_binop_done;
}
__pyx_t_1 = PyFrozenSet_Check(__pyx_v_o);
__pyx_t_4 = (__pyx_t_1 != 0);
__pyx_t_2 = __pyx_t_4;
__pyx_L24_bool_binop_done:;
__pyx_t_4 = (__pyx_t_2 != 0);
if (__pyx_t_4) {
/* … */
}
+50: return hash_func(bytes(repr(sorted([mmh3object(e) for e in o]))))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); if (likely(PyList_CheckExact(__pyx_v_o)) || PyTuple_CheckExact(__pyx_v_o)) { __pyx_t_9 = __pyx_v_o; __Pyx_INCREF(__pyx_t_9); __pyx_t_10 = 0; __pyx_t_8 = NULL; } else { __pyx_t_10 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_v_o); if (unlikely(!__pyx_t_9)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_9); __pyx_t_8 = Py_TYPE(__pyx_t_9)->tp_iternext; if (unlikely(!__pyx_t_8)) __PYX_ERR(0, 50, __pyx_L1_error) } for (;;) { if (likely(!__pyx_t_8)) { if (likely(PyList_CheckExact(__pyx_t_9))) { if (__pyx_t_10 >= PyList_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_12 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 50, __pyx_L1_error) #else __pyx_t_12 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); #endif } else { if (__pyx_t_10 >= PyTuple_GET_SIZE(__pyx_t_9)) break; #if CYTHON_ASSUME_SAFE_MACROS && !CYTHON_AVOID_BORROWED_REFS __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_10); __Pyx_INCREF(__pyx_t_12); __pyx_t_10++; if (unlikely(0 < 0)) __PYX_ERR(0, 50, __pyx_L1_error) #else __pyx_t_12 = PySequence_ITEM(__pyx_t_9, __pyx_t_10); __pyx_t_10++; if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); #endif } } else { __pyx_t_12 = __pyx_t_8(__pyx_t_9); if (unlikely(!__pyx_t_12)) { PyObject* exc_type = PyErr_Occurred(); if (exc_type) { if (likely(exc_type == PyExc_StopIteration || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration))) PyErr_Clear(); else __PYX_ERR(0, 50, __pyx_L1_error) } break; } __Pyx_GOTREF(__pyx_t_12); } __Pyx_XDECREF_SET(__pyx_v_e, __pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = __pyx_f_10mmh3object_mmh3object(__pyx_v_e, 0); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_t_15 = PyList_Sort(__pyx_t_5); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 50, __pyx_L1_error) __pyx_t_3 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 50, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 50, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
51:
+52: elif isinstance(o, dict):
__pyx_t_4 = PyDict_Check(__pyx_v_o);
__pyx_t_2 = (__pyx_t_4 != 0);
if (__pyx_t_2) {
/* … */
}
+53: return hash_func(bytes(repr(sorted([(k, mmh3object(v)) for k, v in o.iteritems()]))))
__Pyx_XDECREF(__pyx_r); __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __pyx_t_10 = 0; if (unlikely(__pyx_v_o == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "iteritems"); __PYX_ERR(0, 53, __pyx_L1_error) } __pyx_t_12 = __Pyx_dict_iterator(__pyx_v_o, 0, __pyx_n_s_iteritems, (&__pyx_t_7), (&__pyx_t_11)); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_XDECREF(__pyx_t_9); __pyx_t_9 = __pyx_t_12; __pyx_t_12 = 0; while (1) { __pyx_t_14 = __Pyx_dict_iter_next(__pyx_t_9, __pyx_t_7, &__pyx_t_10, &__pyx_t_12, &__pyx_t_13, NULL, __pyx_t_11); if (unlikely(__pyx_t_14 == 0)) break; if (unlikely(__pyx_t_14 == -1)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_GOTREF(__pyx_t_13); __Pyx_XDECREF_SET(__pyx_v_k, __pyx_t_12); __pyx_t_12 = 0; __Pyx_XDECREF_SET(__pyx_v_v, __pyx_t_13); __pyx_t_13 = 0; __pyx_t_13 = __pyx_f_10mmh3object_mmh3object(__pyx_v_v, 0); if (unlikely(!__pyx_t_13)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_13); __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_12); __Pyx_INCREF(__pyx_v_k); __Pyx_GIVEREF(__pyx_v_k); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_k); __Pyx_GIVEREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_13); __pyx_t_13 = 0; if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_12))) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; } __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_5 = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; __pyx_t_15 = PyList_Sort(__pyx_t_5); if (unlikely(__pyx_t_15 == -1)) __PYX_ERR(0, 53, __pyx_L1_error) __pyx_t_3 = PyObject_Repr(__pyx_t_5); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_3); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 53, __pyx_L1_error) __pyx_t_5 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 53, __pyx_L1_error) __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_5; __pyx_t_5 = 0; goto __pyx_L0;
54:
55: else:
+56: return hash_func(bytes(repr(o)))
/*else*/ {
__Pyx_XDECREF(__pyx_r);
__pyx_t_5 = PyObject_Repr(__pyx_v_o); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_GIVEREF(__pyx_t_5);
PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5);
__pyx_t_5 = 0;
__pyx_t_5 = __Pyx_PyObject_Call(((PyObject *)(&PyBytes_Type)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) __PYX_ERR(0, 56, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_5);
__Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0;
__pyx_t_6 = __Pyx_PyObject_AsString(__pyx_t_5); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) __PYX_ERR(0, 56, __pyx_L1_error)
__pyx_t_3 = __Pyx_PyInt_From_int(__pyx_f_10mmh3object_hash_func(__pyx_t_6)); if (unlikely(!__pyx_t_3)) __PYX_ERR(0, 56, __pyx_L1_error)
__Pyx_GOTREF(__pyx_t_3);
__Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
__pyx_r = __pyx_t_3;
__pyx_t_3 = 0;
goto __pyx_L0;
}