Bobby Bruce has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/54307 )

Change subject: ext: Stop using the uninitialized pythonMain in sst.
......................................................................

ext: Stop using the uninitialized pythonMain in sst.

Import the __main__ module when it's first used.

Change-Id: If800bd575398970faa8cb88072becd3d2b4218c0
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/54307
Maintainer: Gabe Black <gabe.bl...@gmail.com>
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M ext/sst/gem5.cc
M ext/sst/gem5.hh
2 files changed, 17 insertions(+), 2 deletions(-)

Approvals:
  Jason Lowe-Power: Looks good to me, approved
  Gabe Black: Looks good to me, approved
  kokoro: Regressions pass




diff --git a/ext/sst/gem5.cc b/ext/sst/gem5.cc
index 1d90bc5..286f519 100644
--- a/ext/sst/gem5.cc
+++ b/ext/sst/gem5.cc
@@ -355,7 +355,8 @@
 int
 gem5Component::execPythonCommands(const std::vector<std::string>& commands)
 {
-    PyObject *dict = PyModule_GetDict(pythonMain);
+    static PyObject *dict =
+        py::module_::import("__main__").attr("__dict__").ptr();

     PyObject *result;

diff --git a/ext/sst/gem5.hh b/ext/sst/gem5.hh
index 2712411..447c68c 100644
--- a/ext/sst/gem5.hh
+++ b/ext/sst/gem5.hh
@@ -104,7 +104,6 @@

   // stuff needed for gem5 sim
   public:
-    PyObject *pythonMain;
     int execPythonCommands(const std::vector<std::string>& commands);

   private:

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/54307
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: release-staging-v21-2
Gerrit-Change-Id: If800bd575398970faa8cb88072becd3d2b4218c0
Gerrit-Change-Number: 54307
Gerrit-PatchSet: 2
Gerrit-Owner: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Bobby Bruce <bbr...@ucdavis.edu>
Gerrit-Reviewer: Gabe Black <gabe.bl...@gmail.com>
Gerrit-Reviewer: Giacomo Travaglini <giacomo.travagl...@arm.com>
Gerrit-Reviewer: Hoa Nguyen <hoanguyen.yds....@gmail.com>
Gerrit-Reviewer: Jason Lowe-Power <ja...@lowepower.com>
Gerrit-Reviewer: Jason Lowe-Power <power...@gmail.com>
Gerrit-Reviewer: kokoro <noreply+kok...@google.com>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to