aboutsummaryrefslogtreecommitdiff
path: root/python/gats.py
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2012-05-29 16:42:39 +0000
committerMike Buland <eichlan@xagasoft.com>2012-05-29 16:42:39 +0000
commit3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc (patch)
tree94ef8fa114a86b61e5182ef051e30476aca020a6 /python/gats.py
parent6b940f4404ef9b357fd725b7aa7fb24c96680abd (diff)
downloadlibgats-3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc.tar.gz
libgats-3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc.tar.bz2
libgats-3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc.tar.xz
libgats-3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc.zip
Apparently in python bools are ints, but ints aren't bools...this means that
you have to test for bool before int or bools are converted to ints. This is fixed now, bools transfer correctly.
Diffstat (limited to 'python/gats.py')
-rw-r--r--python/gats.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/python/gats.py b/python/gats.py
index 760314a..40139a2 100644
--- a/python/gats.py
+++ b/python/gats.py
@@ -153,7 +153,12 @@ def _readObj( sIn ):
153 return 'not implemented yet'; 153 return 'not implemented yet';
154 154
155def _writeObj( obj, sOut ): 155def _writeObj( obj, sOut ):
156 if isinstance( obj, int ): 156 if isinstance( obj, bool ):
157 if obj == True:
158 sOut.write('1')
159 else:
160 sOut.write('0')
161 elif isinstance( obj, int ):
157 sOut.write('i') 162 sOut.write('i')
158 _writePackedInt( obj, sOut ) 163 _writePackedInt( obj, sOut )
159 elif isinstance( obj, str ): 164 elif isinstance( obj, str ):
@@ -171,11 +176,6 @@ def _writeObj( obj, sOut ):
171 _writeObj( key, sOut ) 176 _writeObj( key, sOut )
172 _writeObj( obj[key], sOut ) 177 _writeObj( obj[key], sOut )
173 sOut.write('e') 178 sOut.write('e')
174 elif isinstance( obj, bool ):
175 if obj == True:
176 sOut.write('1')
177 else:
178 sOut.write('0')
179 elif isinstance( obj, float ): 179 elif isinstance( obj, float ):
180 if math.isnan( obj ): 180 if math.isnan( obj ):
181 if math.copysign( 1.0, obj ) < 0.0: 181 if math.copysign( 1.0, obj ) < 0.0: