@@ -981,7 +981,7 @@ public static void runMain(Class mainClass, String[] args,
981981 "$py" );
982982 System .exit (-1 );
983983 }
984- PyObject mod = imp .createFromCode ("__main__" , code );
984+ imp .createFromCode ("__main__" , code );
985985 } catch (PyException e ) {
986986 Py .getSystemState ().callExitFunc ();
987987 if (Py .matchException (e , Py .SystemExit ))
@@ -1093,7 +1093,7 @@ public static void displayException(PyObject type, PyObject value,
10931093
10941094 if (tb instanceof PyTraceback )
10951095 stderr .print (((PyTraceback ) tb ).dumpStack ());
1096- if (__builtin__ .isinstance (value , ( PyClass ) Py .SyntaxError )) {
1096+ if (__builtin__ .isinstance (value , Py .SyntaxError )) {
10971097 stderr .println (" File \" " +value .__findattr__ ("filename" )+
10981098 "\" , line " +value .__findattr__ ("lineno" ));
10991099 PyObject text = value .__findattr__ ("text" );
@@ -1120,15 +1120,14 @@ public static void displayException(PyObject type, PyObject value,
11201120 static String formatException (PyObject type , PyObject value , PyObject tb ) {
11211121 StringBuffer buf = new StringBuffer ();
11221122
1123- PyObject typeName ;
11241123 if (type instanceof PyClass ) {
11251124 buf .append (((PyClass ) type ).__name__ );
11261125 } else {
11271126 buf .append (type .__str__ ());
11281127 }
11291128 if (value != Py .None ) {
11301129 buf .append (": " );
1131- if (__builtin__ .isinstance (value , ( PyClass ) Py .SyntaxError )) {
1130+ if (__builtin__ .isinstance (value , Py .SyntaxError )) {
11321131 buf .append (value .__getitem__ (0 ).__str__ ());
11331132 } else {
11341133 buf .append (value .__str__ ());
@@ -1197,7 +1196,7 @@ public static boolean matchException(PyException pye, PyObject e) {
11971196 }
11981197 }
11991198 if (e instanceof PyClass ) {
1200- return __builtin__ .isinstance (pye .value , ( PyClass ) e );
1199+ return __builtin__ .isinstance (pye .value , e );
12011200 } else {
12021201 if (e == pye .type )
12031202 return true ;
@@ -1286,7 +1285,7 @@ public static PyObject runCode(PyCode code, PyObject locals,
12861285 tc = (PyTableCode )code ;
12871286
12881287 f = new PyFrame (tc , locals , globals ,
1289- Py . getThreadState (). systemState .builtins );
1288+ PySystemState .builtins );
12901289 return code .call (f );
12911290 }
12921291
@@ -1459,7 +1458,7 @@ public static int py2int(PyObject o) {
14591458
14601459 public static int py2int (PyObject o , String msg ) {
14611460 if (o instanceof PyInteger )
1462- return (int )( (PyInteger )o ).getValue ();
1461+ return ((PyInteger )o ).getValue ();
14631462 Object obj = o .__tojava__ (Integer .TYPE );
14641463 if (obj == Py .NoConversion )
14651464 throw Py .TypeError (msg );
@@ -1468,7 +1467,7 @@ public static int py2int(PyObject o, String msg) {
14681467
14691468 public static long py2long (PyObject o ) {
14701469 if (o instanceof PyInteger )
1471- return (long )( (PyInteger )o ).getValue ();
1470+ return ((PyInteger )o ).getValue ();
14721471
14731472 Object i = o .__tojava__ (Long .TYPE );
14741473 if (i == null || i == Py .NoConversion )
@@ -1480,7 +1479,7 @@ public static float py2float(PyObject o) {
14801479 if (o instanceof PyFloat )
14811480 return (float )((PyFloat )o ).getValue ();
14821481 if (o instanceof PyInteger )
1483- return (float )( (PyInteger )o ).getValue ();
1482+ return ((PyInteger )o ).getValue ();
14841483
14851484 Object i = o .__tojava__ (Float .TYPE );
14861485 if (i == null || i == Py .NoConversion )
@@ -1489,9 +1488,9 @@ public static float py2float(PyObject o) {
14891488 }
14901489 public static double py2double (PyObject o ) {
14911490 if (o instanceof PyFloat )
1492- return (double )( (PyFloat )o ).getValue ();
1491+ return ((PyFloat )o ).getValue ();
14931492 if (o instanceof PyInteger )
1494- return (double )( (PyInteger )o ).getValue ();
1493+ return ((PyInteger )o ).getValue ();
14951494
14961495 Object i = o .__tojava__ (Double .TYPE );
14971496 if (i == null || i == Py .NoConversion )
0 commit comments