Andreas Sandberg has uploaded this change for review. ( 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 <andreas.sandb...@arm.com>
---
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(+), 2 deletions(-)



diff --git a/src/python/m5/SimObject.py b/src/python/m5/SimObject.py
index 722b665..099927f 100644
--- a/src/python/m5/SimObject.py
+++ b/src/python/m5/SimObject.py
@@ -45,8 +45,10 @@

 from __future__ import print_function
 from __future__ import absolute_import
-
 from six import add_metaclass
+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 742fb6b..d6641bd 100644
--- a/src/python/m5/params.py
+++ b/src/python/m5/params.py
@@ -60,8 +60,10 @@
 #####################################################################

 from __future__ import print_function
-
 from six import add_metaclass
+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 346ed92..b7a509b 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 7b9cb38..601211e 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 0e058a6..e17011a 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: 1
Gerrit-Owner: Andreas Sandberg <andreas.sandb...@arm.com>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list
gem5-dev@gem5.org
http://m5sim.org/mailman/listinfo/gem5-dev

Reply via email to