the big merge
[nepi.git] / src / nepi / resources / ns3 / ns3wrapper.py
index a9a5e12..7172ad1 100644 (file)
@@ -23,6 +23,8 @@ import threading
 import time
 import uuid
 
+from six import integer_types, string_types
+
 SINGLETON = "singleton::"
 SIMULATOR_UUID = "singleton::Simulator"
 CONFIG_UUID = "singleton::Config"
@@ -326,8 +328,8 @@ class NS3Wrapper(object):
             # If the result is an object (not a base value),
             # then keep track of the object a return the object
             # reference (newuuid)
-            if not (result is None or type(result) in [
-                    bool, float, long, str, int]):
+            if result is not None \
+              and not isinstance(result, (bool, float) + integer_types + string_types):
                 self._objects[newuuid] = result
                 result = newuuid
 
@@ -482,7 +484,10 @@ class NS3Wrapper(object):
                 condition.release()
 
         # contextId is defined as general context
-        contextId = long(0xffffffff)
+        # xxx possible distortion when upgrading to python3
+        # really not sure what's the point in this long() business..
+        #contextId = long(0xffffffff)
+        contextId = 0xffffffff
 
         # delay 0 means that the event is expected to execute inmediately
         delay = self.ns3.Seconds(0)