From: Nikos Nikoleris Date: Mon, 24 Feb 2020 17:00:09 +0000 (+0200) Subject: python: Remove unnecessary exports from pybind enums X-Git-Tag: v20.0.0.0~447 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2dc6fc97e96995bbb16f5f2237c3b5c11de82dc4;p=gem5.git 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 --- 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()