diff --git a/CXX/yapt.hh b/CXX/yapt.hh index 0edd8d949..44f7b8b51 100644 --- a/CXX/yapt.hh +++ b/CXX/yapt.hh @@ -22,7 +22,10 @@ protected: void mk(Term t0); /// internal method to convert from term to handle Term gt(); /// get handle and obtain term public: - virtual ~YAPTerm(){}; + virtual ~YAPTerm(){ LOCAL_HandleBase[t] = TermFreeTerm; + while ( LOCAL_HandleBase[LOCAL_CurSlot-1] == TermFreeTerm) + LOCAL_CurSlot--; + } YAPTerm(Term tn) { mk(tn); } /// private method to convert from Term (internal YAP representation) to diff --git a/packages/python/python.c b/packages/python/python.c index cdc8efe86..b86f075b3 100644 --- a/packages/python/python.c +++ b/packages/python/python.c @@ -93,7 +93,7 @@ X_API bool init_python(void) { // wait for YAP_Init return false; } - PyGILState_STATE gstate = PyGILState_Ensure(); + // PyGILState_STATE gstate = PyGILState_Ensure(); term_t t = PL_new_term_ref(); if (!Py_IsInitialized()) { python_in_python = true; @@ -112,6 +112,6 @@ X_API bool init_python(void) { PL_reset_term_refs(t); install_pypreds(); install_pl2pl(); - PyGILState_Release(gstate); + //PyGILState_Release(gstate); return !python_in_python; }