[gringo] 03/06: gringo-solve-multi.patch: regenerated from gbp pq

Thomas Krennwallner tkren-guest at moszumanska.debian.org
Wed Dec 7 20:25:14 UTC 2016


This is an automated email from the git hooks/post-receive script.

tkren-guest pushed a commit to branch devel
in repository gringo.

commit 920b71a6ba4da10e18b23596ac8f0a9095d166ee
Author: Thomas Krennwallner <tkren at kr.tuwien.ac.at>
Date:   Wed Dec 7 08:21:08 2016 +0100

    gringo-solve-multi.patch: regenerated from gbp pq
---
 debian/patches/gringo-solve-multi.patch | 379 +++++++++++++++++---------------
 1 file changed, 196 insertions(+), 183 deletions(-)

diff --git a/debian/patches/gringo-solve-multi.patch b/debian/patches/gringo-solve-multi.patch
index 1484a1f..785667e 100644
--- a/debian/patches/gringo-solve-multi.patch
+++ b/debian/patches/gringo-solve-multi.patch
@@ -1,135 +1,23 @@
-Author: Roland Kaminski <kaminski at cs.uni-potsdam.de>
-Description: fixes random multithreading segfaults with the python module
+From: Roland Kaminski <kaminski at cs.uni-potsdam.de>
+Date: Wed, 7 Dec 2016 07:50:31 +0100
+Subject: fixes random multithreading segfaults with the python module
 Bug: https://sourceforge.net/p/potassco/bugs/117/
-Index: gringo-git-gbp/libgringo/gringo/control.hh
+
 ===================================================================
---- gringo-git-gbp.orig/libgringo/gringo/control.hh
-+++ gringo-git-gbp/libgringo/gringo/control.hh
-@@ -173,9 +173,10 @@ struct Control {
-     virtual DomainProxy &getDomain() = 0;
- 
-     virtual void ground(GroundVec const &vec, Any &&context) = 0;
--    virtual SolveResult solve(ModelHandler h, Assumptions &&assumptions) = 0;
--    virtual SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh, Assumptions &&assumptions) = 0;
--    virtual SolveIter *solveIter(Assumptions &&assumptions) = 0;
-+    virtual void prepareSolve(Assumptions &&assumptions) = 0;
-+    virtual SolveResult solve(ModelHandler h) = 0;
-+    virtual SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh) = 0;
-+    virtual SolveIter *solveIter() = 0;
-     virtual void add(std::string const &name, FWStringVec const &params, std::string const &part) = 0;
-     virtual void load(std::string const &filename) = 0;
-     virtual Value getConst(std::string const &name) = 0;
-Index: gringo-git-gbp/libgringo/src/lua.cc
-===================================================================
---- gringo-git-gbp.orig/libgringo/src/lua.cc
-+++ gringo-git-gbp/libgringo/src/lua.cc
-@@ -1046,6 +1046,7 @@ struct ControlWrap {
-             mIndex = lua_gettop(L);
-         }
-         Control::Assumptions *ass = getAssumptions(L, assIdx);
-+        protect<void>(L, [&ctl, ass]() { ctl.prepareSolve(std::move(*ass)); });
-         lua_pushinteger(L, protect<int>(L, [L, &ctl, model, ass, mhIndex, mIndex]() {
-             return (int)ctl.solve(!model ? Control::ModelHandler(nullptr) : [L, model, mhIndex, mIndex](Gringo::Model const &m) -> bool {
-                 LuaClear lc(L);
-@@ -1057,7 +1058,7 @@ struct ControlWrap {
-                 Location loc("<on_model>", 1, 1, "<on_model>", 1, 1);
-                 handleError(L, loc, code, "error in model callback");
-                 return lua_type(L, -1) == LUA_TNIL || lua_toboolean(L, -1);
--            }, std::move(*ass));
-+            });
-         }));
-         return 1;
-     }
-@@ -1075,6 +1076,7 @@ struct ControlWrap {
-         int mhIndex = !lua_isnone(L, 3) && !lua_isnil(L, 3) ? 3 : 0;
-         int fhIndex = !lua_isnone(L, 4) && !lua_isnil(L, 4) ? 4 : 0;
-         Control::Assumptions *ass = getAssumptions(L, assIdx);
-+        protect<void>(L, [&ctl, ass]() { ctl.prepareSolve(std::move(*ass)); });
-         auto &future = *(Gringo::SolveFuture **)lua_newuserdata(L, sizeof(Gringo::SolveFuture*));
-         lua_State *M = nullptr;
-         if (mhIndex || fhIndex) {
-@@ -1097,7 +1099,7 @@ struct ControlWrap {
-             lua_xmove(L, M, 1);
-             fhIndex = lua_gettop(M);
-         }
--        future = protect<Gringo::SolveFuture*>(L, [&ctl, model, mhIndex, fhIndex, ass, M]() {
-+        future = protect<Gringo::SolveFuture*>(L, [&ctl, model, mhIndex, fhIndex, M]() {
-             auto mh = !mhIndex ? Control::ModelHandler(nullptr) : [M, mhIndex, model](Gringo::Model const &m) -> bool {
-                 LuaClear lc(M);
-                 lua_pushcfunction(M, luaTraceback);
-@@ -1119,7 +1121,7 @@ struct ControlWrap {
-                 Location loc("<on_finish>", 1, 1, "<on_finish>", 1, 1);
-                 handleError(M, loc, code, "error in model callback");
-             };
--            return ctl.solveAsync(mh, fh, std::move(*ass));
-+            return ctl.solveAsync(mh, fh);
-         });
-         luaL_getmetatable(L, "gringo.SolveFuture");
-         lua_setmetatable(L, -2);
-@@ -1131,8 +1133,9 @@ struct ControlWrap {
-         lua_unsetuservaluefield(L, 1, "stats");
-         int assIdx  = !lua_isnone(L, 2) && !lua_isnil(L, 2) ? 2 : 0;
-         Control::Assumptions *ass = getAssumptions(L, assIdx);
-+        protect<void>(L, [&ctl, ass]() { ctl.prepareSolve(std::move(*ass)); });
-         auto &iter = *(Gringo::SolveIter **)lua_newuserdata(L, sizeof(Gringo::SolveIter*));
--        iter = protect<Gringo::SolveIter*>(L, [&ctl, ass]() { return ctl.solveIter(std::move(*ass)); });
-+        iter = protect<Gringo::SolveIter*>(L, [&ctl]() { return ctl.solveIter(); });
-         luaL_getmetatable(L, "gringo.SolveIter");
-         lua_setmetatable(L, -2);
-         return 1;
-Index: gringo-git-gbp/libgringo/src/python.cc
-===================================================================
---- gringo-git-gbp.orig/libgringo/src/python.cc
-+++ gringo-git-gbp/libgringo/src/python.cc
-@@ -2069,11 +2069,12 @@ struct ControlWrap {
-         Gringo::SolveFuture *future;
-         Object omh(mh, true);
-         Object ofh(fh, true);
--        if (!protect([self, omh, ofh, &future, &ass]() {
-+        if (!protect([self, &ass]() { self->ctl->prepareSolve(std::move(ass)); })) { return nullptr; }
-+        if (!protect([self, omh, ofh, &future]() {
-+            PyUnblock unblock;
-             future = (self->ctl->solveAsync(
-                 omh == Py_None ? Control::ModelHandler(nullptr) : [omh](Gringo::Model const &m) -> bool { PyBlock b; (void)b; return on_model(m, omh); },
--                ofh == Py_None ? Control::FinishHandler(nullptr) : [ofh](Gringo::SolveResult ret, bool canceled) -> void { PyBlock b; (void)b; on_finish(ret, canceled, ofh); },
--                std::move(ass)
-+                ofh == Py_None ? Control::FinishHandler(nullptr) : [ofh](Gringo::SolveResult ret, bool canceled) -> void { PyBlock b; (void)b; on_finish(ret, canceled, ofh); }
-             ));
-         })) { return nullptr; }
-         PyObject *ret = SolveFuture::new_(*future);
-@@ -2088,8 +2089,12 @@ struct ControlWrap {
-         if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O", const_cast<char **>(kwlist), &pyAss)) { return nullptr; }
-         Gringo::Control::Assumptions ass;
-         if (!getAssumptions(pyAss, ass)) { return nullptr; }
-+        if (!protect([self, &ass]() { self->ctl->prepareSolve(std::move(ass)); })) { return nullptr; }
-         Gringo::SolveIter *iter;
--        if (!protect([self, &iter, &ass]() { iter = (self->ctl->solveIter(std::move(ass))); })) { return nullptr; }
-+        if (!protect([self, &iter]() {
-+            PyUnblock unblock;
-+            iter = self->ctl->solveIter();
-+        })) { return nullptr; }
-         PyObject *ret = SolveIter::new_(*iter);
-         return ret;
-     }
-@@ -2104,11 +2109,11 @@ struct ControlWrap {
-         Gringo::SolveResult ret;
-         Gringo::Control::Assumptions ass;
-         if (!getAssumptions(pyAss, ass)) { return nullptr; }
--        if (!protect([self, mh, &ret, &ass]() {
-+        if (!protect([self, &ass]() { self->ctl->prepareSolve(std::move(ass)); })) { return nullptr; }
-+        if (!protect([self, mh, &ret]() {
-             PyUnblock unblock;
-             ret = (self->ctl->solve(
--                mh == Py_None ? Control::ModelHandler(nullptr) : [mh](Gringo::Model const &m) { PyBlock block; return on_model(m, Object(mh, true)); },
--                std::move(ass)
-+                mh == Py_None ? Control::ModelHandler(nullptr) : [mh](Gringo::Model const &m) { PyBlock block; return on_model(m, Object(mh, true)); }
-             ));
-         })) { return nullptr; }
-         return SolveResult::get(ret);
-Index: gringo-git-gbp/app/example/main.cc
-===================================================================
---- gringo-git-gbp.orig/app/example/main.cc
-+++ gringo-git-gbp/app/example/main.cc
+---
+ app/example/main.cc               |  6 +++--
+ app/gringo/main.cc                | 11 ++++++---
+ libclingo/clingo/clingocontrol.hh | 11 ++++++---
+ libclingo/src/clingocontrol.cc    | 52 +++++++++++++++++++++++----------------
+ libgringo/gringo/control.hh       |  7 +++---
+ libgringo/src/lua.cc              | 11 ++++++---
+ libgringo/src/python.cc           | 19 ++++++++------
+ 7 files changed, 72 insertions(+), 45 deletions(-)
+
+diff --git a/app/example/main.cc b/app/example/main.cc
+index 3de2457..5aa08ee 100644
+--- a/app/example/main.cc
++++ b/app/example/main.cc
 @@ -24,16 +24,18 @@
  void example1() { 
      std::vector<char const *> args{"clingo", "-e", "brave", nullptr};
@@ -151,11 +39,11 @@ Index: gringo-git-gbp/app/example/main.cc
  }
  
  int main() {
-Index: gringo-git-gbp/app/gringo/main.cc
-===================================================================
---- gringo-git-gbp.orig/app/gringo/main.cc
-+++ gringo-git-gbp/app/gringo/main.cc
-@@ -168,8 +168,10 @@ struct IncrementalControl : Gringo::Cont
+diff --git a/app/gringo/main.cc b/app/gringo/main.cc
+index 9b18a33..cad0ac0 100644
+--- a/app/gringo/main.cc
++++ b/app/gringo/main.cc
+@@ -168,8 +168,10 @@ struct IncrementalControl : Gringo::Control, Gringo::GringoModule {
      }
      virtual void onModel(Gringo::Model const &) { }
      virtual bool blocked() { return false; }
@@ -167,7 +55,7 @@ Index: gringo-git-gbp/app/gringo/main.cc
          if (!grounded) {
              if (incremental) { out.incremental(); }
          }
-@@ -177,10 +179,10 @@ struct IncrementalControl : Gringo::Cont
+@@ -177,10 +179,10 @@ struct IncrementalControl : Gringo::Control, Gringo::GringoModule {
          out.finish();
          return Gringo::SolveResult::UNKNOWN;
      }
@@ -190,10 +78,53 @@ Index: gringo-git-gbp/app/gringo/main.cc
          }
      }
  
-Index: gringo-git-gbp/libclingo/src/clingocontrol.cc
-===================================================================
---- gringo-git-gbp.orig/libclingo/src/clingocontrol.cc
-+++ gringo-git-gbp/libclingo/src/clingocontrol.cc
+diff --git a/libclingo/clingo/clingocontrol.hh b/libclingo/clingo/clingocontrol.hh
+index 43249f2..2d359a9 100644
+--- a/libclingo/clingo/clingocontrol.hh
++++ b/libclingo/clingo/clingocontrol.hh
+@@ -230,7 +230,8 @@ public:
+     void onFinish(Clasp::ClaspFacade::Result ret);
+     bool update();
+ 
+-    Clasp::LitVec toClaspAssumptions(Gringo::Control::Assumptions &&ass) const;
++    Clasp::LitVec toClaspAssumptions(std::vector<int> &&ass) const;
++    std::vector<int> toLparseAssumptions(Gringo::Control::Assumptions &&ass) const;
+     
+     // {{{2 DomainProxy interface
+ 
+@@ -257,7 +258,8 @@ public:
+     virtual void ground(Gringo::Control::GroundVec const &vec, Gringo::Any &&context);
+     virtual void add(std::string const &name, Gringo::FWStringVec const &params, std::string const &part);
+     virtual void load(std::string const &filename);
+-    virtual Gringo::SolveResult solve(ModelHandler h, Assumptions &&ass);
++    virtual void prepareSolve(Assumptions &&ass);
++    virtual Gringo::SolveResult solve(ModelHandler h);
+     virtual bool blocked();
+     virtual std::string str();
+     virtual void assignExternal(Gringo::Value ext, Gringo::TruthValue);
+@@ -267,8 +269,8 @@ public:
+     virtual void useEnumAssumption(bool enable);
+     virtual bool useEnumAssumption();
+     virtual void cleanupDomains();
+-    virtual Gringo::SolveIter *solveIter(Assumptions &&ass);
+-    virtual Gringo::SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh, Assumptions &&ass);
++    virtual Gringo::SolveIter *solveIter();
++    virtual Gringo::SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh);
+ 
+     // }}}2
+ 
+@@ -286,6 +288,7 @@ public:
+     Clasp::Cli::ClaspCliConfig                             &claspConfig_;
+     PostGroundFunc                                          pgf_;
+     PreSolveFunc                                            psf_;
++    std::vector<int>                                        ass_;
+ #if WITH_THREADS
+     std::unique_ptr<ClingoSolveFuture> solveFuture_;
+     std::unique_ptr<ClingoSolveIter>   solveIter_;
+diff --git a/libclingo/src/clingocontrol.cc b/libclingo/src/clingocontrol.cc
+index 364d60d..7202a43 100644
+--- a/libclingo/src/clingocontrol.cc
++++ b/libclingo/src/clingocontrol.cc
 @@ -203,7 +203,8 @@ void ClingoControl::main() {
          Gringo::Control::GroundVec parts;
          parts.emplace_back("base", Gringo::FWValVec{});
@@ -256,7 +187,7 @@ Index: gringo-git-gbp/libclingo/src/clingocontrol.cc
      if (clingoMode_) {
  #if WITH_THREADS
          solveIter_    = nullptr;
-@@ -331,35 +331,45 @@ void ClingoControl::prepare_(Gringo::Con
+@@ -331,35 +331,45 @@ void ClingoControl::prepare_(Gringo::Control::ModelHandler mh, Gringo::Control::
          if (pgf_) { pgf_(*prg); }
          clasp->prepare(enableEnumAssupmption_ ? Clasp::ClaspFacade::enum_volatile : Clasp::ClaspFacade::enum_static);
          if (psf_) {  psf_(*clasp);}
@@ -311,46 +242,128 @@ Index: gringo-git-gbp/libclingo/src/clingocontrol.cc
      prepare_(nullptr, nullptr);
      if (clingoMode_) {
          Clasp::Asp::LogicProgram &prg = static_cast<Clasp::Asp::LogicProgram&>(*clasp->program());
-Index: gringo-git-gbp/libclingo/clingo/clingocontrol.hh
-===================================================================
---- gringo-git-gbp.orig/libclingo/clingo/clingocontrol.hh
-+++ gringo-git-gbp/libclingo/clingo/clingocontrol.hh
-@@ -230,7 +230,8 @@ public:
-     void onFinish(Clasp::ClaspFacade::Result ret);
-     bool update();
- 
--    Clasp::LitVec toClaspAssumptions(Gringo::Control::Assumptions &&ass) const;
-+    Clasp::LitVec toClaspAssumptions(std::vector<int> &&ass) const;
-+    std::vector<int> toLparseAssumptions(Gringo::Control::Assumptions &&ass) const;
-     
-     // {{{2 DomainProxy interface
- 
-@@ -257,7 +258,8 @@ public:
-     virtual void ground(Gringo::Control::GroundVec const &vec, Gringo::Any &&context);
-     virtual void add(std::string const &name, Gringo::FWStringVec const &params, std::string const &part);
-     virtual void load(std::string const &filename);
--    virtual Gringo::SolveResult solve(ModelHandler h, Assumptions &&ass);
-+    virtual void prepareSolve(Assumptions &&ass);
-+    virtual Gringo::SolveResult solve(ModelHandler h);
-     virtual bool blocked();
-     virtual std::string str();
-     virtual void assignExternal(Gringo::Value ext, Gringo::TruthValue);
-@@ -267,8 +269,8 @@ public:
-     virtual void useEnumAssumption(bool enable);
-     virtual bool useEnumAssumption();
-     virtual void cleanupDomains();
--    virtual Gringo::SolveIter *solveIter(Assumptions &&ass);
--    virtual Gringo::SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh, Assumptions &&ass);
-+    virtual Gringo::SolveIter *solveIter();
-+    virtual Gringo::SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh);
- 
-     // }}}2
+diff --git a/libgringo/gringo/control.hh b/libgringo/gringo/control.hh
+index 6a2c261..cde9a48 100644
+--- a/libgringo/gringo/control.hh
++++ b/libgringo/gringo/control.hh
+@@ -173,9 +173,10 @@ struct Control {
+     virtual DomainProxy &getDomain() = 0;
  
-@@ -286,6 +288,7 @@ public:
-     Clasp::Cli::ClaspCliConfig                             &claspConfig_;
-     PostGroundFunc                                          pgf_;
-     PreSolveFunc                                            psf_;
-+    std::vector<int>                                        ass_;
- #if WITH_THREADS
-     std::unique_ptr<ClingoSolveFuture> solveFuture_;
-     std::unique_ptr<ClingoSolveIter>   solveIter_;
+     virtual void ground(GroundVec const &vec, Any &&context) = 0;
+-    virtual SolveResult solve(ModelHandler h, Assumptions &&assumptions) = 0;
+-    virtual SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh, Assumptions &&assumptions) = 0;
+-    virtual SolveIter *solveIter(Assumptions &&assumptions) = 0;
++    virtual void prepareSolve(Assumptions &&assumptions) = 0;
++    virtual SolveResult solve(ModelHandler h) = 0;
++    virtual SolveFuture *solveAsync(ModelHandler mh, FinishHandler fh) = 0;
++    virtual SolveIter *solveIter() = 0;
+     virtual void add(std::string const &name, FWStringVec const &params, std::string const &part) = 0;
+     virtual void load(std::string const &filename) = 0;
+     virtual Value getConst(std::string const &name) = 0;
+diff --git a/libgringo/src/lua.cc b/libgringo/src/lua.cc
+index 510d4c2..50c31f3 100644
+--- a/libgringo/src/lua.cc
++++ b/libgringo/src/lua.cc
+@@ -1046,6 +1046,7 @@ struct ControlWrap {
+             mIndex = lua_gettop(L);
+         }
+         Control::Assumptions *ass = getAssumptions(L, assIdx);
++        protect<void>(L, [&ctl, ass]() { ctl.prepareSolve(std::move(*ass)); });
+         lua_pushinteger(L, protect<int>(L, [L, &ctl, model, ass, mhIndex, mIndex]() {
+             return (int)ctl.solve(!model ? Control::ModelHandler(nullptr) : [L, model, mhIndex, mIndex](Gringo::Model const &m) -> bool {
+                 LuaClear lc(L);
+@@ -1057,7 +1058,7 @@ struct ControlWrap {
+                 Location loc("<on_model>", 1, 1, "<on_model>", 1, 1);
+                 handleError(L, loc, code, "error in model callback");
+                 return lua_type(L, -1) == LUA_TNIL || lua_toboolean(L, -1);
+-            }, std::move(*ass));
++            });
+         }));
+         return 1;
+     }
+@@ -1075,6 +1076,7 @@ struct ControlWrap {
+         int mhIndex = !lua_isnone(L, 3) && !lua_isnil(L, 3) ? 3 : 0;
+         int fhIndex = !lua_isnone(L, 4) && !lua_isnil(L, 4) ? 4 : 0;
+         Control::Assumptions *ass = getAssumptions(L, assIdx);
++        protect<void>(L, [&ctl, ass]() { ctl.prepareSolve(std::move(*ass)); });
+         auto &future = *(Gringo::SolveFuture **)lua_newuserdata(L, sizeof(Gringo::SolveFuture*));
+         lua_State *M = nullptr;
+         if (mhIndex || fhIndex) {
+@@ -1097,7 +1099,7 @@ struct ControlWrap {
+             lua_xmove(L, M, 1);
+             fhIndex = lua_gettop(M);
+         }
+-        future = protect<Gringo::SolveFuture*>(L, [&ctl, model, mhIndex, fhIndex, ass, M]() {
++        future = protect<Gringo::SolveFuture*>(L, [&ctl, model, mhIndex, fhIndex, M]() {
+             auto mh = !mhIndex ? Control::ModelHandler(nullptr) : [M, mhIndex, model](Gringo::Model const &m) -> bool {
+                 LuaClear lc(M);
+                 lua_pushcfunction(M, luaTraceback);
+@@ -1119,7 +1121,7 @@ struct ControlWrap {
+                 Location loc("<on_finish>", 1, 1, "<on_finish>", 1, 1);
+                 handleError(M, loc, code, "error in model callback");
+             };
+-            return ctl.solveAsync(mh, fh, std::move(*ass));
++            return ctl.solveAsync(mh, fh);
+         });
+         luaL_getmetatable(L, "gringo.SolveFuture");
+         lua_setmetatable(L, -2);
+@@ -1131,8 +1133,9 @@ struct ControlWrap {
+         lua_unsetuservaluefield(L, 1, "stats");
+         int assIdx  = !lua_isnone(L, 2) && !lua_isnil(L, 2) ? 2 : 0;
+         Control::Assumptions *ass = getAssumptions(L, assIdx);
++        protect<void>(L, [&ctl, ass]() { ctl.prepareSolve(std::move(*ass)); });
+         auto &iter = *(Gringo::SolveIter **)lua_newuserdata(L, sizeof(Gringo::SolveIter*));
+-        iter = protect<Gringo::SolveIter*>(L, [&ctl, ass]() { return ctl.solveIter(std::move(*ass)); });
++        iter = protect<Gringo::SolveIter*>(L, [&ctl]() { return ctl.solveIter(); });
+         luaL_getmetatable(L, "gringo.SolveIter");
+         lua_setmetatable(L, -2);
+         return 1;
+diff --git a/libgringo/src/python.cc b/libgringo/src/python.cc
+index 874287d..20ca24e 100644
+--- a/libgringo/src/python.cc
++++ b/libgringo/src/python.cc
+@@ -2069,11 +2069,12 @@ struct ControlWrap {
+         Gringo::SolveFuture *future;
+         Object omh(mh, true);
+         Object ofh(fh, true);
+-        if (!protect([self, omh, ofh, &future, &ass]() {
++        if (!protect([self, &ass]() { self->ctl->prepareSolve(std::move(ass)); })) { return nullptr; }
++        if (!protect([self, omh, ofh, &future]() {
++            PyUnblock unblock;
+             future = (self->ctl->solveAsync(
+                 omh == Py_None ? Control::ModelHandler(nullptr) : [omh](Gringo::Model const &m) -> bool { PyBlock b; (void)b; return on_model(m, omh); },
+-                ofh == Py_None ? Control::FinishHandler(nullptr) : [ofh](Gringo::SolveResult ret, bool canceled) -> void { PyBlock b; (void)b; on_finish(ret, canceled, ofh); },
+-                std::move(ass)
++                ofh == Py_None ? Control::FinishHandler(nullptr) : [ofh](Gringo::SolveResult ret, bool canceled) -> void { PyBlock b; (void)b; on_finish(ret, canceled, ofh); }
+             ));
+         })) { return nullptr; }
+         PyObject *ret = SolveFuture::new_(*future);
+@@ -2088,8 +2089,12 @@ struct ControlWrap {
+         if (!PyArg_ParseTupleAndKeywords(args, kwds, "|O", const_cast<char **>(kwlist), &pyAss)) { return nullptr; }
+         Gringo::Control::Assumptions ass;
+         if (!getAssumptions(pyAss, ass)) { return nullptr; }
++        if (!protect([self, &ass]() { self->ctl->prepareSolve(std::move(ass)); })) { return nullptr; }
+         Gringo::SolveIter *iter;
+-        if (!protect([self, &iter, &ass]() { iter = (self->ctl->solveIter(std::move(ass))); })) { return nullptr; }
++        if (!protect([self, &iter]() {
++            PyUnblock unblock;
++            iter = self->ctl->solveIter();
++        })) { return nullptr; }
+         PyObject *ret = SolveIter::new_(*iter);
+         return ret;
+     }
+@@ -2104,11 +2109,11 @@ struct ControlWrap {
+         Gringo::SolveResult ret;
+         Gringo::Control::Assumptions ass;
+         if (!getAssumptions(pyAss, ass)) { return nullptr; }
+-        if (!protect([self, mh, &ret, &ass]() {
++        if (!protect([self, &ass]() { self->ctl->prepareSolve(std::move(ass)); })) { return nullptr; }
++        if (!protect([self, mh, &ret]() {
+             PyUnblock unblock;
+             ret = (self->ctl->solve(
+-                mh == Py_None ? Control::ModelHandler(nullptr) : [mh](Gringo::Model const &m) { PyBlock block; return on_model(m, Object(mh, true)); },
+-                std::move(ass)
++                mh == Py_None ? Control::ModelHandler(nullptr) : [mh](Gringo::Model const &m) { PyBlock block; return on_model(m, Object(mh, true)); }
+             ));
+         })) { return nullptr; }
+         return SolveResult::get(ret);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/gringo.git



More information about the debian-science-commits mailing list