Andreas Sandberg has submitted this change. ( https://gem5-review.googlesource.com/c/public/gem5/+/50407 )

Change subject: python: Remove unnecessary Python 2.x workaround
......................................................................

python: Remove unnecessary Python 2.x workaround

We needed to explicitly cast the return value from getCode() to int to
avoid a Python 2.x issue where sys.exit() got confused by an
unexpected long argument. This isn't an issue in Python 3 since long
has been removed as a separate type.

Change-Id: I7770d0f180e826ac7e6c92c13bc6a61447e3f851
Signed-off-by: Andreas Sandberg <andreas.sandb...@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/50407
Reviewed-by: Jason Lowe-Power <power...@gmail.com>
Maintainer: Jason Lowe-Power <power...@gmail.com>
Tested-by: kokoro <noreply+kok...@google.com>
---
M src/python/pybind11/event.cc
1 file changed, 0 insertions(+), 11 deletions(-)

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




diff --git a/src/python/pybind11/event.cc b/src/python/pybind11/event.cc
index 794b6e3..aefe50a 100644
--- a/src/python/pybind11/event.cc
+++ b/src/python/pybind11/event.cc
@@ -134,18 +134,7 @@
                std::unique_ptr<GlobalSimLoopExitEvent, py::nodelete>>(
                m, "GlobalSimLoopExitEvent")
         .def("getCause", &GlobalSimLoopExitEvent::getCause)
-#if PY_MAJOR_VERSION >= 3
         .def("getCode", &GlobalSimLoopExitEvent::getCode)
-#else
-        // Workaround for an issue where PyBind11 converts the exit
-        // code to a long. This is normally fine, but sys.exit treats
-        // any non-int type as an error and exits with status 1 if it
-        // is passed a long.
-        .def("getCode", [](GlobalSimLoopExitEvent *e) {
-                return py::reinterpret_steal<py::object>(
-                    PyInt_FromLong(e->getCode()));
-            })
-#endif
         ;

     // Event base class. These should never be returned directly to

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

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I7770d0f180e826ac7e6c92c13bc6a61447e3f851
Gerrit-Change-Number: 50407
Gerrit-PatchSet: 2
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-Reviewer: Andreas Sandberg <andreas.sandb...@arm.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