[Python] Fix compatibility with Cython < 0.27

After setting the "language_level" directive (6c0866ef), nested comprehension
expressions erroneously triggered an error message from the Cython compiler
saying "local variable 's' referenced before assignment". While the problem has
been fixed in Cython 0.27 and newer, this commit restores compatibility with
older Cython versions as well.
This commit is contained in:
Ray Speth 2019-03-14 13:59:53 -04:00
parent 5e226535de
commit 968dc24925

View file

@ -659,9 +659,13 @@ cdef class ThermoPhase(_SolutionBase):
>>> gas.get_equivalence_ratio(ignore=['NO'])
1.0
"""
if not oxidizers: # Default behavior, find all possible oxidizers
oxidizers = [s.name for s in self.species() if
all(y not in s.composition for y in ['C', 'H', 'S'])]
if not oxidizers:
# Default behavior, find all possible oxidizers
oxidizers = []
for s in self.species():
if all(y not in s.composition for y in ['C', 'H', 'S']):
oxidizers.append(s.name)
alpha = 0
mol_O = 0
for k, s in enumerate(self.species()):