Show More
@@ -793,6 +793,7 b' static PyObject *compute_phases_map_sets' | |||||
793 | PyObject *roots = Py_None; |
|
793 | PyObject *roots = Py_None; | |
794 | PyObject *pyphase = NULL; |
|
794 | PyObject *pyphase = NULL; | |
795 | PyObject *pyrev = NULL; |
|
795 | PyObject *pyrev = NULL; | |
|
796 | PyObject *phasesetsdict = NULL; | |||
796 | PyObject *phaseroots = NULL; |
|
797 | PyObject *phaseroots = NULL; | |
797 | PyObject *phasesets[4] = {NULL, NULL, NULL, NULL}; |
|
798 | PyObject *phasesets[4] = {NULL, NULL, NULL, NULL}; | |
798 | Py_ssize_t len = index_length(self); |
|
799 | Py_ssize_t len = index_length(self); | |
@@ -880,14 +881,16 b' static PyObject *compute_phases_map_sets' | |||||
880 | } |
|
881 | } | |
881 | Py_DECREF(pyrev); |
|
882 | Py_DECREF(pyrev); | |
882 | } |
|
883 | } | |
883 | phaseroots = _dict_new_presized(numphases); |
|
884 | ||
884 | if (phaseroots == NULL) |
|
885 | phasesetsdict = _dict_new_presized(numphases); | |
|
886 | if (phasesetsdict == NULL) | |||
885 | goto release; |
|
887 | goto release; | |
886 | for (i = 0; i < numphases; ++i) { |
|
888 | for (i = 0; i < numphases; ++i) { | |
887 | pyphase = PyInt_FromLong(trackedphases[i]); |
|
889 | pyphase = PyInt_FromLong(trackedphases[i]); | |
888 | if (pyphase == NULL) |
|
890 | if (pyphase == NULL) | |
889 | goto release; |
|
891 | goto release; | |
890 |
if (PyDict_SetItem(phase |
|
892 | if (PyDict_SetItem(phasesetsdict, pyphase, phasesets[i]) == | |
|
893 | -1) { | |||
891 | Py_DECREF(pyphase); |
|
894 | Py_DECREF(pyphase); | |
892 | goto release; |
|
895 | goto release; | |
893 | } |
|
896 | } | |
@@ -895,12 +898,12 b' static PyObject *compute_phases_map_sets' | |||||
895 | phasesets[i] = NULL; |
|
898 | phasesets[i] = NULL; | |
896 | } |
|
899 | } | |
897 |
|
900 | |||
898 |
return Py_BuildValue("nN", len, phase |
|
901 | return Py_BuildValue("nN", len, phasesetsdict); | |
899 |
|
902 | |||
900 | release: |
|
903 | release: | |
901 | for (i = 0; i < numphases; ++i) |
|
904 | for (i = 0; i < numphases; ++i) | |
902 | Py_XDECREF(phasesets[i]); |
|
905 | Py_XDECREF(phasesets[i]); | |
903 |
Py_XDECREF(phase |
|
906 | Py_XDECREF(phasesetsdict); | |
904 |
|
907 | |||
905 | free(phases); |
|
908 | free(phases); | |
906 | return NULL; |
|
909 | return NULL; |
General Comments 0
You need to be logged in to leave comments.
Login now