summaryrefslogtreecommitdiffstats
path: root/Include/compile.h
Commit message (Collapse)AuthorAgeFilesLines
* bpo-35134: Add include/cpython/compile.h (GH-24922)Hai Shi2021-03-221-93/+9
| | | | Move C API excluded from the limited C API from Include/compile.h to a new Include/cpython/compile.h header file.
* bpo-40939: Remove the old parser (Part 2) (GH-21005)Lysandros Nikolaou2020-06-201-4/+0
| | | Remove some remaining files and Makefile targets for the old parser
* bpo-40421: Add Include/cpython/code.h header file (GH-19756)Victor Stinner2020-04-281-1/+0
| | | | | | | | | | | bpo-35134, bpo-40421: Add Include/cpython/code.h header file. code.h now defines PyCodeObject type in the limited C API. It is now included by Python.h. Give a name to the PyCodeObject structure: it is now called "struct PyCodeObject". So it becomes possible to define PyCodeObject as "struct PyCodeObject" in the limited C API without defining the structure.
* bpo-40334: PEP 617 implementation: New PEG parser for CPython (GH-19503)Pablo Galindo2020-04-221-0/+3
| | | | Co-authored-by: Guido van Rossum <guido@python.org> Co-authored-by: Lysandros Nikolaou <lisandrosnik@gmail.com>
* bpo-39562: Prevent collision of future and compiler flags (GH-19230)Batuhan Taşkaya2020-04-221-0/+6
| | | | | | The constant values of future flags in the __future__ module is updated in order to prevent collision with compiler flags. Previously PyCF_ALLOW_TOP_LEVEL_AWAIT was clashing with CO_FUTURE_DIVISION.
* bpo-39220: Do not optimise annotation if 'from __future__ import ↵Pablo Galindo2020-03-181-1/+6
| | | | | | annotations' is used (GH-17866) Do not apply AST-based optimizations if 'from __future__ import annotations' is used in order to prevent information lost in the final version of the annotations.
* bpo-37253: Add _PyCompilerFlags_INIT macro (GH-14018)Victor Stinner2019-06-131-0/+3
| | | | | Add a new _PyCompilerFlags_INIT macro to initialize PyCompilerFlags variables, rather than initializing cf_flags and cf_feature_version explicitly in each variable.
* bpo-34616: Add PyCF_ALLOW_TOP_LEVEL_AWAIT to allow top-level await (GH-13148)Matthias Bussonnier2019-05-211-0/+1
| | | Co-Authored-By: Yury Selivanov <yury@magic.io>
* bpo-35975: Support parsing earlier minor versions of Python 3 (GH-12086)Guido van Rossum2019-03-071-0/+1
| | | | | | | This adds a `feature_version` flag to `ast.parse()` (documented) and `compile()` (hidden) that allow tweaking the parser to support older versions of the grammar. In particular if `feature_version` is 5 or 6, the hacks for the `async` and `await` keyword from PEP 492 are reinstated. (For 7 or higher, these are unconditionally treated as keywords, but they are still special tokens rather than `NAME` tokens that the parser driver recognizes.) https://bugs.python.org/issue35975
* bpo-35766: Merge typed_ast back into CPython (GH-11645)Guido van Rossum2019-01-311-2/+3
|
* bpo-32455: Add jump parameter to dis.stack_effect(). (GH-6610)Serhiy Storchaka2018-09-181-0/+1
| | | | Add C API function PyCompile_OpcodeStackEffectWithJump().
* String annotations [PEP 563] (#4390)Guido van Rossum2018-01-261-1/+2
| | | | | | | | * Document `from __future__ import annotations` * Provide plumbing and tests for `from __future__ import annotations` * Implement unparsing the AST back to string form This is required for PEP 563 and as such only implements a part of the unparsing process that covers expressions.
* bpo-32372: Move __debug__ optimization to the AST level. (#4925)Serhiy Storchaka2017-12-251-1/+1
|
* bpo-29469: Move constant folding to AST optimizer (GH-2858)INADA Naoki2017-12-141-0/+2
|
* bpo-22257: Small changes for PEP 432. (#1728)Eric Snow2017-05-231-0/+17
| | | PEP 432 specifies a number of large changes to interpreter startup code, including exposing a cleaner C-API. The major changes depend on a number of smaller changes. This patch includes all those smaller changes.
* PEP 479: Change StopIteration handling inside generators.Yury Selivanov2015-05-091-0/+1
| | | | Closes issue #22906.
* Issue #19722: Added opcode.stack_effect(), which accuratelyLarry Hastings2013-11-231-0/+3
| | | | computes the stack effect of bytecode instructions.
* Close #11619: The parser and the import machinery do not encode UnicodeVictor Stinner2013-08-261-1/+14
| | | | filenames anymore on Windows.
* Move code related to compile from Python.h to compile.hVictor Stinner2011-09-281-2/+12
|
* Issue #9738: Ooops, fix typos in my previous commit (r87506)Victor Stinner2010-12-271-1/+1
|
* Issue #9738: Document encodings of AST, compiler, parser and PyRun functionsVictor Stinner2010-12-271-2/+6
|
* Add an "optimize" parameter to compile() to control the optimization level, ↵Georg Brandl2010-12-041-2/+3
| | | | and provide an interface to it in py_compile, compileall and PyZipFile.
* Merge branches/pep-0384.Martin v. Löwis2010-12-031-1/+2
|
* The BDFL has retired! Long live the FLUFL (Friendly Language Uncle For Life)!Brett Cannon2009-04-011-0/+1
|
* Merged revisions 67028,67040,67044,67046,67052,67065,67070,67077,67082 via ↵Benjamin Peterson2008-11-031-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r67028 | benjamin.peterson | 2008-10-25 18:27:07 -0500 (Sat, 25 Oct 2008) | 1 line don't use a catch-all ........ r67040 | armin.rigo | 2008-10-28 12:01:21 -0500 (Tue, 28 Oct 2008) | 5 lines Fix one of the tests: it relied on being present in an "output test" in order to actually test what it was supposed to test, i.e. that the code in the __del__ method did not crash. Use instead the new helper test_support.captured_output(). ........ r67044 | amaury.forgeotdarc | 2008-10-29 18:15:57 -0500 (Wed, 29 Oct 2008) | 3 lines Correct error message in io.open(): closefd=True is the only accepted value with a file name. ........ r67046 | thomas.heller | 2008-10-30 15:18:13 -0500 (Thu, 30 Oct 2008) | 2 lines Fixed a modulefinder crash on certain relative imports. ........ r67052 | christian.heimes | 2008-10-30 16:26:15 -0500 (Thu, 30 Oct 2008) | 1 line Issue #4237: io.FileIO() was raising invalid warnings caused by insufficient initialization of PyFileIOObject struct members. ........ r67065 | benjamin.peterson | 2008-10-30 18:59:18 -0500 (Thu, 30 Oct 2008) | 1 line move unprefixed error into .c file ........ r67070 | benjamin.peterson | 2008-10-31 15:41:44 -0500 (Fri, 31 Oct 2008) | 1 line rephrase has_key doc ........ r67077 | benjamin.peterson | 2008-11-03 09:14:51 -0600 (Mon, 03 Nov 2008) | 1 line #4048 make the parser module accept relative imports as valid ........ r67082 | hirokazu.yamamoto | 2008-11-03 12:03:06 -0600 (Mon, 03 Nov 2008) | 2 lines Issue #3774: Fixed an error when create a Tkinter menu item without command and then remove it. Written by Guilherme Polo (gpolo). ........
* Merged revisions 61952-61953 via svnmerge fromChristian Heimes2008-03-261-0/+1
| | | | | | | | | | | | | | | | svn+ssh://pythondev@svn.python.org/python/trunk ........ r61952 | mark.dickinson | 2008-03-26 22:41:36 +0100 (Wed, 26 Mar 2008) | 2 lines Typo: "objects reference count" -> "object's reference count" ........ r61953 | christian.heimes | 2008-03-26 23:01:37 +0100 (Wed, 26 Mar 2008) | 4 lines Patch #2477: Added from __future__ import unicode_literals The new PyParser_*Ex() functions are based on Neal's suggestion and initial patch. The new __future__ feature makes all '' and r'' unicode strings. b'' and br'' stay (byte) strings. ........
* Add __future__ import for print_function. It's a no-op in 3.0, but it needs ↵Eric Smith2008-03-201-0/+1
| | | | | | to not be a syntax error. Closes issue 2436.
* Merge p3yk branch with the trunk up to revision 45595. This breaks a fairThomas Wouters2006-04-211-1/+1
| | | | | | | | | | | | | | | | | | | | number of tests, all because of the codecs/_multibytecodecs issue described here (it's not a Py3K issue, just something Py3K discovers): http://mail.python.org/pipermail/python-dev/2006-April/064051.html Hye-Shik Chang promised to look for a fix, so no need to fix it here. The tests that are expected to break are: test_codecencodings_cn test_codecencodings_hk test_codecencodings_jp test_codecencodings_kr test_codecencodings_tw test_codecs test_multibytecodec This merge fixes an actual test failure (test_weakref) in this branch, though, so I believe merging is the right thing to do anyway.
* Move #include to outside "extern C {}", before Tim figures out it'll breakThomas Wouters2006-02-281-2/+3
| | | | VC++.
* Include code.h more sanely.Thomas Wouters2006-02-281-3/+2
|
* from __future__ import with_statement addon for 'with', mostly written byThomas Wouters2006-02-281-0/+1
| | | | Neal.
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-0/+1
| | | | | | | | | | | | | | | | | | | | | | | - IMPORT_NAME takes an extra argument from the stack: the relativeness of the import. Only passed to __import__ when it's not -1. - __import__() takes an optional 5th argument for the same thing; it __defaults to -1 (old semantics: try relative, then absolute) - 'from . import name' imports name (be it module or regular attribute) from the current module's *package*. Likewise, 'from .module import name' will import name from a sibling to the current module. - Importing from outside a package is not allowed; 'from . import sys' in a toplevel module will not work, nor will 'from .. import sys' in a (single-level) package. - 'from __future__ import absolute_import' will turn on the new semantics for import and from-import: imports will be absolute, except for from-import with dots. Includes tests for regular imports and importhooks, parser changes and a NEWS item, but no compiler-package changes or documentation changes.
* Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,Neal Norwitz2005-12-171-1/+1
| | | | simplifies a lot of error handling code, and fixes many memory leaks.
* use PyAPI_FUNC instead of DL_IMPORT. are we going to deprecate the old ↵Neal Norwitz2005-10-231-2/+2
| | | | non-Py PREFIXED macros, etc?
* Fix a bunch of imports to use code.h instead of compile.h.Jeremy Hylton2005-10-211-5/+0
| | | | Remove duplicate declarations from compile.h
* Merge ast-branch to headJeremy Hylton2005-10-201-58/+13
| | | | | | | | | | This change implements a new bytecode compiler, based on a transformation of the parse tree to an abstract syntax defined in Parser/Python.asdl. The compiler implementation is not complete, but it is in stable enough shape to run the entire test suite excepting two disabled tests.
* This is my patch #876198 plus a NEWS entry and a header frob.Michael W. Hudson2004-02-121-5/+0
| | | | | Remove the ability to use (from C) arbitrary objects supporting the read buffer interface as the co_code member of code objects.
* Small function call optimization and special build option for call stats.Jeremy Hylton2003-02-051-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | -DCALL_PROFILE: Count the number of function calls executed. When this symbol is defined, the ceval mainloop and helper functions count the number of function calls made. It keeps detailed statistics about what kind of object was called and whether the call hit any of the special fast paths in the code. Optimization: When we take the fast_function() path, which seems to be taken for most function calls, and there is minimal frame setup to do, avoid call PyEval_EvalCodeEx(). The eval code ex function does a lot of work to handle keywords args and star args, free variables, generators, etc. The inlined version simply allocates the frame and copies the arguments values into the frame. The optimization gets a little help from compile.c which adds a CO_NOFREE flag to code objects that don't have free variables or cell variables. This change allows fast_function() to get into the fast path with fewer tests. I measure a couple of percent speedup in pystone with this change, but there's surely more that can be done.
* Constify filenames and scripts. Fixes #651362.Martin v. Löwis2002-12-111-3/+3
|
* Excise DL_EXPORT from Include.Mark Hammond2002-08-121-6/+6
| | | | Thanks to Skip Montanaro and Kalle Svensson for the patches.
* Removed more hair in support of future-generator stmts.Tim Peters2002-04-121-1/+1
|
* Add helper macro to get the number of free variables for a PyCodeObject.Jeremy Hylton2001-12-131-0/+1
|
* Refactor future feature handlingJeremy Hylton2001-08-101-9/+1
| | | | | | | | | | | | | | | | | | | Replace individual slots in PyFutureFeatures with a single bitmask with one field per feature. The flags for this bitmask are the same as the flags used in the co_flags slot of a code object. XXX This means we waste several bits, because they are used for co_flags but have no meaning for future statements. Don't think this is an issue. Remove the NESTED_SCOPES_DEFAULT define and others. Not sure what they were for anyway. Remove all the PyCF_xxx flags, but define PyCF_MASK in terms of the CO_xxx flags that are relevant for this release. Change definition of PyCompilerFlags so that cf_flags matches co_flags.
* Implement PEP 238 in its (almost) full glory.Guido van Rossum2001-08-081-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | This introduces: - A new operator // that means floor division (the kind of division where 1/2 is 0). - The "future division" statement ("from __future__ import division) which changes the meaning of the / operator to implement "true division" (where 1/2 is 0.5). - New overloadable operators __truediv__ and __floordiv__. - New slots in the PyNumberMethods struct for true and floor division, new abstract APIs for them, new opcodes, and so on. I emphasize that without the future division statement, the semantics of / will remain unchanged until Python 3.0. Not yet implemented are warnings (default off) when / is used with int or long arguments. This has been on display since 7/31 as SF patch #443474. Flames to /dev/null.
* Part way to allowing "from __future__ import generators" to communicateTim Peters2001-07-161-0/+8
| | | | | | | | | | that info to code dynamically compiled *by* code compiled with generators enabled. Doesn't yet work because there's still no way to tell the parser that "yield" is OK (unlike nested_scopes, the parser has its fingers in this too). Replaced PyEval_GetNestedScopes by a more-general PyEval_MergeCompilerFlags. Perhaps I should not have? I doubted it was *intended* to be part of the public API, so just did.
* Preliminary support for "from __future__ import generators" to enableGuido van Rossum2001-07-151-0/+3
| | | | | | | | the yield statement. I figure we have to have this in before I can release 2.2a1 on Wednesday. Note: test_generators is currently broken, I'm counting on Tim to fix this.
* Enable nested scopes by default.Guido van Rossum2001-07-121-1/+1
| | | | | | | | | | | Although this is a one-character change, more work needs to be done: the compiler can get rid of a lot of non-nested-scopes code, the documentation needs to be updated, the future statement can be simplified, etc. But this change enables the nested scope semantics everywhere, and that's the important part -- we can now test code for compatibility with nested scopes by default.
* Merging the gen-branch into the main line, at Guido's direction. Yay!Tim Peters2001-06-181-0/+1
| | | | | Bugfix candidate in inspect.py: it was referencing "self" outside of a method.
* If a code object is compiled with nested scopes, define the CO_NESTED flag.Jeremy Hylton2001-03-221-0/+1
| | | | | Add PyEval_GetNestedScopes() which returns a non-zero value if the code for the current interpreter frame has CO_NESTED defined.
* Useful future statement support for the interactive interpreterJeremy Hylton2001-03-011-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | (Also remove warning about module-level global decl, because we can't distinguish from code passed to exec.) Define PyCompilerFlags type contains a single element, cf_nested_scopes, that is true if a nested scopes future statement has been entered at the interactive prompt. New API functions: PyNode_CompileFlags() PyRun_InteractiveOneFlags() -- same as their non Flags counterparts except that the take an optional PyCompilerFlags pointer compile.c: In jcompile() use PyCompilerFlags argument. If cf_nested_scopes is true, compile code with nested scopes. If it is false, but the code has a valid future nested scopes statement, set it to true. pythonrun.c: Create a new PyCompilerFlags object in PyRun_InteractiveLoop() and thread it through to PyRun_InteractiveOneFlags().