Commit 76a2b9c9 by Eric Coissac

attempt to solve the memory bug

parent a13e9bdd
......@@ -86,29 +86,41 @@ cdef dict listCodons2Dict(tuple codons):
return d
# cpdef dict bindCodons(dict codon1, dict codon2):
# cdef PyObject* pkey
# cdef bytes key
# cdef PyObject* pvalue # @DuplicatedSignature
# cdef dict l2
# cdef dict l3
# cdef Py_ssize_t ppos1=0
# cdef Py_ssize_t ppos2=0
# cdef Py_ssize_t ppos3=0
#
# while PyDict_Next(codon1, &ppos1, &pkey, &pvalue):
# l2=<object>pvalue
# ppos2=0
# while PyDict_Next(l2, &ppos2, &pkey, &pvalue):
# l3=<object>pvalue
# ppos3=0
# while PyDict_Next(l3, &ppos3, &pkey, &pvalue):
# Py_XDECREF(pvalue)
# key=<object>pkey
# PyDict_SetItem(l3,key,codon2)
#
# return codon1
cpdef dict bindCodons(dict codon1, dict codon2):
cdef PyObject* pkey
cdef bytes key
cdef PyObject* pvalue # @DuplicatedSignature
cdef dict l2
cdef dict l3
cdef Py_ssize_t ppos1=0
cdef Py_ssize_t ppos2=0
cdef Py_ssize_t ppos3=0
while PyDict_Next(codon1, &ppos1, &pkey, &pvalue):
l2=<object>pvalue
ppos2=0
while PyDict_Next(l2, &ppos2, &pkey, &pvalue):
l3=<object>pvalue
ppos3=0
while PyDict_Next(l3, &ppos3, &pkey, &pvalue):
Py_XDECREF(pvalue)
key=<object>pkey
PyDict_SetItem(l3,key,codon2)
for l2 in codon1.values():
for l3 in l2.values():
for key in l3:
l3[key]=codon2
return codon1
cpdef dict codon(char aa, bint direct=True):
cdef tuple value
cdef char letter[2]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment