One function

validate in fastavro/fastavro

The author described this change as fix logicalType nullable date. It counts as a record because the check below fails on the code as it stood at e752a9559 and passes on 0db133e4e, with nothing else changed between the two runs.

Fix saved2017-10-31
Sharing licenceMIT · LICENSE
Change size+2 2

What the code was meant to do, written into the code itself as a docstring

Determine if a python datum is an instance of a schema.

The change

1818 return (
1919 (isinstance(datum, (int, long,)) and
2020 INT_MIN_VALUE <= datum <= INT_MAX_VALUE) or
21- isinstance(datum, (datetime.time, datetime.datetime))
21+ isinstance(datum, (datetime.time, datetime.datetime, datetime.date))
2222 )
2323
2424 if record_type == 'long':
2525 return (
2626 (isinstance(datum, (int, long,)) and
2727 LONG_MIN_VALUE <= datum <= LONG_MAX_VALUE) or
28- isinstance(datum, (datetime.time, datetime.datetime))
28+ isinstance(datum, (datetime.time, datetime.datetime, datetime.date))
2929 )
3030
3131 if record_type in ['float', 'double']:

The check that tells the two apart

failpass·tests/test_logical_types.py::test_not_null_date

Check file tests/test_logical_types.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 ite752a9559368ea2d12d17f33263a2c80e8c9409f
Broken version dated2017-09-17
Modulefastavro.writer
Units changedvalidate
Fingerprintde3b107df8d80e69
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