You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def createParser(filename, real_filename=None, tags=None):
"""
Create a parser from a file or returns None on error.
Options:
- file (str|io.IOBase): Input file name or
a byte io.IOBase stream ;
- real_filename (str): Real file name.
"""
if not tags:
tags = []
stream = FileInputStream(filename, real_filename, tags=tags)
guess = guessParser(stream)
if guess is None:
stream.close()
return guess
You should return stream with guess. You should let us close stream.
The text was updated successfully, but these errors were encountered:
It looks like you can still get the stream from the returned parser object, no? Also, if you call parser.close() the stream will be closed. Is there any other case that is not covered?
hachoir/parser/guess.py
The text was updated successfully, but these errors were encountered: