[issue13677] correct docstring for builtin compile
New submission from Jim Jewett <jimjjewett@gmail.com>: The current docstring for compile suggests that the flags are strictly for selecting future statements. These are not the only flags. It also suggests that the source must be source code and the result will be bytecode, which isn't quite true. I suggest changing: "The flags argument, if present, controls which future statements influence the compilation of the code." to: "The flags argument, if present, largely controls which future statements influence the compilation of the code. (Additional flags are documented in the AST module.)" ---------- assignee: docs@python components: Documentation files: bltinmodule.c.patch keywords: patch messages: 150337 nosy: Jim.Jewett, docs@python priority: normal severity: normal status: open title: correct docstring for builtin compile type: behavior Added file: http://bugs.python.org/file24105/bltinmodule.c.patch _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13677> _______________________________________
Terry J. Reedy <tjreedy@udel.edu> added the comment: Flags comment applies to 3.2.2 docs and 2.7.2 docs. There is only one additional flag: ast.PyCF_ONLY_AST, so 'flags' should be singular. As for src and dst, doc has been updated to say 'Compile the source into a code or AST object. ... source can either be a string or an AST object. 'source' should be capitalized. ---------- nosy: +terry.reedy versions: +Python 2.7, Python 3.2, Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13677> _______________________________________
Jim Jewett <jimjjewett@gmail.com> added the comment: I'm not sure we're looking at the same thing. I was talking about the docstring that shows up at the interactive prompt in response to
help(compile)
Going to hg.python.org/cpython and selecting branches, then default, then browse, got me to http://hg.python.org/cpython/file/7010fa9bd190/Python/bltinmodule.c which still doesn't mention AST. I also don't see any reference to "src" or "dst", or any "source" that looks like it should be capitalized. I agree that there is (to my knowledge, at this time) only one additional flag. I figured ast or future was needed to get the compilation constants, so it made sense to delegate -- but you seem to be reading something newer than I am. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13677> _______________________________________
Terry J. Reedy <tjreedy@udel.edu> added the comment: I am aware that the docstring, shown at help(compile), is what you were talking about. The docstring and manuals should say the same thing, or at least not contradict each other, so it is common for both to be out of date and both to be updated at the same time. So I went and looked at the current py2 and py3 docs to see if they also need change. And they do, though not quite as much. src and dst were unofficial abbreviations for source and output, in reference to what you said. Sorry for the confusion. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13677> _______________________________________
Changes by Éric Araujo <merwok@netwok.org>: ---------- nosy: +eric.araujo _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13677> _______________________________________
Éric Araujo <merwok@netwok.org> added the comment: The compiler flags are not really documented in the ast module doc or anywhere: see #12207 and #1612012. ---------- _______________________________________ Python tracker <report@bugs.python.org> <http://bugs.python.org/issue13677> _______________________________________
Change by Serhiy Storchaka <storchaka+cpython@gmail.com>: ---------- versions: +Python 3.6, Python 3.7, Python 3.8 -Python 3.2, Python 3.3 _______________________________________ Python tracker <report@bugs.python.org> <https://bugs.python.org/issue13677> _______________________________________
participants (4)
-
Jim Jewett
-
Serhiy Storchaka
-
Terry J. Reedy
-
Éric Araujo