Index: trunk/tools/generic_tools.py
===================================================================
--- trunk/tools/generic_tools.py	(revision 2341)
+++ trunk/tools/generic_tools.py	(revision 2342)
@@ -5046,71 +5046,133 @@
     fname='typemod'
 
-    if typeval == 'int' or typeval == 'I':
-        return int(value)
-    elif typeval == 'long':
-        return long(value)
-    elif typeval == 'float' or typeval == 'F' or typeval == 'R':
-        return float(value)
-    elif typeval == 'complex':
-        return complex(value)
-    elif typeval == 'str' or typeval == 'S':
-        return str(value)
-    elif typeval == 'bool':
-        return bool(value)
-    elif typeval == 'B':
-        return Str_Bool(value)
-    elif typeval == 'list':
-        newval = []
-        newval.append(value)
-        return newval
-    elif typeval == 'dic':
-        newval = {}
-        newval[value] = value
-        return newval
-    elif typeval == 'tuple':
-        newv = []
-        newv.append(value)
-        newval = tuple(newv)
-        return newval
-    elif typeval == 'np.int8':
-        return np.int8(value)
-    elif typeval == 'np.int16':
-        return np.int16(value)
-    elif typeval == 'np.int32':
-        return np.int32(value)
-    elif typeval == 'np.int64':
-        return np.int64(value)
-    elif typeval == 'np.uint8':
-        return np.uint8(value)
-    elif typeval == 'np.uint16':
-        return np.uint16(value)
-    elif typeval == 'np.np.uint32':
-        return np.uint32(value)
-    elif typeval == 'np.uint64':
-        return np.uint64(value)
-    elif typeval == 'np.float' or typeval == 'R':
-        return np.float(value)
-    elif typeval == 'np.float16':
-        return np.float16(value)
-    elif typeval == 'np.float32':
-        return np.float32(value)
-    elif typeval == 'float32':
-        return np.float32(value)
-    elif typeval == 'np.float64' or typeval == 'D':
-        return np.float64(value)
-    elif typeval == 'float64':
-        return np.float64(value)
-    elif typeval == 'np.complex':
-        return np.complex(value)
-    elif typeval == 'np.complex64':
-        return np.complex64(value)
-    elif typeval == 'np.complex128':
-        return np.complex128(value)
+    if type(typeval) == type('S'):
+        if typeval == 'int' or typeval == 'I':
+            return int(value)
+        elif typeval == 'long':
+            return long(value)
+        elif typeval == 'float' or typeval == 'F' or typeval == 'R':
+            return float(value)
+        elif typeval == 'complex':
+            return complex(value)
+        elif typeval == 'str' or typeval == 'S':
+            return str(value)
+        elif typeval == 'bool':
+            return bool(value)
+        elif typeval == 'B':
+            return Str_Bool(value)
+        elif typeval == 'list':
+            newval = []
+            newval.append(value)
+            return newval
+        elif typeval == 'dic':
+            newval = {}
+            newval[value] = value
+            return newval
+        elif typeval == 'tuple':
+            newv = []
+            newv.append(value)
+            newval = tuple(newv)
+            return newval
+        elif typeval == 'np.int8':
+            return np.int8(value)
+        elif typeval == 'np.int16':
+            return np.int16(value)
+        elif typeval == 'np.int32':
+            return np.int32(value)
+        elif typeval == 'np.int64':
+            return np.int64(value)
+        elif typeval == 'np.uint8':
+            return np.uint8(value)
+        elif typeval == 'np.uint16':
+            return np.uint16(value)
+        elif typeval == 'np.uint32':
+            return np.uint32(value)
+        elif typeval == 'np.uint64':
+            return np.uint64(value)
+        elif typeval == 'np.float' or typeval == 'R':
+            return np.float(value)
+        elif typeval == 'np.float16':
+            return np.float16(value)
+        elif typeval == 'np.float32':
+            return np.float32(value)
+        elif typeval == 'float32':
+            return np.float32(value)
+        elif typeval == 'np.float64' or typeval == 'D':
+            return np.float64(value)
+        elif typeval == 'np.complex':
+            return np.complex(value)
+        elif typeval == 'np.complex64':
+            return np.complex64(value)
+        elif typeval == 'np.complex128':
+            return np.complex128(value)
+        else:
+            print errormsg
+            print fname + ':  data type "' + typeval + '" is not ready !'
+            print errormsg
+            quit(-1)
     else:
-        print errormsg
-        print fname + ':  data type "' + typeval + '" is not ready !'
-        print errormsg
-        quit(-1)
-
+        if typeval == type(int(1)):
+            return int(value)
+        elif typeval == type(long(1)):
+            return long(value)
+        elif typeval == type(float(1.)):
+            return float(value)
+        elif typeval == type(complex(1)):
+            return complex(value)
+        elif typeval == type('s'):
+            return str(value)
+        elif typeval == type(False):
+            return bool(value)
+        elif typeval == type(list([1])):
+            newval = []
+            newval.append(value)
+            return newval
+        elif typeval == type({1: 'dic'}):
+            newval = {}
+            newval[value] = value
+            return newval
+        elif typeval == type(tuple([1, 2])):
+            newv = []
+            newv.append(value)
+            newval = tuple(newv)
+            return newval
+        elif typeval == type(np.int8(1)):
+            return np.int8(value)
+        elif typeval == type(np.int16(1)):
+            return np.int16(value)
+        elif typeval == type(np.int32(1)):
+            return np.int32(value)
+        elif typeval == type(np.int64(1)):
+            return np.int64(value)
+        elif typeval == type(np.uint8(1)):
+            return np.uint8(value)
+        elif typeval == type(np.uint16(1)):
+            return np.uint16(value)
+        elif typeval == type(np.uint32(1)):
+            return np.uint32(value)
+        elif typeval == type(np.uint64(1)):
+            return np.uint64(value)
+        elif typeval == type(np.float(1.)):
+            return np.float(value)
+        elif typeval == type(np.float16(1.)):
+            return np.float16(value)
+        elif typeval == type(np.float32(1.)):
+            return np.float32(value)
+        elif typeval == type(float32(1.)):
+            return np.float32(value)
+        elif typeval == type(np.float64(1.)):
+            return np.float64(value)
+        elif typeval == type(np.complex(1.)):
+            return np.complex(value)
+        elif typeval == type(np.complex64(1.)):
+            return np.complex64(value)
+        elif typeval == type(np.complex128(1.)):
+            return np.complex128(value)
+        else:
+            print errormsg
+            print fname + ':  data type "' + typeval + '" is not ready !'
+            print errormsg
+            quit(-1)
+    
     return
 
