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 <nikos.nikoleris@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/25709
Reviewed-by: Jason Lowe-Power <jason@lowepower.com>
Maintainer: Gabe Black <gabeblack@google.com>
Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
Nikos Nikoleris
2020-02-24 19:00:09 +02:00
parent 522b0c6a20
commit 2dc6fc97e9

View File

@@ -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()