Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent random filter from being inlined #478

wants to merge 1 commit into from


Copy link

snoack commented Aug 10, 2015

Currently, due to #476 environment filters like random aren't optimized/inlined. While this is a bug for any other filter, the random filter should never be inlined, but always be evaluated at runtime. Otherwise, once the template is compiled, the random filter would always give the same results. So this pull request turns random into a contextfilter to prevent it from being inlined.

Copy link

k4nar commented Apr 20, 2017

I've encountered this bug with Jinja 2.9.6 and this patch fixes it.

If this isn't merged, a workaround is to simply override env.filters['random'] with the do_random function from this patch.

Copy link

davidism commented Jul 5, 2017

New test doesn't fail when run on master.

Copy link

davidism commented Jul 5, 2017

Continued in #734.

@davidism davidism closed this Jul 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.