This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients Carl Ekerot, loewis, serhiy.storchaka, xiang.zhang
Date 2016-11-05.08:29:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1478334543.94.0.311240729243.issue28563@psf.upfronthosting.co.za>
In-reply-to
Content
> How does it work for '1?2:3?4:5'?

'1?2:3?4:5' -> '(2 if 1 else 3)?4:5' -> '(4 if (2 if 1 else 3) else 5'

But there are other problems. Precedence of some operators is different in C and Python. Chained comparison in Python cause different result that in C (e.g. '2 == 2 == 2'). Seems there is no other way besides a simple parser.

gettext_c2py.patch itself LGTM for fixing security issue, but tests are needed. It would be nice to make c2py() working with any expressions, but if this is too hard, this can be left for other issue. I'm going to commit a variant of gettext_c2py.patch before 3.6 release if there will be not better patches.
History
Date User Action Args
2016-11-05 08:29:03serhiy.storchakasetrecipients: + serhiy.storchaka, loewis, xiang.zhang, Carl Ekerot
2016-11-05 08:29:03serhiy.storchakasetmessageid: <1478334543.94.0.311240729243.issue28563@psf.upfronthosting.co.za>
2016-11-05 08:29:03serhiy.storchakalinkissue28563 messages
2016-11-05 08:29:03serhiy.storchakacreate