Skip to content

Commit

Permalink
Merge pull request #6047 from jepler/fix-qstr-error
Browse files Browse the repository at this point in the history
Fix qstr error
  • Loading branch information
dhalbert authored Feb 17, 2022
2 parents ab037bd + 1309ef0 commit 16c44a4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
17 changes: 15 additions & 2 deletions py/genlast.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def preprocess(command, output_dir, fn):
process_file(fn, output_dir, output)
except Exception as e:
print(e, file=sys.stderr)
raise


def maybe_preprocess(command, output_dir, fn):
Expand All @@ -72,6 +73,18 @@ def maybe_preprocess(command, output_dir, fn):
# Mac and Windows use 'spawn'. Uncomment this during testing to catch spawn-specific problems on Linux.
# multiprocessing.set_start_method("spawn")
executor = ProcessPoolExecutor(max_workers=multiprocessing.cpu_count() + 1)
executor.map(maybe_preprocess, itertools.repeat(command), itertools.repeat(output_dir), check)
executor.map(preprocess, itertools.repeat(command), itertools.repeat(output_dir), always)
results = []
try:
results.extend(
executor.map(
maybe_preprocess, itertools.repeat(command), itertools.repeat(output_dir), check
)
)
results.extend(
executor.map(
preprocess, itertools.repeat(command), itertools.repeat(output_dir), always
)
)
except subprocess.CalledProcessError:
raise SystemExit(1)
executor.shutdown()
2 changes: 2 additions & 0 deletions supervisor/shared/translate.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ STATIC int put_utf8(char *buf, int u) {
}

uint16_t decompress_length(const compressed_string_t *compressed) {
#ifndef NO_QSTR
#if (compress_max_length_bits <= 8)
return 1 + (compressed->data >> (8 - compress_max_length_bits));
#else
return 1 + ((compressed->data * 256 + compressed->tail[0]) >> (16 - compress_max_length_bits));
#endif
#endif
}

char *decompress(const compressed_string_t *compressed, char *decompressed) {
Expand Down

0 comments on commit 16c44a4

Please sign in to comment.