Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2315)

Side by Side Diff: Doc/c-api/veryhigh.rst

Issue 10553: Add optimize argument to builtin compile() and byte-compilation modules
Patch Set: Created 2 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | Doc/library/compileall.rst » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 .. highlightlang:: c 1 .. highlightlang:: c
2 2
3 3
4 .. _veryhigh: 4 .. _veryhigh:
5 5
6 ************************* 6 *************************
7 The Very High Level Layer 7 The Very High Level Layer
8 ************************* 8 *************************
9 9
10 The functions in this chapter will let you execute Python source code given in a 10 The functions in this chapter will let you execute Python source code given in a
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 returns. 222 returns.
223 223
224 224
225 .. c:function:: PyObject* Py_CompileString(const char *str, const char *filename , int start) 225 .. c:function:: PyObject* Py_CompileString(const char *str, const char *filename , int start)
226 226
227 This is a simplified interface to :c:func:`Py_CompileStringFlags` below, leav ing 227 This is a simplified interface to :c:func:`Py_CompileStringFlags` below, leav ing
228 *flags* set to *NULL*. 228 *flags* set to *NULL*.
229 229
230 230
231 .. c:function:: PyObject* Py_CompileStringFlags(const char *str, const char *fil ename, int start, PyCompilerFlags *flags) 231 .. c:function:: PyObject* Py_CompileStringFlags(const char *str, const char *fil ename, int start, PyCompilerFlags *flags)
232
233 This is a simplified interface to :c:func:`Py_CompileStringExFlags` below, wi th
234 *optimize* set to ``-1``.
235
236
237 .. c:function:: PyObject* Py_CompileStringExFlags(const char *str, const char *f ilename, int start, PyCompilerFlags *flags, int optimize)
232 238
233 Parse and compile the Python source code in *str*, returning the resulting co de 239 Parse and compile the Python source code in *str*, returning the resulting co de
234 object. The start token is given by *start*; this can be used to constrain t he 240 object. The start token is given by *start*; this can be used to constrain t he
235 code which can be compiled and should be :const:`Py_eval_input`, 241 code which can be compiled and should be :const:`Py_eval_input`,
236 :const:`Py_file_input`, or :const:`Py_single_input`. The filename specified by 242 :const:`Py_file_input`, or :const:`Py_single_input`. The filename specified by
237 *filename* is used to construct the code object and may appear in tracebacks or 243 *filename* is used to construct the code object and may appear in tracebacks or
238 :exc:`SyntaxError` exception messages. This returns *NULL* if the code canno t 244 :exc:`SyntaxError` exception messages. This returns *NULL* if the code canno t
239 be parsed or compiled. 245 be parsed or compiled.
246
247 The integer *optimize* specifies the optimization level of the compiler; a
248 value of ``-1`` selects the optimization level of the interpreter as given by
249 :option:`-O` options. Explicit levels are ``0`` (no optimization;
250 ``__debug__`` is true), ``1`` (asserts are removed, ``__debug__`` is false)
251 or ``2`` (docstrings are removed too).
252
253 .. versionadded:: 3.2
240 254
241 255
242 .. c:function:: PyObject* PyEval_EvalCode(PyCodeObject *co, PyObject *globals, P yObject *locals) 256 .. c:function:: PyObject* PyEval_EvalCode(PyCodeObject *co, PyObject *globals, P yObject *locals)
243 257
244 This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just 258 This is a simplified interface to :c:func:`PyEval_EvalCodeEx`, with just
245 the code object, and the dictionaries of global and local variables. 259 the code object, and the dictionaries of global and local variables.
246 The other arguments are set to *NULL*. 260 The other arguments are set to *NULL*.
247 261
248 262
249 .. c:function:: PyObject* PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, P yObject **defs, int defcount, PyObject *closure) 263 .. c:function:: PyObject* PyEval_EvalCodeEx(PyCodeObject *co, PyObject *globals, PyObject *locals, PyObject **args, int argcount, PyObject **kws, int kwcount, P yObject **defs, int defcount, PyObject *closure)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 struct PyCompilerFlags { 330 struct PyCompilerFlags {
317 int cf_flags; 331 int cf_flags;
318 } 332 }
319 333
320 334
321 .. c:var:: int CO_FUTURE_DIVISION 335 .. c:var:: int CO_FUTURE_DIVISION
322 336
323 This bit can be set in *flags* to cause division operator ``/`` to be 337 This bit can be set in *flags* to cause division operator ``/`` to be
324 interpreted as "true division" according to :pep:`238`. 338 interpreted as "true division" according to :pep:`238`.
325 339
OLDNEW
« no previous file with comments | « no previous file | Doc/library/compileall.rst » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld cbc36f91f3f7