check schema equality before calling match_schemas to handle the common case where the schemas are the same
MODIFY
.travis.yml
.travis.yml
language: python
+sudo: required
install:
- pip install -r developer_requirements.txt
script:
@@ -18,24 +19,17 @@ deploy:
matrix:
include:
- - sudo: False
- dist: trusty
+ - dist: trusty
python: 2.7
- - sudo: False
- dist: trusty
+ - dist: trusty
python: 3.4
- - sudo: False
- dist: trusty
+ - dist: trusty
python: 3.5
- - sudo: False
- dist: trusty
+ - dist: trusty
python: 3.6
- - sudo: required
- dist: xenial
+ - dist: xenial
python: 3.7
- - sudo: False
- dist: trusty
+ - dist: trusty
python: pypy
- - sudo: False
- dist: trusty
+ - dist: trusty
python: pypy3

MODIFY
fastavro/_read.pyx
fastavro/_read.pyx
@@ -503,6 +503,11 @@ cpdef _read_data(fo, writer_schema, reader_schema=None):
logical_type = extract_logical_type(writer_schema)
if reader_schema and record_type in AVRO_TYPES:
+ # If the schemas are the same, set the reader schema to None so that no
+ # schema resolution is done for this call or future recursive calls
+ if writer_schema == reader_schema:
+ reader_schema = None
+ else:
match_schemas(writer_schema, reader_schema)
try:

MODIFY
fastavro/_read_py.py
fastavro/_read_py.py
@@ -457,6 +457,11 @@ def read_data(fo, writer_schema, reader_schema=None):
logical_type = extract_logical_type(writer_schema)
if reader_schema and record_type in AVRO_TYPES:
+ # If the schemas are the same, set the reader schema to None so that no
+ # schema resolution is done for this call or future recursive calls
+ if writer_schema == reader_schema:
+ reader_schema = None
+ else:
match_schemas(writer_schema, reader_schema)
reader_fn = READERS.get(record_type)

check schema equality before calling match_schemas to handle the common case where the schemas are the same