mirror of
https://gitee.com/openharmony/third_party_jinja2
synced 2024-11-23 15:19:46 +00:00
No longer segfault on new versions. This fixes #4
This commit is contained in:
parent
5f3d661874
commit
51db6c97e0
7
CHANGES
7
CHANGES
@ -17,6 +17,13 @@ Version 2.6
|
||||
of attributes.
|
||||
- scoped blocks not properly treat toplevel assignments and imports.
|
||||
Previously an import suddenly "disappeared" in a scoped block.
|
||||
- automatically detect newer Python interpreter versions before loading code
|
||||
from bytecode caches to prevent segfaults on invalid opcodes. The segfault
|
||||
in earlier Jinja2 versions here was not a Jinja2 bug but a limitation in
|
||||
the underlying Python interpreter. If you notice Jinja2 segfaulting in
|
||||
earlier versions after an upgrade of the Python interpreter you don't have
|
||||
to upgrade, it's enough to flush the bytecode cache. This just no longer
|
||||
makes this necessary, Jinja2 will automatically detect these cases now.
|
||||
|
||||
Version 2.5.5
|
||||
-------------
|
||||
|
@ -15,6 +15,7 @@
|
||||
:license: BSD.
|
||||
"""
|
||||
from os import path, listdir
|
||||
import sys
|
||||
import marshal
|
||||
import tempfile
|
||||
import cPickle as pickle
|
||||
@ -27,8 +28,16 @@ except ImportError:
|
||||
from jinja2.utils import open_if_exists
|
||||
|
||||
|
||||
bc_version = 1
|
||||
bc_magic = 'j2'.encode('ascii') + pickle.dumps(bc_version, 2)
|
||||
bc_version = 2
|
||||
|
||||
# magic version used to only change with new jinja versions. With 2.6
|
||||
# we change this to also take Python version changes into account. The
|
||||
# reason for this is that Python tends to segfault if fed earlier bytecode
|
||||
# versions because someone thought it would be a good idea to reuse opcodes
|
||||
# or make Python incompatible with earlier versions.
|
||||
bc_magic = 'j2'.encode('ascii') + \
|
||||
pickle.dumps(bc_version, 2) + \
|
||||
pickle.dumps((sys.version_info[0] << 24) | sys.version_info[1])
|
||||
|
||||
|
||||
class Bucket(object):
|
||||
|
Loading…
Reference in New Issue
Block a user