On 2017-02-28, Chris Angelico wrote:
> On Tue, Feb 28, 2017 at 11:35 AM, Jon Ribbens
> wrote:
>> Sorry, I must have missed something here. What are you talking about?
>> "lambda: [1,2,3]" is not acceptable input to ast.literal_eval(), it
>> will throw an exception.
>
> [1,2,3] is, though. Go rea
On Tue, Feb 28, 2017 at 11:35 AM, Jon Ribbens wrote:
> Sorry, I must have missed something here. What are you talking about?
> "lambda: [1,2,3]" is not acceptable input to ast.literal_eval(), it
> will throw an exception.
[1,2,3] is, though. Go read my previous posts.
ChrisA
--
https://mail.pyt
On 2017-02-27, Chris Angelico wrote:
> On Tue, Feb 28, 2017 at 3:58 AM, Jon Ribbens
> wrote:
>> Seeing as most of it is code along the lines of "is this an integer
>> constant? if so the value is that constant": no, I think "execution"
>> is a misleading word to use.
>
> That's true of a lot of
On Tue, Feb 28, 2017 at 3:58 AM, Jon Ribbens wrote:
> On 2017-02-27, Chris Angelico wrote:
>> On Tue, Feb 28, 2017 at 3:17 AM, Jon Ribbens
>> wrote:
>>> On 2017-02-27, Chris Angelico wrote:
Actually it does execute, as you can see from the source code.
>>>
>>> I'm not sure what you mean b
On 2017-02-27, Chris Angelico wrote:
> On Tue, Feb 28, 2017 at 3:17 AM, Jon Ribbens
> wrote:
>> On 2017-02-27, Chris Angelico wrote:
>>> Actually it does execute, as you can see from the source code.
>>
>> I'm not sure what you mean by that. I was looking at the source code
>> (and its history)
On Tue, Feb 28, 2017 at 3:17 AM, Jon Ribbens wrote:
> On 2017-02-27, Chris Angelico wrote:
>> Actually it does execute, as you can see from the source code.
>
> I'm not sure what you mean by that. I was looking at the source code
> (and its history) when I wrote my post, and I would be hard pushe
On 2017-02-27, Chris Angelico wrote:
> On Tue, Feb 28, 2017 at 1:18 AM, Jon Ribbens
> wrote:
>> "execution" isn't really the right way to describe literal_eval().
>> It isn't an code executor or even an expression evaluator, all it
>> does is turns a Python literal in source form into the value
On Tue, Feb 28, 2017 at 1:18 AM, Jon Ribbens wrote:
> On 2017-02-27, Vincent Vande Vyvre wrote:
>> Le 27/02/17 à 14:09, Chris Angelico a écrit :
>>> The message is a little confusing, but the error comes from the fact
>>> that literal_eval permits a very few legal operations, and calling a
>>> fu
On 2017-02-27, Vincent Vande Vyvre wrote:
> Le 27/02/17 à 14:09, Chris Angelico a écrit :
>> The message is a little confusing, but the error comes from the fact
>> that literal_eval permits a very few legal operations, and calling a
>> function isn't one of them. So when you try to evaluate the "
On Tue, Feb 28, 2017 at 12:44 AM, Vincent Vande Vyvre
wrote:
> OK, it's coherent with the secure execution.
>
Yep. Here's a PR to make the message a bit clearer, though:
https://github.com/python/cpython/pull/340
>>> ast.literal_eval("print('hello world')")
Traceback (most recent call last):
Le 27/02/17 à 14:09, Chris Angelico a écrit :
On Mon, Feb 27, 2017 at 11:57 PM, Vincent Vande Vyvre
wrote:
I've this strange error:
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
import ast
l = "print('
Vincent Vande Vyvre writes:
> I've this strange error:
>
> Python 3.4.3 (default, Nov 17 2016, 01:08:31)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
import ast
l = "print('hello world')"
ast.literal_eval(l)
> Traceback (most recent
On Mon, Feb 27, 2017 at 11:57 PM, Vincent Vande Vyvre
wrote:
> I've this strange error:
>
> Python 3.4.3 (default, Nov 17 2016, 01:08:31)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
import ast
l = "print('hello world')"
ast.literal
I've this strange error:
Python 3.4.3 (default, Nov 17 2016, 01:08:31)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ast
>>> l = "print('hello world')"
>>> ast.literal_eval(l)
Traceback (most recent call last):
File "", line 1, in
File
14 matches
Mail list logo