python: Make GlobalExitEvent.getCode() return an int
python: Make GlobalExitEvent.getCode() return an int

PyBind normally casts integers returned from the C to long in
Python. This is normally fine since long in most cases behaves just
like an int. However, when passing the return value from getcode() to
sys.exit, unexpected behavior ensues. Due to the way the function is
defined, any type other than int (with the exception of None) will be
treated as an error and be equivalent to sys.exit(1).

Since we frequently use the sys.exit(event.getCode()) pattern, we need
to ensure that the function returns an integer. This change adds an
explicit type conversion to a Python integer in the wrapper code.

Change-Id: I73d6b881025064afa2b2e6eb4512fa2a4b0a87da
Signed-off-by: Andreas Sandberg <c9f5686ee5bd561c93f9de79681eee75bfa7f36e@arm.com>
Reviewed-by: Jose Marinho <4d9107ceae1626e50fad23cf6000b2548751bb2a@arm.com>
Reviewed-by: Curtis Dunham <14490907fdc9c150c92157b82121c81003bbdc71@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/4280
Reviewed-by: Jason Lowe-Power <68c46a606457643eab92053c1c05574abb26f861@lowepower.com>
Reviewed-by: Joe Gross <15c33eed775d43fab32b86e60cf53409dcf8e1dc@amd.com>

gem5/gem5,sobercoder/gem5,TUD-OS/gem5-dtu,sobercoder/gem5,gem5/gem5,sobercoder/gem5,gem5/gem5,TUD-OS/gem5-dtu,TUD-OS/gem5-dtu,sobercoder/gem5,gem5/gem5,TUD-OS/gem5-dtu,gem5/gem5,TUD-OS/gem5-dtu,TUD-OS/gem5-dtu,TUD-OS/gem5-dtu,sobercoder/gem5,sobercoder/gem5,sobercoder/gem5,gem5/gem5,gem5/gem5