Skip to content

Commit

Permalink
Fixes #9
Browse files Browse the repository at this point in the history
  • Loading branch information
yuce committed May 24, 2018
1 parent c81a081 commit 2247234
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
11 changes: 2 additions & 9 deletions pyswip/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 9 additions & 0 deletions tests/test_prolog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 2247234

Please sign in to comment.