From 22472340105a8a5134da64159172fea5ad130262 Mon Sep 17 00:00:00 2001 From: Yuce Tekol Date: Thu, 24 May 2018 22:49:16 +0300 Subject: [PATCH] Fixes #9 --- pyswip/core.py | 11 ++--------- tests/test_prolog.py | 9 +++++++++ 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/pyswip/core.py b/pyswip/core.py index c1090e1..dd3269c 100644 --- a/pyswip/core.py +++ b/pyswip/core.py @@ -795,15 +795,8 @@ def check_and_call(*args): PL_get_atom_chars = check_strings(None, 1)(PL_get_atom_chars) -##define PL_get_string_chars(t, s, l) PL_get_string(t,s,l) -# /* PL_get_string() is depricated */ -#PL_EXPORT(int) PL_get_string(term_t t, char **s, size_t *len); -PL_get_string = _lib.PL_get_string - -PL_get_string = check_strings(None, 1)(PL_get_string) - -PL_get_string_chars = PL_get_string -#PL_get_string_chars.argtypes = [term_t, POINTER(c_char_p), c_int_p] +PL_get_string_chars = _lib.PL_get_string +PL_get_string_chars.argtypes = [term_t, POINTER(c_char_p), c_int_p] #PL_EXPORT(int) PL_get_chars(term_t t, char **s, unsigned int flags); PL_get_chars = _lib.PL_get_chars # FIXME: diff --git a/tests/test_prolog.py b/tests/test_prolog.py index bc22b84..58ef141 100644 --- a/tests/test_prolog.py +++ b/tests/test_prolog.py @@ -72,6 +72,15 @@ def test_nested_queries(self): # query pass + def test_prolog_strings(self): + """ + See: https://github.com/yuce/pyswip/issues/9 + """ + + import pyswip + p = pyswip.Prolog() + p.assertz('some_string_fact("abc")') + self.assertEqual([{"S": b"abc"}], list(p.query("some_string_fact(S)"))) if __name__ == "__main__": unittest.main()