[issue34431] Docs does not eval allows code object as argument

2020-05-17 Thread Furkan Onder


Furkan Onder  added the comment:

Hi Jonathan,
Are you still planning to work on the patch?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2020-05-08 Thread Furkan Onder


Change by Furkan Onder :


--
keywords: +patch
nosy: +furkanonder
nosy_count: 4.0 -> 5.0
pull_requests: +19313
stage: needs patch -> patch review
pull_request: https://github.com/python/cpython/pull/2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2019-01-07 Thread Jonathan Fine


Jonathan Fine  added the comment:

This graceful reminder is most welcome. At present, it's not help I'm short of, 
but time. I've given myself a reminder, to spend time on this before the end of 
this month (January 2019).

Once again, thank you for this reminder. This is something I want to do. It 
would be my first Python contribution.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2019-01-05 Thread Cheryl Sabella


Cheryl Sabella  added the comment:

Hi Jonathan,

Did you have any additional questions about opening a pull request for these 
changes?  Thanks!

--
nosy: +cheryl.sabella

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Jonathan Fine


Jonathan Fine  added the comment:

OK. I'll do as you say. I've just signed the CLA.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Berker Peksag


Berker Peksag  added the comment:

Ok, I think it would be a good idea to mention that the function accepts a code 
object in the first sentence. I'd be happy to review such PR. The eval() 
documentation is located at 
https://github.com/python/cpython/blob/master/Doc/library/functions.rst

See https://devguide.python.org/ for more details about the contribution 
process.

Note that you need to sign the CLA in order to contribute to Python: 
https://www.python.org/psf/contrib/contrib-form/

#22057 and #25810 are out of scope for this issue, so let's not discuss them 
here.

--
resolution: not a bug -> 
stage:  -> needs patch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Jonathan Fine


Jonathan Fine  added the comment:

Summary: There's my problem, and others. I'm willing to provide a patch, if 
supported.

There's a gotcha here. I fell into it. The docs for eval state
===
eval(expression, globals=None, locals=None)
The arguments are a string and optional globals and locals.
===
I read this and concluded, fairly I think, that I'm not allowed to pass in a 
code object [1]. So I didn't read any further. I'd already got the answer to my 
question.

But I knew that exec would take a code object, so I had doubt, and did my 
little experiment.

I'd prefer something more like exec, which says
===
This function supports dynamic execution of Python code. object must be either 
a string or a code object.
===

There are other problems, such as not agreeing with the help(eval) etc messages 
(and the still open #22057, #25810):
===
eval(source, globals=None, locals=None, /)
Evaluate the given source in the context of globals and locals.

The source may be a string representing a Python expression
or a code object as returned by compile().
The globals must be a dictionary and locals can be any mapping,
defaulting to the current globals and locals.
If only globals is given, locals defaults to it.
===
exec(source, globals=None, locals=None, /)
Execute the given source in the context of globals and locals.

The source may be a string representing one or more Python statements
or a code object as returned by compile().
The globals must be a dictionary and locals can be any mapping,
defaulting to the current globals and locals.
If only globals is given, locals defaults to it.
===

Finally, I'm willing to provide a patch, if supported. (I've not contributed to 
Python before.)

[1] I'd just read the docs for exec, which is up-front about 'string or code'.

--
status: pending -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Berker Peksag


Berker Peksag  added the comment:

Thank you for your report.

Quoting from https://docs.python.org/3.6/library/functions.html#eval

This function can also be used to execute arbitrary code objects
(such as those created by compile()). In this case pass a code
object instead of a string.

So, your example is already documented as a legal way of using the eval() 
function.

I don't see anything wrong here.

--
nosy: +berker.peksag
resolution:  -> not a bug
status: open -> pending
type:  -> behavior
versions:  -Python 3.4, Python 3.5

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue34431] Docs does not eval allows code object as argument

2018-08-18 Thread Jonathan Fine


New submission from Jonathan Fine :

See https://docs.python.org/3.6/library/functions.html#eval
This says the following won't happen. But it does.

Python 3.6.2 (default, Jul 29 2017, 00:00:00) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> def fn(): print(3); return 4
... 
>>> eval(fn.__code__)
3
4

Compare with https://docs.python.org/3.6/library/functions.html#exec

Search for eval in title of open issues bring up related

#22057 (The doc say all globals are copied on eval(), but only __builtins__ is 
copied)
#25810 (Python 3 documentation for eval is incorrect)

--
assignee: docs@python
components: Documentation
messages: 323716
nosy: docs@python, jfine2358
priority: normal
severity: normal
status: open
title: Docs does not eval allows code object as argument
versions: Python 2.7, Python 3.4, Python 3.5, Python 3.6, Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com