]> git.ipfire.org Git - thirdparty/jinja.git/commit
native_concat: pass only strings to literal_eval 1339/head
authorMartin Krizek <martin.krizek@gmail.com>
Thu, 28 Jan 2021 09:08:50 +0000 (10:08 +0100)
committerMartin Krizek <martin.krizek@gmail.com>
Thu, 28 Jan 2021 11:13:30 +0000 (12:13 +0100)
commitbd8bad37d1c0e2d8995a44fd88e234f5340afec5
treec58a757d55198bc257a364e3715afc1460c4398e
parent8d69d20c1d5c7af725417ca588e9c1191d9957bc
native_concat: pass only strings to literal_eval

If there is only single node and it is not a string, there is no point
in passing it into ``literal_eval``, just return it immediately.

One of the examples where passing a non-string node into
``literal_eval`` would actually cause problems is when the node is
``Undefined``. On Python 3.10 this would cause ``UndefinedError``
instead of just ``Undefined`` being returned.

Fixes #1335
CHANGES.rst
src/jinja2/nativetypes.py