From 2dc6fc97e96995bbb16f5f2237c3b5c11de82dc4 Mon Sep 17 00:00:00 2001 From: Nikos Nikoleris Date: Mon, 24 Feb 2020 19:00:09 +0200 Subject: [PATCH] python: Remove unnecessary exports from pybind enums According to pybind documentation [1], enum entries use .export_values() to export the enum entries into the parent scope. However, strongly typed C++11 class enums are in their own scope and therefore do not need to be exported. [1]: https://pybind11.readthedocs.io/en/stable/classes.html#enume rations-and-internal-types Change-Id: I6181306b530d59eaedcb3daf9cab0a03d01d56f4 Signed-off-by: Nikos Nikoleris Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25709 Reviewed-by: Jason Lowe-Power Maintainer: Gabe Black Tested-by: kokoro --- src/python/m5/params.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/python/m5/params.py b/src/python/m5/params.py index 6033096fa..3593f95bb 100644 --- a/src/python/m5/params.py +++ b/src/python/m5/params.py @@ -1433,7 +1433,8 @@ module_init(py::module &m_internal) for val in cls.vals: code('.value("${val}", ${wrapper_name}::${val})') code('.value("Num_${name}", ${wrapper_name}::Num_${enum_name})') - code('.export_values()') + if not cls.is_class: + code('.export_values()') code(';') code.dedent() -- 2.30.2