Notice: While JavaScript is not essential for this website, your interaction with the content will be limited. Please turn JavaScript on for the full experience.
Compiler-SIG Compiler-SIG This SIG provides a forum for discussing compilation and program analysis issues. Unlike most SIGs, it does not have a specific mandate or deliverable. There are several independent projects to develop compilers, type checkers, and related tools. The CPython and JPython distributions also contain compilers, of course; future versions of these compilers will also be discussed on this sig. There will likely be some overlap between the types-sig and the co...
...compiler. For example, until recently flow control within the try-finally and with statements was managed by complicated bytecodes with context-dependent semantics. The control flow within those statements is now implemented in the compiler, making the interpreter simpler and faster. By implementing new features as AST transformations, the existing compiler can generate the bytecode for a feature without having to modify the interpreter. A stable interpreter is necessary if we are to improve the...
...compiler_flag attributes to the _Feature objects in __future__.py that contain the necessary bits, so one might write code such as: import __future__ def compile_generator(func_def): return compile(func_def, "<input>", "suite", __future__.generators.compiler_flag) A recent change means that these same bits can be used to tell if a code object was compiled with a given feature; for instance codeob.co_flags & __future__.generators.compiler_flag`` will be non-zero ...
...Compiler issues The compiler currently collects the names of all global variables in a module. These are names bound at the module level or bound in a class or function body that declares them to be global. The compiler would assign indices for each global name and add the names and indices of the globals to the module's code object. Each code object would then be bound irrevocably to the module it was defined in. (Not sure if there are some subtle problems with this.) For attributes of import...
...compiler may need to parse the module differently. Such decisions cannot be pushed off until runtime. For any given release, the compiler knows which feature names have been defined, and raises a compile-time error if a future_statement contains a feature not known to it [2]. The direct runtime semantics are the same as for any import statement: there is a standard module __future__.py, described later, and it will be imported in the usual way at the time the future_statement is executed. The i...
...compiler reaches the docstring "b's doc string" and thus assigns the string to __doc_b__. A possible solution to this problem would be resetting the name variable for all non-expression nodes in the compiler. Possible Problems Even though highly unlikely, attribute docstrings could get accidentally concatenated to the attribute's value: class C: x = "text" \ "x's docstring" The trailing slash would cause the Python compiler to concatenate the attribute value and the docstring. A ...
...compiler registers that memory with the arena, a single call to free the arena is all that is needed to completely free all memory used by the compiler. In general, unless you are working on the critical core of the compiler, memory management can be completely ignored. But if you are working at either the very beginning of the compiler or the end, you need to care about how the arena works. All code relating to the arena is in either Include/pyarena.h or Python/pyarena.c . PyArena_New() will ...
...compiler will issue a warning. Under future semantics, the compiler will raise a SyntaxError. bare exec in function scope The exec statement allows two optional expressions following the keyword "in" that specify the namespaces used for locals and globals. An exec statement that omits both of these namespaces is a bare exec. If a bare exec is used in the body of a free-in-nested function, the compiler will issue a warning. Under future semantics, the compiler will raise a SyntaxError. loc...
...compilers. In this project, the ability for Python to be embedded into other code worked very well. The documentation is excellent and the examples are easy to follow. However, the PowerPanel hardware has no hard disk and thus could not itself compile the Python interpreter's C sources. To work around this problem, the developers cross-compiled Python from another machine, producing object code for the PowerPC using a compiler running on another type of hardware. Once this was done, Python byte ...
...compiler operates on CPython bytecode, and as such, it is immune to Python language changes that affect only the parser. We recommend that changes to the CPython bytecode compiler or the semantics of individual bytecodes be prototyped in the interpreter loop first, then be ported to the JIT compiler once the semantics are clear. To make this easier, Unladen Swallow includes a --without-llvm configure-time option that strips out the JIT compiler and all associated infrastructure. This leaves the ...
...compiler, compiler flags, platform, default library directory, etc.). It must be easy for a module developer to create both source and built distributions. It must be easy for a third party (the "packager") to download a source distribution, build it on a particular platform, and create a built distribution for that platform which can then be trivially used by less sophisticated users of that platform. ...
PEP 3147 -- PYC Repository Directories PEP:3147 Title:PYC Repository Directories Author:Barry Warsaw <barry at python.org> Status:Final Type:Standards Track Created:16-Dec-2009 Python-Version:3.2 Post-History:30-Jan-2010, 25-Feb-2010, 03-Mar-2010, 12-Apr-2010 Resolution:https://mail.python.org/pipermail/python-dev/2010-April/099414.html Contents Abstract Background Rationale Proposal Examples Python behavior Case 0: The steady state Case 1: The first import Case 2: Th...
...compiler and support libraries, Python code runs more than fast enough for most applications. The traditional implementation of CPython uses a bytecode virtual machine; PyPy supports just-in-time (JIT) compilation to machine code. Also, Jython and IronPython (see below) support JIT compilation on their respective virtual machine implementations. Python plays well with others Python can integrate with COM, .NET, and CORBA objects. For Java libraries, use Jython, an implementation of Python for ...
...compiler's lack of visibility into the set of names that will be resolvable at runtime, but code linters and static type checkers would be encouraged to enforce the same "declaration or assignment required before use" behaviour for NAME := EXPR as the compiler would enforce at function scope. Postponing a decision on expression level target declarations At least for Python 3.8, usage of inline assignments (whether augmented or not) at function scope would always require a preceding name bindin...
...compiler will report a SyntaxError if "from ... import *" occurs in a function or class scope. The language reference has documented that this case is illegal, but the compiler never checked for it. The recent introduction of nested scope makes the meaning of this form of name binding ambiguous. In a future release, the compiler may allow this form when there is no possibility of ambiguity. repr(string) is easier to read, now using hex escapes instead of octal, and using t, n and r ...
PEP 3149 -- ABI version tagged .so files PEP:3149 Title:ABI version tagged .so files Author:Barry Warsaw <barry at python.org> Status:Final Type:Standards Track Created:09-Jul-2010 Python-Version:3.2 Post-History:14-Jul-2010, 22-Jul-2010 Resolution:https://mail.python.org/pipermail/python-dev/2010-September/103408.html Contents Abstract Background Rationale Proposal Proven approach Windows PEP 384 Alternatives Independent directories or symlinks Don't share packages wit...
PEP 215 -- String Interpolation PEP:215 Title:String Interpolation Author:ping at zesty.ca (Ka-Ping Yee) Status:Superseded Type:Standards Track Created:24-Jul-2000 Python-Version:2.1 Post-History: Superseded-By:292 Contents Abstract Copyright Specification Examples Discussion Security Issues Implementation References Abstract This document proposes a string interpolation feature for Python to allow easier string formatting. The suggested syntax change is the introduction ...
PEP 229 -- Using Distutils to Build Python PEP:229 Title:Using Distutils to Build Python Author:A.M. Kuchling <amk at amk.ca> Status:Final Type:Standards Track Created:16-Nov-2000 Post-History: Contents Introduction Proposal Implementation Unresolved Issues Copyright Introduction The Modules/Setup mechanism has some flaws: People have to remember to uncomment bits of Modules/Setup in order to get all the possible modules. Moving Setup to a new version of Python is ted...
...compiler_* functions to generate opcodes for your productions. You may need to regenerate Lib/symbol.py and/or Lib/token.py and/or Lib/keyword.py. The parser module. Add some of your new syntax to test_parser, bang on Modules/parsermodule.c until it passes. Add some usage of your new syntax to test_grammar.py. The compiler package. A good test is to compile the standard library and test suite with the compiler package and then check it runs. Note that this only needs to be done in Python 2.x....