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

Change subject: base-stats,python: Update PyBind11 ScalarInfo fields to readonly
......................................................................

base-stats,python: Update PyBind11 ScalarInfo fields to readonly

This change keeps the ScalarInfo class consistent with the other Info
classes exposed via PyBind11.

Change-Id: I4d420d509e4654de844e75f58aeaaf67109775d3
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/41693
Reviewed-by: Jason Lowe-Power <[email protected]>
Maintainer: Jason Lowe-Power <[email protected]>
Tested-by: kokoro <[email protected]>
---
M src/python/pybind11/stats.cc
1 file changed, 9 insertions(+), 3 deletions(-)

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



diff --git a/src/python/pybind11/stats.cc b/src/python/pybind11/stats.cc
index e6912e2..1e6773f 100644
--- a/src/python/pybind11/stats.cc
+++ b/src/python/pybind11/stats.cc
@@ -149,9 +149,15 @@
     py::class_<Stats::ScalarInfo, Stats::Info,
                std::unique_ptr<Stats::ScalarInfo, py::nodelete>>(
                    m, "ScalarInfo")
-        .def("value", &Stats::ScalarInfo::value)
-        .def("result", &Stats::ScalarInfo::result)
-        .def("total", &Stats::ScalarInfo::total)
+        .def_property_readonly("value", [](const Stats::ScalarInfo &info) {
+                return info.value();
+            })
+ .def_property_readonly("result", [](const Stats::ScalarInfo &info) {
+                return info.result();
+            })
+        .def_property_readonly("total", [](const Stats::ScalarInfo &info) {
+                return info.total();
+            })
         ;

     py::class_<Stats::VectorInfo, Stats::Info,

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/41693
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: I4d420d509e4654de844e75f58aeaaf67109775d3
Gerrit-Change-Number: 41693
Gerrit-PatchSet: 2
Gerrit-Owner: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Bobby R. Bruce <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: Jason Lowe-Power <[email protected]>
Gerrit-Reviewer: kokoro <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
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