• Kevin Modzelewski's avatar
    Have pypa parse strings directly · b50324db
    Kevin Modzelewski authored
    Previously we would always write out the data to a file, and then
    call the parser on it.
    
    Most of this is refactoring to split the file-handling logic (ie reading
    from a FILE*) from stream-handling logic (encoding, counting line numbers,
    etc).  One tricky point is handling encoding markers inside strings-to-
    parse; we (and CPython) handle the file case by creating a Python file
    object to iterate over it, and CPython handles the string case with a special
    function to pre-process and decode the string.  This commit takes the
    approach of creating a cStringIO file-like-object and running it through
    the same decoding logic as the file case.
    b50324db
pypa-parser.h 864 Bytes