File tree 2 files changed +11
-12
lines changed
2 files changed +11
-12
lines changed Original file line number Diff line number Diff line change @@ -1155,17 +1155,17 @@ def set_bigcharset(self, ctx):
1155
1155
block_index = char_code >> 8
1156
1156
# NB: there are CODESIZE block indices per bytecode
1157
1157
a = array .array ("B" )
1158
- a .fromstring (array .array (CODESIZE == 2 and "H" or "I" ,
1159
- [ctx .peek_code (block_index / CODESIZE )]).tostring ())
1158
+ a .frombytes (array .array (CODESIZE == 2 and "H" or "I" ,
1159
+ [ctx .peek_code (block_index // CODESIZE )]).tobytes ())
1160
1160
block = a [block_index % CODESIZE ]
1161
- ctx .skip_code (256 / CODESIZE ) # skip block indices
1162
- block_value = ctx .peek_code (block * (32 / CODESIZE )
1161
+ ctx .skip_code (256 // CODESIZE ) # skip block indices
1162
+ block_value = ctx .peek_code (block * (32 // CODESIZE )
1163
1163
+ ((char_code & 255 ) >> (CODESIZE == 2 and 4 or 5 )))
1164
1164
if block_value & (1 << (char_code & ((8 * CODESIZE ) - 1 ))):
1165
1165
return self .ok
1166
1166
else :
1167
- ctx .skip_code (256 / CODESIZE ) # skip block indices
1168
- ctx .skip_code (count * (32 / CODESIZE )) # skip blocks
1167
+ ctx .skip_code (256 // CODESIZE ) # skip block indices
1168
+ ctx .skip_code (count * (32 // CODESIZE )) # skip blocks
1169
1169
def unknown (self , ctx ):
1170
1170
return False
1171
1171
Original file line number Diff line number Diff line change @@ -225,14 +225,13 @@ impl CFormatSpec {
225
225
"-"
226
226
} ;
227
227
228
- // TODO: Support precision
228
+ let precision = match self . precision {
229
+ Some ( CFormatQuantity :: Amount ( p) ) => p,
230
+ _ => 6 ,
231
+ } ;
229
232
let magnitude_string = match self . format_type {
230
233
CFormatType :: Float ( CFloatType :: PointDecimal ) => {
231
- if Some ( CFormatQuantity :: Amount ( 6 ) ) != self . precision {
232
- return Err ( "Not yet implemented for %#.#f types" . to_string ( ) ) ;
233
- } else {
234
- format ! ( "{:.6}" , magnitude)
235
- }
234
+ format ! ( "{:.*}" , precision, magnitude)
236
235
}
237
236
CFormatType :: Float ( CFloatType :: Exponent ( _) ) => {
238
237
return Err ( "Not yet implemented for %e and %E" . to_string ( ) )
You can’t perform that action at this time.
0 commit comments