@@ -444,10 +444,7 @@ def dump_mpy(raw_codes):
444444 for rc in raw_codes :
445445 rc .dump ()
446446
447- def freeze_mpy (qcfgs , base_qstrs , raw_codes ):
448- cfg_bytes_len = int (qcfgs ['BYTES_IN_LEN' ])
449- cfg_bytes_hash = int (qcfgs ['BYTES_IN_HASH' ])
450-
447+ def freeze_mpy (base_qstrs , raw_codes ):
451448 # add to qstrs
452449 new = {}
453450 for q in global_qstrs :
@@ -505,7 +502,8 @@ def freeze_mpy(qcfgs, base_qstrs, raw_codes):
505502 print (' %u, // used entries' % len (new ))
506503 print (' {' )
507504 for _ , _ , qstr in new :
508- print (' %s,' % qstrutil .make_bytes (cfg_bytes_len , cfg_bytes_hash , qstr ))
505+ print (' %s,'
506+ % qstrutil .make_bytes (config .MICROPY_QSTR_BYTES_IN_LEN , config .MICROPY_QSTR_BYTES_IN_HASH , qstr ))
509507 print (' },' )
510508 print ('};' )
511509
@@ -549,18 +547,23 @@ def main():
549547 }[args .mlongint_impl ]
550548 config .MPZ_DIG_SIZE = args .mmpz_dig_size
551549
550+ # set config values for qstrs, and get the existing base set of qstrs
552551 if args .qstr_header :
553552 qcfgs , base_qstrs = qstrutil .parse_input_headers ([args .qstr_header ])
553+ config .MICROPY_QSTR_BYTES_IN_LEN = int (qcfgs ['BYTES_IN_LEN' ])
554+ config .MICROPY_QSTR_BYTES_IN_HASH = int (qcfgs ['BYTES_IN_HASH' ])
554555 else :
555- qcfgs , base_qstrs = {'BYTES_IN_LEN' :1 , 'BYTES_IN_HASH' :1 }, {}
556+ config .MICROPY_QSTR_BYTES_IN_LEN = 1
557+ config .MICROPY_QSTR_BYTES_IN_HASH = 1
558+ base_qstrs = {}
556559
557560 raw_codes = [read_mpy (file ) for file in args .files ]
558561
559562 if args .dump :
560563 dump_mpy (raw_codes )
561564 elif args .freeze :
562565 try :
563- freeze_mpy (qcfgs , base_qstrs , raw_codes )
566+ freeze_mpy (base_qstrs , raw_codes )
564567 except FreezeError as er :
565568 print (er , file = sys .stderr )
566569 sys .exit (1 )
0 commit comments