Commits

Miki Tebeka committed 2bb6c8d Merge

Merge with upstream

Comments (0)

Files changed (8)

 1d871b16cecaf8d4b95e171115587ddd90a8966a 0.6.6
 1d871b16cecaf8d4b95e171115587ddd90a8966a 0.6.6
 8170793780d4daf2ec25cc3f66cfc43fc95039cd 0.6.6
-a35126aa9f6c83db56da6da478595959097eb4a3 0.6.7
+11e4f985789b46b0c815fee4832ea77865d22141 0.6.7
-2012-07-13 version 0.6.7
+2012-07-13 version 0.6.8
     * Added "next" method to reader
 
+2012-04-29 version 0.6.7
+    * Support recursive schema (issue #4)
+
 2012-04-28 version 0.6.6
     * Using Cython on six as well
     * fastavro/pyfastavro.py -> fastavro/reader.py
 all: $(c_files)
 
 clean:
-	rm -f $(c_files)
+	rm -fv $(c_files)
+	rm -fv fastavro/*.so
 
 fresh: clean all
 
 '''
 
 __all__ = [ 'iter_avro', 'reader']
-__version__ = '0.6.7'
+__version__ = '0.6.8'
 
 
 try:
-/* Generated by Cython 0.16 on Fri Jul 13 17:53:07 2012 */
+/* Generated by Cython 0.16 on Fri Jul 13 18:03:13 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 };
 
 /*--- Type declarations ---*/
+struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__;
 struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct___iter_avro;
 
+/* "fastavro/_reader.py":321
+ *                 process_record(record)
+ *     '''
+ *     def __init__(self, fo):             # <<<<<<<<<<<<<<
+ *         self.fo = fo
+ *         try:
+ */
+struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ {
+  PyObject_HEAD
+  PyObject *__pyx_v_schema;
+};
+
+
 /* "fastavro/_reader.py":289
  * 
  * 
     return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i));
 }
 
+static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname);
+
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
 #define __Pyx_PyIter_Next(obj) __Pyx_PyIter_Next2(obj, NULL);
 
 /* Module declarations from 'fastavro._reader' */
 static PyTypeObject *__pyx_ptype_8fastavro_7_reader___pyx_scope_struct___iter_avro = 0;
+static PyTypeObject *__pyx_ptype_8fastavro_7_reader___pyx_scope_struct_1___init__ = 0;
 static PyObject *__pyx_f_8fastavro_7_reader_read_null(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
 static PyObject *__pyx_f_8fastavro_7_reader_read_boolean(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
 static PyObject *__pyx_f_8fastavro_7_reader_read_long(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/
 static PyObject *__pyx_pf_8fastavro_7_reader_30null_read_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fo); /* proto */
 static PyObject *__pyx_pf_8fastavro_7_reader_32deflate_read_block(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fo); /* proto */
 static PyObject *__pyx_pf_8fastavro_7_reader_34_iter_avro(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_fo, PyObject *__pyx_v_header, PyObject *__pyx_v_schema); /* proto */
+static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_fo, CYTHON_UNUSED PyObject *__pyx_v__); /* proto */
 static PyObject *__pyx_pf_8fastavro_7_reader_9iter_avro___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fo); /* proto */
 static PyObject *__pyx_pf_8fastavro_7_reader_9iter_avro_2__iter__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
 static PyObject *__pyx_pf_8fastavro_7_reader_9iter_avro_4next(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self); /* proto */
 static char __pyx_k_23[] = "unknown codec: {0}";
 static char __pyx_k_24[] = "cannot read header - is it an avro file?";
 static char __pyx_k_26[] = "avro.schema";
-static char __pyx_k_27[] = "Python code for reading AVRO files";
-static char __pyx_k_28[] = "org.apache.avro.file.Header";
-static char __pyx_k_31[] = "/home/miki/Projects/fastavro/fastavro/_reader.py";
-static char __pyx_k_32[] = "fastavro._reader";
-static char __pyx_k_39[] = "Custom iterator over avro file.\n\n    Example:\n        with open('some-file.avro', 'rb') as fo:\n            avro = iter_avro(fo)\n            schema = avro.schema\n\n            for record in avro:\n                process_record(record)\n    ";
+static char __pyx_k_28[] = "fastavro._reader";
+static char __pyx_k_29[] = "Python code for reading AVRO files";
+static char __pyx_k_30[] = "org.apache.avro.file.Header";
+static char __pyx_k_33[] = "/home/miki/Projects/fastavro/fastavro/_reader.py";
+static char __pyx_k_40[] = "Custom iterator over avro file.\n\n    Example:\n        with open('some-file.avro', 'rb') as fo:\n            avro = iter_avro(fo)\n            schema = avro.schema\n\n            for record in avro:\n                process_record(record)\n    ";
+static char __pyx_k___[] = "_";
 static char __pyx_k__i[] = "i";
 static char __pyx_k__fo[] = "fo";
 static char __pyx_k__os[] = "os";
 static PyObject *__pyx_kp_s_23;
 static PyObject *__pyx_kp_s_24;
 static PyObject *__pyx_kp_s_26;
-static PyObject *__pyx_kp_s_28;
-static PyObject *__pyx_kp_s_31;
-static PyObject *__pyx_n_s_32;
-static PyObject *__pyx_kp_s_39;
+static PyObject *__pyx_n_s_28;
+static PyObject *__pyx_kp_s_30;
+static PyObject *__pyx_kp_s_33;
+static PyObject *__pyx_kp_s_40;
 static PyObject *__pyx_kp_s_8;
 static PyObject *__pyx_kp_s_9;
 static PyObject *__pyx_n_s__BLOCK_READERS;
 static PyObject *__pyx_n_s__StopIteration;
 static PyObject *__pyx_n_s__VERSION;
 static PyObject *__pyx_n_s__ValueError;
+static PyObject *__pyx_n_s___;
 static PyObject *__pyx_n_s____init__;
 static PyObject *__pyx_n_s____iter__;
 static PyObject *__pyx_n_s____main__;
 static PyObject *__pyx_k_tuple_17;
 static PyObject *__pyx_k_tuple_22;
 static PyObject *__pyx_k_tuple_25;
-static PyObject *__pyx_k_tuple_29;
-static PyObject *__pyx_k_tuple_33;
-static PyObject *__pyx_k_tuple_35;
-static PyObject *__pyx_k_tuple_37;
-static PyObject *__pyx_k_codeobj_30;
-static PyObject *__pyx_k_codeobj_34;
-static PyObject *__pyx_k_codeobj_36;
-static PyObject *__pyx_k_codeobj_38;
+static PyObject *__pyx_k_tuple_27;
+static PyObject *__pyx_k_tuple_31;
+static PyObject *__pyx_k_tuple_34;
+static PyObject *__pyx_k_tuple_36;
+static PyObject *__pyx_k_tuple_38;
+static PyObject *__pyx_k_codeobj_32;
+static PyObject *__pyx_k_codeobj_35;
+static PyObject *__pyx_k_codeobj_37;
+static PyObject *__pyx_k_codeobj_39;
 
 /* "fastavro/_reader.py":42
  * 
   return __pyx_r;
 }
 
+/* Python wrapper */
+static PyObject *__pyx_pw_8fastavro_7_reader_9iter_avro_8__init___lambda1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyMethodDef __pyx_mdef_8fastavro_7_reader_9iter_avro_8__init___lambda1 = {__Pyx_NAMESTR("lambda1"), (PyCFunction)__pyx_pw_8fastavro_7_reader_9iter_avro_8__init___lambda1, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)};
+static PyObject *__pyx_pw_8fastavro_7_reader_9iter_avro_8__init___lambda1(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_fo = 0;
+  CYTHON_UNUSED PyObject *__pyx_v__ = 0;
+  static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fo,&__pyx_n_s___,0};
+  PyObject *__pyx_r = 0;
+  __Pyx_RefNannyDeclarations
+  __Pyx_RefNannySetupContext("lambda1 (wrapper)", 0);
+  __pyx_self = __pyx_self;
+  {
+    PyObject* values[2] = {0,0};
+    if (unlikely(__pyx_kwds)) {
+      Py_ssize_t kw_args;
+      const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args);
+      switch (pos_args) {
+        case  2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+        case  1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+        case  0: break;
+        default: goto __pyx_L5_argtuple_error;
+      }
+      kw_args = PyDict_Size(__pyx_kwds);
+      switch (pos_args) {
+        case  0:
+        values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fo);
+        if (likely(values[0])) kw_args--;
+        else goto __pyx_L5_argtuple_error;
+        case  1:
+        values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s___);
+        if (likely(values[1])) kw_args--;
+        else {
+          __Pyx_RaiseArgtupleInvalid("lambda1", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+        }
+      }
+      if (unlikely(kw_args > 0)) {
+        if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "lambda1") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+      }
+    } else if (PyTuple_GET_SIZE(__pyx_args) != 2) {
+      goto __pyx_L5_argtuple_error;
+    } else {
+      values[0] = PyTuple_GET_ITEM(__pyx_args, 0);
+      values[1] = PyTuple_GET_ITEM(__pyx_args, 1);
+    }
+    __pyx_v_fo = values[0];
+    __pyx_v__ = values[1];
+  }
+  goto __pyx_L4_argument_unpacking_done;
+  __pyx_L5_argtuple_error:;
+  __Pyx_RaiseArgtupleInvalid("lambda1", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;}
+  __pyx_L3_error:;
+  __Pyx_AddTraceback("fastavro._reader.iter_avro.__init__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __Pyx_RefNannyFinishContext();
+  return NULL;
+  __pyx_L4_argument_unpacking_done:;
+  __pyx_r = __pyx_lambda_funcdef_lambda1(__pyx_self, __pyx_v_fo, __pyx_v__);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
+/* "fastavro/_reader.py":334
+ *             name = schema.get('name')
+ *             if name:
+ *                 READERS[name] = lambda fo, _: read_data(fo, schema)             # <<<<<<<<<<<<<<
+ * 
+ *         self._records = _iter_avro(fo, self._header, schema)
+ */
+
+static PyObject *__pyx_lambda_funcdef_lambda1(PyObject *__pyx_self, PyObject *__pyx_v_fo, CYTHON_UNUSED PyObject *__pyx_v__) {
+  struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *__pyx_cur_scope;
+  struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *__pyx_outer_scope;
+  PyObject *__pyx_r = NULL;
+  __Pyx_RefNannyDeclarations
+  PyObject *__pyx_t_1 = NULL;
+  PyObject *__pyx_t_2 = NULL;
+  int __pyx_lineno = 0;
+  const char *__pyx_filename = NULL;
+  int __pyx_clineno = 0;
+  __Pyx_RefNannySetupContext("lambda1", 0);
+  __pyx_outer_scope = (struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *) __Pyx_CyFunction_GetClosure(__pyx_self);
+  __pyx_cur_scope = __pyx_outer_scope;
+  __Pyx_XDECREF(__pyx_r);
+  if (unlikely(!__pyx_cur_scope->__pyx_v_schema)) { __Pyx_RaiseClosureNameError("schema"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} }
+  __pyx_t_1 = __pyx_cur_scope->__pyx_v_schema;
+  __Pyx_INCREF(__pyx_t_1);
+  __pyx_t_2 = __pyx_f_8fastavro_7_reader_read_data(__pyx_v_fo, __pyx_t_1, 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_2);
+  __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
+  __pyx_r = __pyx_t_2;
+  __pyx_t_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; __Pyx_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1_error:;
+  __Pyx_XDECREF(__pyx_t_1);
+  __Pyx_XDECREF(__pyx_t_2);
+  __Pyx_AddTraceback("fastavro._reader.iter_avro.__init__.lambda1", __pyx_clineno, __pyx_lineno, __pyx_filename);
+  __pyx_r = NULL;
+  __pyx_L0:;
+  __Pyx_XGIVEREF(__pyx_r);
+  __Pyx_RefNannyFinishContext();
+  return __pyx_r;
+}
+
 /* "fastavro/_reader.py":321
  *                 process_record(record)
  *     '''
  */
 
 static PyObject *__pyx_pf_8fastavro_7_reader_9iter_avro___init__(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_self, PyObject *__pyx_v_fo) {
+  struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *__pyx_cur_scope;
+  PyObject *__pyx_v_name = NULL;
   PyObject *__pyx_r = NULL;
   __Pyx_RefNannyDeclarations
   PyObject *__pyx_t_1 = NULL;
   int __pyx_t_6;
   PyObject *__pyx_t_7 = NULL;
   PyObject *__pyx_t_8 = NULL;
+  int __pyx_t_9;
   int __pyx_lineno = 0;
   const char *__pyx_filename = NULL;
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__init__", 0);
+  __pyx_cur_scope = (struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *)__pyx_ptype_8fastavro_7_reader___pyx_scope_struct_1___init__->tp_new(__pyx_ptype_8fastavro_7_reader___pyx_scope_struct_1___init__, __pyx_empty_tuple, NULL);
+  if (unlikely(!__pyx_cur_scope)) {
+    __Pyx_RefNannyFinishContext();
+    return NULL;
+  }
+  __Pyx_GOTREF(__pyx_cur_scope);
 
   /* "fastavro/_reader.py":322
  *     '''
  *             self._header = read_data(fo, META_SCHEMA)
  *         except StopIteration:             # <<<<<<<<<<<<<<
  *             raise ValueError('cannot read header - is it an avro file?')
- *         self.schema = json.loads(btou(self._header['meta']['avro.schema']))
+ * 
  */
     __pyx_t_6 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration);
     if (__pyx_t_6) {
  *             self._header = read_data(fo, META_SCHEMA)
  *         except StopIteration:
  *             raise ValueError('cannot read header - is it an avro file?')             # <<<<<<<<<<<<<<
- *         self.schema = json.loads(btou(self._header['meta']['avro.schema']))
- *         self._records = _iter_avro(fo, self._header, self.schema)
+ * 
+ *         self.schema = schema = \
  */
       __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L5_except_error;}
       __Pyx_GOTREF(__pyx_t_8);
     __pyx_L10_try_end:;
   }
 
-  /* "fastavro/_reader.py":327
- *         except StopIteration:
- *             raise ValueError('cannot read header - is it an avro file?')
- *         self.schema = json.loads(btou(self._header['meta']['avro.schema']))             # <<<<<<<<<<<<<<
- *         self._records = _iter_avro(fo, self._header, self.schema)
- * 
- */
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__json); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  /* "fastavro/_reader.py":329
+ * 
+ *         self.schema = schema = \
+ *                 json.loads(btou(self._header['meta']['avro.schema']))             # <<<<<<<<<<<<<<
+ * 
+ *         if type(schema) == dict:
+ */
+  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__json); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__loads); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__loads); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
-  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__btou); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__btou); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_7);
-  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_8 = PyObject_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__meta)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyObject_GetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__meta)); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_GetItem(__pyx_t_8, ((PyObject *)__pyx_kp_s_26)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_GetItem(__pyx_t_8, ((PyObject *)__pyx_kp_s_26)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
-  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_5);
   __Pyx_GIVEREF(__pyx_t_5);
   __pyx_t_5 = 0;
-  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_5 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
   __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
   __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__schema, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
 
   /* "fastavro/_reader.py":328
  *             raise ValueError('cannot read header - is it an avro file?')
- *         self.schema = json.loads(btou(self._header['meta']['avro.schema']))
- *         self._records = _iter_avro(fo, self._header, self.schema)             # <<<<<<<<<<<<<<
+ * 
+ *         self.schema = schema = \             # <<<<<<<<<<<<<<
+ *                 json.loads(btou(self._header['meta']['avro.schema']))
+ * 
+ */
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__schema, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_INCREF(__pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __pyx_cur_scope->__pyx_v_schema = __pyx_t_5;
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+
+  /* "fastavro/_reader.py":331
+ *                 json.loads(btou(self._header['meta']['avro.schema']))
+ * 
+ *         if type(schema) == dict:             # <<<<<<<<<<<<<<
+ *             name = schema.get('name')
+ *             if name:
+ */
+  __pyx_t_5 = PyObject_RichCompare(((PyObject *)Py_TYPE(__pyx_cur_scope->__pyx_v_schema)), ((PyObject *)((PyObject*)(&PyDict_Type))), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+  if (__pyx_t_9) {
+
+    /* "fastavro/_reader.py":332
+ * 
+ *         if type(schema) == dict:
+ *             name = schema.get('name')             # <<<<<<<<<<<<<<
+ *             if name:
+ *                 READERS[name] = lambda fo, _: read_data(fo, schema)
+ */
+    __pyx_t_5 = PyObject_GetAttr(__pyx_cur_scope->__pyx_v_schema, __pyx_n_s__get); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_5);
+    __pyx_t_8 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    __Pyx_GOTREF(__pyx_t_8);
+    __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+    __pyx_v_name = __pyx_t_8;
+    __pyx_t_8 = 0;
+
+    /* "fastavro/_reader.py":333
+ *         if type(schema) == dict:
+ *             name = schema.get('name')
+ *             if name:             # <<<<<<<<<<<<<<
+ *                 READERS[name] = lambda fo, _: read_data(fo, schema)
+ * 
+ */
+    __pyx_t_9 = __Pyx_PyObject_IsTrue(__pyx_v_name); if (unlikely(__pyx_t_9 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+    if (__pyx_t_9) {
+
+      /* "fastavro/_reader.py":334
+ *             name = schema.get('name')
+ *             if name:
+ *                 READERS[name] = lambda fo, _: read_data(fo, schema)             # <<<<<<<<<<<<<<
+ * 
+ *         self._records = _iter_avro(fo, self._header, schema)
+ */
+      __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_9iter_avro_8__init___lambda1, 0, ((PyObject*)__pyx_cur_scope), __pyx_n_s_28, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_8);
+      __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__READERS); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_GOTREF(__pyx_t_5);
+      if (PyObject_SetItem(__pyx_t_5, __pyx_v_name, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+      __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
+      __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+      goto __pyx_L14;
+    }
+    __pyx_L14:;
+    goto __pyx_L13;
+  }
+  __pyx_L13:;
+
+  /* "fastavro/_reader.py":336
+ *                 READERS[name] = lambda fo, _: read_data(fo, schema)
+ * 
+ *         self._records = _iter_avro(fo, self._header, schema)             # <<<<<<<<<<<<<<
  * 
  *     def __iter__(self):
  */
-  __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s___iter_avro); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s___iter_avro); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_8);
+  __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_5);
-  __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___header); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_8);
-  __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__schema); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_4);
-  __pyx_t_7 = PyTuple_New(3); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_7);
   __Pyx_INCREF(__pyx_v_fo);
-  PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_fo);
+  PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_fo);
   __Pyx_GIVEREF(__pyx_v_fo);
-  PyTuple_SET_ITEM(__pyx_t_7, 1, __pyx_t_8);
-  __Pyx_GIVEREF(__pyx_t_8);
-  PyTuple_SET_ITEM(__pyx_t_7, 2, __pyx_t_4);
-  __Pyx_GIVEREF(__pyx_t_4);
-  __pyx_t_8 = 0;
-  __pyx_t_4 = 0;
-  __pyx_t_4 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_t_7), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_t_4);
+  PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_5);
+  __Pyx_GIVEREF(__pyx_t_5);
+  __Pyx_INCREF(__pyx_cur_scope->__pyx_v_schema);
+  PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_cur_scope->__pyx_v_schema);
+  __Pyx_GIVEREF(__pyx_cur_scope->__pyx_v_schema);
+  __pyx_t_5 = 0;
+  __pyx_t_5 = PyObject_Call(__pyx_t_8, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_t_5);
+  __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
+  __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0;
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___records, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0;
-  __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0;
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s___records, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0;
 
   __pyx_r = Py_None; __Pyx_INCREF(Py_None);
   goto __pyx_L0;
   __Pyx_AddTraceback("fastavro._reader.iter_avro.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename);
   __pyx_r = NULL;
   __pyx_L0:;
+  __Pyx_XDECREF(__pyx_v_name);
+  __Pyx_DECREF(((PyObject *)__pyx_cur_scope));
   __Pyx_XGIVEREF(__pyx_r);
   __Pyx_RefNannyFinishContext();
   return __pyx_r;
   return __pyx_r;
 }
 
-/* "fastavro/_reader.py":330
- *         self._records = _iter_avro(fo, self._header, self.schema)
+/* "fastavro/_reader.py":338
+ *         self._records = _iter_avro(fo, self._header, schema)
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self._records
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("__iter__", 0);
 
-  /* "fastavro/_reader.py":331
+  /* "fastavro/_reader.py":339
  * 
  *     def __iter__(self):
  *         return self._records             # <<<<<<<<<<<<<<
  *     def next(self):
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___records); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___records); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
   __pyx_r = __pyx_t_1;
   __pyx_t_1 = 0;
   return __pyx_r;
 }
 
-/* "fastavro/_reader.py":333
+/* "fastavro/_reader.py":341
  *         return self._records
  * 
  *     def next(self):             # <<<<<<<<<<<<<<
   int __pyx_clineno = 0;
   __Pyx_RefNannySetupContext("next", 0);
 
-  /* "fastavro/_reader.py":334
+  /* "fastavro/_reader.py":342
  * 
  *     def next(self):
  *         return next(self._records)             # <<<<<<<<<<<<<<
  */
   __Pyx_XDECREF(__pyx_r);
-  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___records); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s___records); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_1);
-  __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = __Pyx_PyIter_Next(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0;
   __pyx_r = __pyx_t_2;
   #endif
 };
 
+static PyObject *__pyx_tp_new_8fastavro_7_reader___pyx_scope_struct_1___init__(PyTypeObject *t, PyObject *a, PyObject *k) {
+  struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *p;
+  PyObject *o = (*t->tp_alloc)(t, 0);
+  if (!o) return 0;
+  p = ((struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *)o);
+  p->__pyx_v_schema = 0;
+  return o;
+}
+
+static void __pyx_tp_dealloc_8fastavro_7_reader___pyx_scope_struct_1___init__(PyObject *o) {
+  struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *)o;
+  Py_XDECREF(p->__pyx_v_schema);
+  (*Py_TYPE(o)->tp_free)(o);
+}
+
+static int __pyx_tp_traverse_8fastavro_7_reader___pyx_scope_struct_1___init__(PyObject *o, visitproc v, void *a) {
+  int e;
+  struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *)o;
+  if (p->__pyx_v_schema) {
+    e = (*v)(p->__pyx_v_schema, a); if (e) return e;
+  }
+  return 0;
+}
+
+static int __pyx_tp_clear_8fastavro_7_reader___pyx_scope_struct_1___init__(PyObject *o) {
+  struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *p = (struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__ *)o;
+  PyObject* tmp;
+  tmp = ((PyObject*)p->__pyx_v_schema);
+  p->__pyx_v_schema = Py_None; Py_INCREF(Py_None);
+  Py_XDECREF(tmp);
+  return 0;
+}
+
+static PyMethodDef __pyx_methods_8fastavro_7_reader___pyx_scope_struct_1___init__[] = {
+  {0, 0, 0, 0}
+};
+
+static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct_1___init__ = {
+  0, /*nb_add*/
+  0, /*nb_subtract*/
+  0, /*nb_multiply*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_divide*/
+  #endif
+  0, /*nb_remainder*/
+  0, /*nb_divmod*/
+  0, /*nb_power*/
+  0, /*nb_negative*/
+  0, /*nb_positive*/
+  0, /*nb_absolute*/
+  0, /*nb_nonzero*/
+  0, /*nb_invert*/
+  0, /*nb_lshift*/
+  0, /*nb_rshift*/
+  0, /*nb_and*/
+  0, /*nb_xor*/
+  0, /*nb_or*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_coerce*/
+  #endif
+  0, /*nb_int*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_long*/
+  #else
+  0, /*reserved*/
+  #endif
+  0, /*nb_float*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_oct*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_hex*/
+  #endif
+  0, /*nb_inplace_add*/
+  0, /*nb_inplace_subtract*/
+  0, /*nb_inplace_multiply*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*nb_inplace_divide*/
+  #endif
+  0, /*nb_inplace_remainder*/
+  0, /*nb_inplace_power*/
+  0, /*nb_inplace_lshift*/
+  0, /*nb_inplace_rshift*/
+  0, /*nb_inplace_and*/
+  0, /*nb_inplace_xor*/
+  0, /*nb_inplace_or*/
+  0, /*nb_floor_divide*/
+  0, /*nb_true_divide*/
+  0, /*nb_inplace_floor_divide*/
+  0, /*nb_inplace_true_divide*/
+  #if PY_VERSION_HEX >= 0x02050000
+  0, /*nb_index*/
+  #endif
+};
+
+static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct_1___init__ = {
+  0, /*sq_length*/
+  0, /*sq_concat*/
+  0, /*sq_repeat*/
+  0, /*sq_item*/
+  0, /*sq_slice*/
+  0, /*sq_ass_item*/
+  0, /*sq_ass_slice*/
+  0, /*sq_contains*/
+  0, /*sq_inplace_concat*/
+  0, /*sq_inplace_repeat*/
+};
+
+static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct_1___init__ = {
+  0, /*mp_length*/
+  0, /*mp_subscript*/
+  0, /*mp_ass_subscript*/
+};
+
+static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct_1___init__ = {
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getreadbuffer*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getwritebuffer*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getsegcount*/
+  #endif
+  #if PY_MAJOR_VERSION < 3
+  0, /*bf_getcharbuffer*/
+  #endif
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*bf_getbuffer*/
+  #endif
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*bf_releasebuffer*/
+  #endif
+};
+
+static PyTypeObject __pyx_type_8fastavro_7_reader___pyx_scope_struct_1___init__ = {
+  PyVarObject_HEAD_INIT(0, 0)
+  __Pyx_NAMESTR("fastavro._reader.__pyx_scope_struct_1___init__"), /*tp_name*/
+  sizeof(struct __pyx_obj_8fastavro_7_reader___pyx_scope_struct_1___init__), /*tp_basicsize*/
+  0, /*tp_itemsize*/
+  __pyx_tp_dealloc_8fastavro_7_reader___pyx_scope_struct_1___init__, /*tp_dealloc*/
+  0, /*tp_print*/
+  0, /*tp_getattr*/
+  0, /*tp_setattr*/
+  #if PY_MAJOR_VERSION < 3
+  0, /*tp_compare*/
+  #else
+  0, /*reserved*/
+  #endif
+  0, /*tp_repr*/
+  &__pyx_tp_as_number___pyx_scope_struct_1___init__, /*tp_as_number*/
+  &__pyx_tp_as_sequence___pyx_scope_struct_1___init__, /*tp_as_sequence*/
+  &__pyx_tp_as_mapping___pyx_scope_struct_1___init__, /*tp_as_mapping*/
+  0, /*tp_hash*/
+  0, /*tp_call*/
+  0, /*tp_str*/
+  0, /*tp_getattro*/
+  0, /*tp_setattro*/
+  &__pyx_tp_as_buffer___pyx_scope_struct_1___init__, /*tp_as_buffer*/
+  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
+  0, /*tp_doc*/
+  __pyx_tp_traverse_8fastavro_7_reader___pyx_scope_struct_1___init__, /*tp_traverse*/
+  __pyx_tp_clear_8fastavro_7_reader___pyx_scope_struct_1___init__, /*tp_clear*/
+  0, /*tp_richcompare*/
+  0, /*tp_weaklistoffset*/
+  0, /*tp_iter*/
+  0, /*tp_iternext*/
+  __pyx_methods_8fastavro_7_reader___pyx_scope_struct_1___init__, /*tp_methods*/
+  0, /*tp_members*/
+  0, /*tp_getset*/
+  0, /*tp_base*/
+  0, /*tp_dict*/
+  0, /*tp_descr_get*/
+  0, /*tp_descr_set*/
+  0, /*tp_dictoffset*/
+  0, /*tp_init*/
+  0, /*tp_alloc*/
+  __pyx_tp_new_8fastavro_7_reader___pyx_scope_struct_1___init__, /*tp_new*/
+  0, /*tp_free*/
+  0, /*tp_is_gc*/
+  0, /*tp_bases*/
+  0, /*tp_mro*/
+  0, /*tp_cache*/
+  0, /*tp_subclasses*/
+  0, /*tp_weaklist*/
+  0, /*tp_del*/
+  #if PY_VERSION_HEX >= 0x02060000
+  0, /*tp_version_tag*/
+  #endif
+};
+
 static PyMethodDef __pyx_methods[] = {
   {__Pyx_NAMESTR("read_null"), (PyCFunction)__pyx_pw_8fastavro_7_reader_1read_null, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8fastavro_7_reader_read_null)},
   {__Pyx_NAMESTR("read_boolean"), (PyCFunction)__pyx_pw_8fastavro_7_reader_3read_boolean, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8fastavro_7_reader_2read_boolean)},
 static struct PyModuleDef __pyx_moduledef = {
     PyModuleDef_HEAD_INIT,
     __Pyx_NAMESTR("_reader"),
-    __Pyx_DOCSTR(__pyx_k_27), /* m_doc */
+    __Pyx_DOCSTR(__pyx_k_29), /* m_doc */
     -1, /* m_size */
     __pyx_methods /* m_methods */,
     NULL, /* m_reload */
   {&__pyx_kp_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 0},
   {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0},
   {&__pyx_kp_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 0},
-  {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0},
-  {&__pyx_kp_s_31, __pyx_k_31, sizeof(__pyx_k_31), 0, 0, 1, 0},
-  {&__pyx_n_s_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 0, 1, 1},
-  {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0},
+  {&__pyx_n_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 1},
+  {&__pyx_kp_s_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 0, 1, 0},
+  {&__pyx_kp_s_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 0, 1, 0},
+  {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0},
   {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0},
   {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0},
   {&__pyx_n_s__BLOCK_READERS, __pyx_k__BLOCK_READERS, sizeof(__pyx_k__BLOCK_READERS), 0, 0, 1, 1},
   {&__pyx_n_s__StopIteration, __pyx_k__StopIteration, sizeof(__pyx_k__StopIteration), 0, 0, 1, 1},
   {&__pyx_n_s__VERSION, __pyx_k__VERSION, sizeof(__pyx_k__VERSION), 0, 0, 1, 1},
   {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1},
+  {&__pyx_n_s___, __pyx_k___, sizeof(__pyx_k___), 0, 0, 1, 1},
   {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1},
   {&__pyx_n_s____iter__, __pyx_k____iter__, sizeof(__pyx_k____iter__), 0, 0, 1, 1},
   {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1},
  *             self._header = read_data(fo, META_SCHEMA)
  *         except StopIteration:
  *             raise ValueError('cannot read header - is it an avro file?')             # <<<<<<<<<<<<<<
- *         self.schema = json.loads(btou(self._header['meta']['avro.schema']))
- *         self._records = _iter_avro(fo, self._header, self.schema)
+ * 
+ *         self.schema = schema = \
  */
   __pyx_k_tuple_25 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_k_tuple_25);
   __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_24));
   __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25));
 
+  /* "fastavro/_reader.py":332
+ * 
+ *         if type(schema) == dict:
+ *             name = schema.get('name')             # <<<<<<<<<<<<<<
+ *             if name:
+ *                 READERS[name] = lambda fo, _: read_data(fo, schema)
+ */
+  __pyx_k_tuple_27 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_27);
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__name));
+  PyTuple_SET_ITEM(__pyx_k_tuple_27, 0, ((PyObject *)__pyx_n_s__name));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__name));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27));
+
   /* "fastavro/_reader.py":289
  * 
  * 
  *     '''Return iterator over avro records.'''
  *     sync_marker = header['sync']
  */
-  __pyx_k_tuple_29 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_29);
+  __pyx_k_tuple_31 = PyTuple_New(9); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_31);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fo));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 0, ((PyObject *)__pyx_n_s__fo));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 0, ((PyObject *)__pyx_n_s__fo));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fo));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__header));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 1, ((PyObject *)__pyx_n_s__header));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 1, ((PyObject *)__pyx_n_s__header));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__header));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__schema));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 2, ((PyObject *)__pyx_n_s__schema));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 2, ((PyObject *)__pyx_n_s__schema));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__schema));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__sync_marker));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 3, ((PyObject *)__pyx_n_s__sync_marker));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 3, ((PyObject *)__pyx_n_s__sync_marker));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__sync_marker));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__codec));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 4, ((PyObject *)__pyx_n_s__codec));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 4, ((PyObject *)__pyx_n_s__codec));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__codec));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__read_block));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 5, ((PyObject *)__pyx_n_s__read_block));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 5, ((PyObject *)__pyx_n_s__read_block));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__read_block));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__block_count));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 6, ((PyObject *)__pyx_n_s__block_count));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 6, ((PyObject *)__pyx_n_s__block_count));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__block_count));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__block_fo));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 7, ((PyObject *)__pyx_n_s__block_fo));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 7, ((PyObject *)__pyx_n_s__block_fo));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__block_fo));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__i));
-  PyTuple_SET_ITEM(__pyx_k_tuple_29, 8, ((PyObject *)__pyx_n_s__i));
+  PyTuple_SET_ITEM(__pyx_k_tuple_31, 8, ((PyObject *)__pyx_n_s__i));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29));
-  __pyx_k_codeobj_30 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_29, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_31, __pyx_n_s___iter_avro, 289, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31));
+  __pyx_k_codeobj_32 = (PyObject*)__Pyx_PyCode_New(3, 0, 9, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_31, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s___iter_avro, 289, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_32)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "fastavro/_reader.py":321
  *                 process_record(record)
  *         self.fo = fo
  *         try:
  */
-  __pyx_k_tuple_33 = PyTuple_New(2); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_33);
+  __pyx_k_tuple_34 = PyTuple_New(4); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_34);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_33, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
   __Pyx_INCREF(((PyObject *)__pyx_n_s__fo));
-  PyTuple_SET_ITEM(__pyx_k_tuple_33, 1, ((PyObject *)__pyx_n_s__fo));
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 1, ((PyObject *)__pyx_n_s__fo));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__fo));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33));
-  __pyx_k_codeobj_34 = (PyObject*)__Pyx_PyCode_New(2, 0, 2, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_33, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_31, __pyx_n_s____init__, 321, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "fastavro/_reader.py":330
- *         self._records = _iter_avro(fo, self._header, self.schema)
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__schema));
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 2, ((PyObject *)__pyx_n_s__schema));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__schema));
+  __Pyx_INCREF(((PyObject *)__pyx_n_s__name));
+  PyTuple_SET_ITEM(__pyx_k_tuple_34, 3, ((PyObject *)__pyx_n_s__name));
+  __Pyx_GIVEREF(((PyObject *)__pyx_n_s__name));
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34));
+  __pyx_k_codeobj_35 = (PyObject*)__Pyx_PyCode_New(2, 0, 4, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_34, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s____init__, 321, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "fastavro/_reader.py":338
+ *         self._records = _iter_avro(fo, self._header, schema)
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self._records
  * 
  */
-  __pyx_k_tuple_35 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_35);
+  __pyx_k_tuple_36 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_36);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_35, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_36, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35));
-  __pyx_k_codeobj_36 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_35, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_31, __pyx_n_s____iter__, 330, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-
-  /* "fastavro/_reader.py":333
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_36));
+  __pyx_k_codeobj_37 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_36, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s____iter__, 338, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+
+  /* "fastavro/_reader.py":341
  *         return self._records
  * 
  *     def next(self):             # <<<<<<<<<<<<<<
  *         return next(self._records)
  */
-  __pyx_k_tuple_37 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __Pyx_GOTREF(__pyx_k_tuple_37);
+  __pyx_k_tuple_38 = PyTuple_New(1); if (unlikely(!__pyx_k_tuple_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GOTREF(__pyx_k_tuple_38);
   __Pyx_INCREF(((PyObject *)__pyx_n_s__self));
-  PyTuple_SET_ITEM(__pyx_k_tuple_37, 0, ((PyObject *)__pyx_n_s__self));
+  PyTuple_SET_ITEM(__pyx_k_tuple_38, 0, ((PyObject *)__pyx_n_s__self));
   __Pyx_GIVEREF(((PyObject *)__pyx_n_s__self));
-  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37));
-  __pyx_k_codeobj_38 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_37, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_31, __pyx_n_s__next, 333, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_38));
+  __pyx_k_codeobj_39 = (PyObject*)__Pyx_PyCode_New(1, 0, 1, 0, 0, __pyx_empty_bytes, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_k_tuple_38, __pyx_empty_tuple, __pyx_empty_tuple, __pyx_kp_s_33, __pyx_n_s__next, 341, __pyx_empty_bytes); if (unlikely(!__pyx_k_codeobj_39)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_RefNannyFinishContext();
   return 0;
   __pyx_L1_error:;
   #endif
   /*--- Module creation code ---*/
   #if PY_MAJOR_VERSION < 3
-  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_reader"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_27), 0, PYTHON_API_VERSION);
+  __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_reader"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_29), 0, PYTHON_API_VERSION);
   #else
   __pyx_m = PyModule_Create(&__pyx_moduledef);
   #endif
   /*--- Type init code ---*/
   if (PyType_Ready(&__pyx_type_8fastavro_7_reader___pyx_scope_struct___iter_avro) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __pyx_ptype_8fastavro_7_reader___pyx_scope_struct___iter_avro = &__pyx_type_8fastavro_7_reader___pyx_scope_struct___iter_avro;
+  if (PyType_Ready(&__pyx_type_8fastavro_7_reader___pyx_scope_struct_1___init__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_ptype_8fastavro_7_reader___pyx_scope_struct_1___init__ = &__pyx_type_8fastavro_7_reader___pyx_scope_struct_1___init__;
   /*--- Type import code ---*/
   /*--- Variable import code ---*/
   /*--- Function import code ---*/
   __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(((PyObject *)__pyx_t_2));
   if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__type), ((PyObject *)__pyx_n_s__record)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__name), ((PyObject *)__pyx_kp_s_28)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__name), ((PyObject *)__pyx_kp_s_30)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
 
   /* "fastavro/_reader.py":25
  *     'name': 'org.apache.avro.file.Header',
  *     '''Return iterator over avro records.'''
  *     sync_marker = header['sync']
  */
-  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_35_iter_avro, NULL, __pyx_n_s_32); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_2 = PyCFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_35_iter_avro, NULL, __pyx_n_s_28); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_2);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s___iter_avro, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0;
  *         self.fo = fo
  *         try:
  */
-  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_9iter_avro_1__init__, 0, NULL, __pyx_n_s_32, ((PyObject *)__pyx_k_codeobj_34)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_9iter_avro_1__init__, 0, NULL, __pyx_n_s_28, ((PyObject *)__pyx_k_codeobj_35)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____init__, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 321; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-  /* "fastavro/_reader.py":330
- *         self._records = _iter_avro(fo, self._header, self.schema)
+  /* "fastavro/_reader.py":338
+ *         self._records = _iter_avro(fo, self._header, schema)
  * 
  *     def __iter__(self):             # <<<<<<<<<<<<<<
  *         return self._records
  * 
  */
-  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_9iter_avro_3__iter__, 0, NULL, __pyx_n_s_32, ((PyObject *)__pyx_k_codeobj_36)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_9iter_avro_3__iter__, 0, NULL, __pyx_n_s_28, ((PyObject *)__pyx_k_codeobj_37)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____iter__, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s____iter__, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
-  /* "fastavro/_reader.py":333
+  /* "fastavro/_reader.py":341
  *         return self._records
  * 
  *     def next(self):             # <<<<<<<<<<<<<<
  *         return next(self._records)
  */
-  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_9iter_avro_5next, 0, NULL, __pyx_n_s_32, ((PyObject *)__pyx_k_codeobj_38)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_CyFunction_NewEx(&__pyx_mdef_8fastavro_7_reader_9iter_avro_5next, 0, NULL, __pyx_n_s_28, ((PyObject *)__pyx_k_codeobj_39)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
-  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__next, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyObject_SetItem(__pyx_t_2, __pyx_n_s__next, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
   /* "fastavro/_reader.py":310
  *     '''Custom iterator over avro file.
  * 
  */
-  if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
-  __pyx_t_8 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2), __pyx_n_s__iter_avro, __pyx_n_s_32); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  if (PyDict_SetItemString(((PyObject *)__pyx_t_2), "__doc__", ((PyObject *)__pyx_kp_s_40)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
+  __pyx_t_8 = __Pyx_CreateClass(((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2), __pyx_n_s__iter_avro, __pyx_n_s_28); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_GOTREF(__pyx_t_8);
   if (PyObject_SetAttr(__pyx_m, __pyx_n_s__iter_avro, __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;}
   __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0;
 
 
 
+static CYTHON_INLINE void __Pyx_RaiseClosureNameError(const char *varname) {
+    PyErr_Format(PyExc_NameError, "free variable '%s' referenced before assignment in enclosing scope", varname);
+}
+
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) {
     PyObject *local_type, *local_value, *local_tb;
     PyObject *tmp_type, *tmp_value, *tmp_tb;
-/* Generated by Cython 0.16 on Wed May 23 16:56:58 2012 */
+/* Generated by Cython 0.16 on Fri Jul 13 18:03:13 2012 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
             self._header = read_data(fo, META_SCHEMA)
         except StopIteration:
             raise ValueError('cannot read header - is it an avro file?')
-        self.schema = json.loads(btou(self._header['meta']['avro.schema']))
-        self._records = _iter_avro(fo, self._header, self.schema)
+
+        self.schema = schema = \
+                json.loads(btou(self._header['meta']['avro.schema']))
+
+        if type(schema) == dict:
+            name = schema.get('name')
+            if name:
+                READERS[name] = lambda fo, _: read_data(fo, schema)
+
+        self._records = _iter_avro(fo, self._header, schema)
 
     def __iter__(self):
         return self._records

tests/avro-files/recursive.avro

Binary file added.