Whole file
fastavro/fastavro
The author described this change as “fix bug where records should match but they were not”. It counts as a record because the checks below fail on the code as it stood at 2406ae348 and pass on 2b980fffb, with nothing else changed between the two runs.
Projectfastavro/fastavro
Fix saved2022-05-21
Sharing licenceMIT · LICENSE
Change size+4 −1
What the code was meant to do, written into the code itself as a save note
fix bug where records should match but they were not
The change
| 117 | 117 | "aliases", [] | |
| 118 | 118 | ): | |
| 119 | 119 | return r_schema | |
| 120 | + | elif w_type not in AVRO_TYPES and r_type in NAMED_TYPES: | |
| 121 | + | if match_types(w_type, r_schema["name"]): | |
| 122 | + | return r_schema["name"] | |
| 120 | 123 | elif match_types(w_type, r_type): | |
| 121 | 124 | return r_schema | |
| 122 | 125 | raise SchemaResolutionError(error_msg) | |
| ⋯ | |||
| 576 | 579 | ||
| 577 | 580 | record_type = extract_record_type(writer_schema) | |
| 578 | 581 | ||
| 579 | - | if reader_schema and record_type in AVRO_TYPES: | |
| 582 | + | if reader_schema: | |
| 580 | 583 | # If the schemas are the same, set the reader schema to None so that no | |
| 581 | 584 | # schema resolution is done for this call or future recursive calls | |
| 582 | 585 | if writer_schema == reader_schema: | |
The check that tells the two apart
fail→pass·tests/test_fastavro.py::test_name_changes_to_full_record
fail→pass·tests/test_fastavro.py::test_record_names_must_match
Check file tests/test_fastavro.py, taken without changes from the fix and copied onto the older code, so the exact same check runs against both versions.
Origin and history
The code before it2406ae34867634b4e4ce003b4bb508e557b06ce3
Broken version dated2022-05-21
Modulefastavro._read_py
Units changedmatch_schemas, read_data
Fingerprintf8d3fcccbf3465db
Checked2026-08-18 by goldset/0.1
Every field above is generated by our program. None of it is written by hand.
Other bugs found in fastavro/fastavro
- 2024-02-13Fix aliases in schema resolution (#751)
- 2023-05-04fix namespace handling
- 2022-09-09write_record
- 2022-07-29fix issue with decoding records within maps
- 2021-12-22fix issue with json decoding of complex types within maps
- 2021-05-10parse_schema