|
69 | 69 | from mypy_extensions import u8 |
70 | 70 |
|
71 | 71 | # High-level cache layout format |
72 | | -CACHE_VERSION: Final = 9 |
| 72 | +CACHE_VERSION: Final = 10 |
73 | 73 |
|
74 | 74 | # Type used internally to represent errors: |
75 | 75 | # (path, line, column, end_line, end_column, severity, message, code) |
@@ -478,7 +478,7 @@ def write_str_opt_list(data: WriteBuffer, value: list[str | None]) -> None: |
478 | 478 | write_str_opt(data, item) |
479 | 479 |
|
480 | 480 |
|
481 | | -Value: _TypeAlias = None | int | str | bool |
| 481 | +Value: _TypeAlias = None | int | float | str | bool |
482 | 482 |
|
483 | 483 | # Our JSON format is somewhat non-standard as we distinguish lists and tuples. |
484 | 484 | # This is convenient for some internal things, like mypyc plugin and error serialization. |
@@ -508,6 +508,8 @@ def read_json_value(data: ReadBuffer) -> JsonValue: |
508 | 508 | if tag == DICT_STR_GEN: |
509 | 509 | size = read_int_bare(data) |
510 | 510 | return {read_str_bare(data): read_json_value(data) for _ in range(size)} |
| 511 | + if tag == LITERAL_FLOAT: |
| 512 | + return read_float_bare(data) |
511 | 513 | assert False, f"Invalid JSON tag: {tag}" |
512 | 514 |
|
513 | 515 |
|
@@ -538,6 +540,9 @@ def write_json_value(data: WriteBuffer, value: JsonValue) -> None: |
538 | 540 | for key in sorted(value): |
539 | 541 | write_str_bare(data, key) |
540 | 542 | write_json_value(data, value[key]) |
| 543 | + elif isinstance(value, float): |
| 544 | + write_tag(data, LITERAL_FLOAT) |
| 545 | + write_float_bare(data, value) |
541 | 546 | else: |
542 | 547 | assert False, f"Invalid JSON value: {value}" |
543 | 548 |
|
|
0 commit comments