Skip to content

Commit

Permalink
[Python] Fix compilation with Cython 3.0a6
Browse files Browse the repository at this point in the history
  • Loading branch information
speth committed May 1, 2021
1 parent 5ae11d8 commit d3ee682
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions interfaces/cython/cantera/thermo.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -970,10 +970,12 @@ cdef class ThermoPhase(_SolutionBase):
self.thermo.setMoleFractions_NoNorm(&data[0])

def mass_fraction_dict(self, double threshold=0.0):
cdef pair[string,double] item
Y = self.thermo.getMassFractionsByName(threshold)
return {pystr(item.first):item.second for item in Y}

def mole_fraction_dict(self, double threshold=0.0):
cdef pair[string,double] item
X = self.thermo.getMoleFractionsByName(threshold)
return {pystr(item.first):item.second for item in X}

Expand Down
1 change: 1 addition & 0 deletions interfaces/cython/cantera/utils.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ cdef anyvalue_to_python(string name, CxxAnyValue& v):


cdef anymap_to_dict(CxxAnyMap& m):
cdef pair[string,CxxAnyValue] item
m.applyUnits()
if m.empty():
return {}
Expand Down

0 comments on commit d3ee682

Please sign in to comment.