Menu

#11 massFractions() is deallocating None in python?

open
nobody
None
5
2008-04-25
2008-04-25
No

My Python script would fail after running for a little while with the error message "Fatal Python error: deallocating None" causing the whole python shell to close.

By inserting
print sys.getrefcount(None)
at various places I tracked it down to the problem to a call to gas.massFractions().

Every time I call this function (in the script or just the python shell), the value of sys.getrefcount(None) decreases, until it reaches zero and Python crashes.

I have worked around this problem by replacing
gas.massFractions()
with the equivalent
array([gas.massFraction(i) for i in range(gas.nSpecies())])
which seems to work. I am not sure what the underlying cause is though.

This is with a fresh Cantera build checked out of anonymous CVS yesterday.

Discussion


Log in to post a comment.

MongoDB Logo MongoDB