Skip to content

Commit

Permalink
Add Cython language_level directive to _cantera.pyx
Browse files Browse the repository at this point in the history
This fixes the warnings generated by recent versions of Cython that
the language_level will be changed in the future. By setting this
directive, all the code in the .pyx files should be written in
Python 3 syntax. This required several changes to the import
syntax in the files to fix relative vs. absolute imports
  • Loading branch information
bryanwweber authored and speth committed Mar 11, 2019
1 parent d6d91f4 commit 6c0866e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions interfaces/cython/cantera/_cantera.pxd
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# This file is part of Cantera. See License.txt in the top-level directory or
# at http://www.cantera.org/license.txt for license and copyright information.
# cython: language_level=3

from libcpp.vector cimport vector
from libcpp.string cimport string
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/_cantera.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import math

from cython.operator cimport dereference as deref, preincrement as inc

from _cantera cimport *
from ._cantera cimport *

include "utils.pyx"
include "constants.pyx"
Expand Down
4 changes: 2 additions & 2 deletions interfaces/cython/cantera/onedim.pyx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This file is part of Cantera. See License.txt in the top-level directory or
# at http://www.cantera.org/license.txt for license and copyright information.

import interrupts
from .interrupts import no_op
import warnings

# Need a pure-python class to store weakrefs to
Expand Down Expand Up @@ -589,7 +589,7 @@ cdef class Sim1D:

self.sim = new CxxSim1D(D)
self.domains = tuple(domains)
self.set_interrupt(interrupts.no_op)
self.set_interrupt(no_op)
self._initialized = False
self._initial_guess_args = ()
self._initial_guess_kwargs = {}
Expand Down
2 changes: 1 addition & 1 deletion interfaces/cython/cantera/reactionpath.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ cdef class ReactionPathDiagram:
self.diagram, True)
self.built = True
if verbose:
print self.log
print(self.log)

property log:
"""
Expand Down

0 comments on commit 6c0866e

Please sign in to comment.