Andreas Sandberg has uploaded this change for review. ( 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 <[email protected]>
---
M src/python/pybind11/event.cc
1 file changed, 0 insertions(+), 11 deletions(-)



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: 1
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to