diff --git a/docs/changelog.rst b/docs/changelog.rst index 285d9fc..59f33db 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -1,6 +1,11 @@ Changelog ========= +Version 1.2.1 (2023-10-17) +-------------------------- + +- Fixed STRFinder GC collection error + Version 1.2.0 (2023-10-15) -------------------------- - Fixed repeat search start position diff --git a/src/itr.c b/src/itr.c index b70d1ba..bbf74bc 100644 --- a/src/itr.c +++ b/src/itr.c @@ -343,12 +343,7 @@ static PyObject* pytrf_itrfinder_new(PyTypeObject *type, PyObject *args, PyObjec return (PyObject *)obj; } -void pytrf_itrfinder_dealloc(pytrf_ITRFinder *self) { - Py_DECREF(self->seqname); - Py_DECREF(self->seqobj); - - self->seq = NULL; - +static void pytrf_itrfinder_dealloc(pytrf_ITRFinder *self) { if (self->motif) { free(self->motif); } @@ -361,6 +356,11 @@ void pytrf_itrfinder_dealloc(pytrf_ITRFinder *self) { free(self->boundary); } + self->seq = NULL; + + Py_DECREF(self->seqname); + Py_DECREF(self->seqobj); + Py_TYPE(self)->tp_free((PyObject *)self); } diff --git a/src/str.c b/src/str.c index eb02484..b200104 100644 --- a/src/str.c +++ b/src/str.c @@ -47,13 +47,11 @@ static PyObject* pytrf_strfinder_new(PyTypeObject *type, PyObject *args, PyObjec } static void pytrf_strfinder_dealloc(pytrf_STRFinder *self) { - if (self->boundary) { - free(self->boundary); - } + self->seq = NULL; Py_DECREF(self->seqname); Py_DECREF(self->seqobj); - self->seq = NULL; + Py_TYPE(self)->tp_free((PyObject *)self); } @@ -133,7 +131,7 @@ static PyObject* pytrf_strfinder_as_list(pytrf_STRFinder *self) { //ssr length int sl; - + char motif[7]; Py_ssize_t i; diff --git a/src/version.h b/src/version.h index 7345915..119b975 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define PYTRF_VERSION "1.2.0" +#define PYTRF_VERSION "1.2.1"