Fix npz header incompatibility

Fixes #5170.

In addition,  *.npy test files produced in both Python2 and Python3 are added so that compatibility between versions can be tested.

Rebased for backport to 1.9. 
Fair enough! It's totally readable as is so IMO it doesn't matter at all.

On Mon, Oct 13, 2014 at 12:30 AM, Charles Harris <notifications@github.com>
wrote:

> In numpy/lib/format.py:
>
> > +    """
> > +    import tokenize
> > +    if sys.version_info[0] >= 3:
> > +        # In Python3 stderr, stdout are text files.
> > +        from io import StringIO
> > +    else:
> > +        from StringIO import StringIO
> > +
> > +    tokens = []
> > +    last_token_was_number = False
> > +    for token in tokenize.generate_tokens(StringIO(asstr(s)).read):
> > +        token_type = token[0]
> > +        token_string = token[1]
> > +        if (last_token_was_number and
> > +                token_type == tokenize.NAME and
> > +                token_string == "L"):
>
> My feeling is that the condition should be easily distinguished from the
> body. See also PEP8, indentation. The other option is a (useless) comment ;)
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/numpy/numpy/pull/5178/files#r18751104>.
>



-- 
Nathaniel J. Smith
Postdoctoral researcher - Informatics - University of Edinburgh
http://vorpus.org