From: Tim Hanus Date: Thu, 21 Nov 2013 19:15:57 +0000 (-0600) Subject: force a reload of the template if bytecode fails to unmarshall. issue #281 X-Git-Tag: 2.8~67^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f00ded9d66c54f90e135f8f44125d2736d540033;p=thirdparty%2Fjinja.git force a reload of the template if bytecode fails to unmarshall. issue #281 --- diff --git a/jinja2/bccache.py b/jinja2/bccache.py index f2f9db61..8ecbd4db 100644 --- a/jinja2/bccache.py +++ b/jinja2/bccache.py @@ -85,7 +85,12 @@ class Bucket(object): if self.checksum != checksum: self.reset() return - self.code = marshal_load(f) + # if marshal_load fails then we need to reload + try: + self.code = marshal_load(f) + except: + self.reset() + return def write_bytecode(self, f): """Dump the bytecode into the file or file like object passed."""