From 3905f9962bbfb312c3804ff9c7b7d1e0fa203cbc Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 29 May 2012 16:42:39 +0000 Subject: 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. --- python/gats.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'python/gats.py') 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 ): return 'not implemented yet'; def _writeObj( obj, sOut ): - if isinstance( obj, int ): + if isinstance( obj, bool ): + if obj == True: + sOut.write('1') + else: + sOut.write('0') + elif isinstance( obj, int ): sOut.write('i') _writePackedInt( obj, sOut ) elif isinstance( obj, str ): @@ -171,11 +176,6 @@ def _writeObj( obj, sOut ): _writeObj( key, sOut ) _writeObj( obj[key], sOut ) sOut.write('e') - elif isinstance( obj, bool ): - if obj == True: - sOut.write('1') - else: - sOut.write('0') elif isinstance( obj, float ): if math.isnan( obj ): if math.copysign( 1.0, obj ) < 0.0: -- cgit v1.2.3