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.

classification
Title: Document ast.PyCF_ONLY_AST
Type: Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: rejected
Dependencies: Superseder:
Assigned To: docs@python Nosy List: BreamoreBoy, Ramchandra Apte, benjamin.peterson, docs@python, eric.araujo, terry.reedy
Priority: low Keywords: needs review, patch

Created on 2011-05-29 17:23 by eric.araujo, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
document-pycf-only-ast.diff eric.araujo, 2011-05-29 17:23
Messages (9)
msg137203 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-29 17:23
Title says it all.
msg137205 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-05-29 17:29
Use of PyCF_ONLY_AST be superseded by ast.parse.
msg137270 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-05-30 13:32
Okay.  I’ll make another patch to remove mentions of this flag then.
msg137590 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-06-03 21:30
This is a bit tricky. It may be superseded, but it is still there, is possible used in older code, has not been deprecated as far as I know, and appears in dir(ast).

The two current mentions of PyCF_ONLY_AST in ast doc are:

"An abstract syntax tree can be generated by passing ast.PyCF_ONLY_AST as a flag to the compile() built-in function, or using the parse() helper provided in this module." (near the top )

"ast.parse(source, filename='<unknown>', mode='exec') 
Parse the source into an AST node. Equivalent to compile(source, filename, mode, ast.PyCF_ONLY_AST)."

The first mention is referred to in the compile entry:

"compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1) 
Compile the source into a code or AST object. Code objects can be executed by exec() or eval(). source can either be a string or an AST object. Refer to the ast module documentation for information on how to work with AST objects."

In my view, it is adequately documented now, should not be undocumented, and should not be given more prominence either. So I recommend closing this.

Hmm. It should be indexed for anyone reading existing code. If possible, I would have the index point to the first current sentence, which also mentions .parse() as an alternative.
msg138330 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2011-06-14 15:26
Another bug requesting documentation for a compiler flag exposed by a module: #1612012.

> If possible, I would have the index point to the first current
> sentence, which also mentions .parse() as an alternative.
This should be possible: http://sphinx.pocoo.org/markup/para.html#directive-index
msg150946 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012-01-09 16:13
FWIW this issue was also noted by Terry in #4118, but there was no reply.
msg185018 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2013-03-22 23:41
PyCF_ONLY_AST is defined in pythonrun.h and referenced in bltinmodule.c, Python-ast.c and pythonrun.c.  Should it be documented or not?
msg185119 - (view) Author: Ramchandra Apte (Ramchandra Apte) * Date: 2013-03-24 06:42
> In my view, it is adequately documented now, should not be undocumented, and should not be given more prominence either. So I recommend closing this.
+1
msg185178 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013-03-25 02:46
No problem.
History
Date User Action Args
2022-04-11 14:57:17adminsetgithub: 56416
2013-03-25 02:46:54eric.araujosetstatus: open -> closed
resolution: rejected
messages: + msg185178

stage: patch review -> resolved
2013-03-24 06:42:00Ramchandra Aptesetnosy: + Ramchandra Apte
messages: + msg185119
2013-03-22 23:41:39BreamoreBoysetnosy: + BreamoreBoy
messages: + msg185018
2012-01-09 16:13:23eric.araujosetmessages: + msg150946
2011-06-14 15:26:37eric.araujosetmessages: + msg138330
2011-06-03 21:30:24terry.reedysetnosy: + terry.reedy
messages: + msg137590
2011-05-30 13:32:57eric.araujosetmessages: + msg137270
versions: - Python 3.1
2011-05-29 17:29:11benjamin.petersonsetpriority: normal -> low
nosy: + benjamin.peterson
messages: + msg137205

2011-05-29 17:23:49eric.araujocreate