diff --git a/bindings/python/libmata/parser.pxd b/bindings/python/libmata/parser.pxd index 73ed3d5fe..826d9ea0b 100644 --- a/bindings/python/libmata/parser.pxd +++ b/bindings/python/libmata/parser.pxd @@ -13,7 +13,6 @@ cdef extern from "" namespace "std": cdef cppclass ifstream(istream): ifstream() except+ ifstream(const char*) except + - void open(const char*) cdef extern from "mata/parser/re2parser.hh" namespace "mata::parser": cdef void create_nfa(CNfa*, string) except + diff --git a/bindings/python/libmata/parser.pyx b/bindings/python/libmata/parser.pyx index 5948bce07..625b7e8f4 100644 --- a/bindings/python/libmata/parser.pyx +++ b/bindings/python/libmata/parser.pyx @@ -44,7 +44,7 @@ def from_mata(src, alph.Alphabet alphabet): # either load single automata if isinstance(src, str): - fs.open(src.encode('utf-8')) + fs = parser.ifstream(src.encode('utf-8')) res_inter_aut = parser.parse_from_mf(parser.parse_mf(fs, True)) result = mata_nfa.Nfa() if res_inter_aut[0].is_bitvector(): @@ -64,9 +64,9 @@ def from_mata(src, alph.Alphabet alphabet): else: automata = [] for file in src: - fs.open(file.encode('utf-8')) + fs = parser.ifstream(file.encode('utf-8')) res_inter_aut = parser.parse_from_mf(parser.parse_mf(fs, True)) - inter_aut.push_back(res_inter_aut[0]) + inter_aut.emplace_back(res_inter_aut[0]) if inter_aut[0].is_bitvector(): mintermized_inter_aut = mintermization.c_mintermize_vec(inter_aut) else: