Andreas Sandberg has submitted this change and it was merged. ( https://gem5-review.googlesource.com/c/public/gem5/+/15988 )

Change subject: python: Add Python 3 workarounds for long
......................................................................

python: Add Python 3 workarounds for long

Python 3 doesn't have a separate long type. Make long an alias for int
where needed to maintain compatibility.

Change-Id: I4c0861302bc3a2fa5226b3041803ef975d29b2fd
Signed-off-by: Andreas Sandberg <[email protected]>
Reviewed-on: https://gem5-review.googlesource.com/c/15988
Reviewed-by: Nikos Nikoleris <[email protected]>
---
M src/python/m5/SimObject.py
M src/python/m5/params.py
M src/python/m5/proxy.py
M src/python/m5/ticks.py
M src/python/m5/util/convert.py
M src/python/m5/util/fdthelper.py
M src/python/m5/util/smartdict.py
7 files changed, 23 insertions(+), 0 deletions(-)

Approvals:
  Nikos Nikoleris: Looks good to me, approved
  Andreas Sandberg: Looks good to me, approved



diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 5a86912..7f19c07 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -45,6 +45,9 @@

 from __future__ import print_function
 from __future__ import absolute_import
+import six
+if six.PY3:
+    long = int

 import sys
 from types import FunctionType, MethodType, ModuleType
diff --git a/src/python/m5/params.py b/src/python/m5/params.py
index 757a4f2..ff625e0 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -60,6 +60,9 @@
 #####################################################################

 from __future__ import print_function
+import six
+if six.PY3:
+    long = int

 import copy
 import datetime
diff --git a/src/python/m5/proxy.py b/src/python/m5/proxy.py
index b939bc0..5128156 100644
--- a/src/python/m5/proxy.py
+++ b/src/python/m5/proxy.py
@@ -47,6 +47,9 @@

 from __future__ import print_function
 from __future__ import absolute_import
+import six
+if six.PY3:
+    long = int

 import copy

diff --git a/src/python/m5/ticks.py b/src/python/m5/ticks.py
index 22a5738..7a740a8 100644
--- a/src/python/m5/ticks.py
+++ b/src/python/m5/ticks.py
@@ -27,6 +27,9 @@
 # Authors: Nathan Binkert

 from __future__ import print_function
+import six
+if six.PY3:
+    long = int

 import sys
 from m5.util import warn
diff --git a/src/python/m5/util/convert.py b/src/python/m5/util/convert.py
index acd1a24..76ac509 100644
--- a/src/python/m5/util/convert.py
+++ b/src/python/m5/util/convert.py
@@ -28,6 +28,10 @@
 # Authors: Nathan Binkert
 #          Gabe Black

+import six
+if six.PY3:
+    long = int
+
 # metric prefixes
 atto  = 1.0e-18
 femto = 1.0e-15
diff --git a/src/python/m5/util/fdthelper.py b/src/python/m5/util/fdthelper.py
index bd04b41..c876050 100644
--- a/src/python/m5/util/fdthelper.py
+++ b/src/python/m5/util/fdthelper.py
@@ -35,6 +35,10 @@
 #
 # Author: Glenn Bergmans

+import six
+if six.PY3:
+    long = int
+
 from m5.ext.pyfdt import pyfdt
 import re
 import os
diff --git a/src/python/m5/util/smartdict.py b/src/python/m5/util/smartdict.py
index 3cfe329..dabc3f8 100644
--- a/src/python/m5/util/smartdict.py
+++ b/src/python/m5/util/smartdict.py
@@ -43,6 +43,9 @@

 from __future__ import print_function
 from __future__ import absolute_import
+import six
+if six.PY3:
+    long = int

 from .convert import *
 from .attrdict import attrdict

--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/15988
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: master
Gerrit-Change-Id: I4c0861302bc3a2fa5226b3041803ef975d29b2fd
Gerrit-Change-Number: 15988
Gerrit-PatchSet: 9
Gerrit-Owner: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Andreas Sandberg <[email protected]>
Gerrit-Reviewer: Nikos Nikoleris <[email protected]>
Gerrit-CC: Gabe Black <[email protected]>
Gerrit-CC: Giacomo Travaglini <[email protected]>
Gerrit-CC: Jason Lowe-Power <[email protected]>
Gerrit-CC: Juha Jäykkä <[email protected]>
Gerrit-MessageType: merged
_______________________________________________
gem5-dev mailing list
[email protected]
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to