1. Victor Stinner
  2. hachoir

Commits

Victor Stinner  committed bfbd6cf

hachoir-parser: Fix QueryParser if parser is None

  • Participants
  • Parent commits d065321
  • Branches default

Comments (0)

Files changed (1)

File hachoir-parser/hachoir_parser/guess.py

View file
  • Ignore whitespace
             if self.use_fallback and parser.__class__ == fb:
                 return parser
         parser = self.doparse(stream, fallback)
-        stream._cached_parser = weakref.ref(parser)
+        if parser is not None:
+            stream._cached_parser = weakref.ref(parser)
         return parser
 
     def doparse(self, stream, fallback=True):