yuce / pyswip

PySwip is a Python - SWI-Prolog bridge enabling to query SWI-Prolog in your Python programs. It features an (incomplete) SWI-Prolog foreign language interface, a utility class that makes it easy querying with Prolog and also a Pythonic interface.
MIT License
465 stars 96 forks source link

cleanupProlog may try to convert generator to int #98

Open wvxvw opened 4 years ago

wvxvw commented 4 years ago

If the results of the last Prolog.query() call aren't consumed, then the _hook.exit_code will be a generator object. Converting it to an int will fail.

I think, the better way to deal with this is to check if the exit_code is a generator, and if so, warn the users about not executing all of the code they queried.

I'm talking about the file core.py, line 1358 in my version.