summaryrefslogtreecommitdiffstats
path: root/Lib/compiler/pycodegen.py
Commit message (Collapse)AuthorAgeFilesLines
* Issue #2333: Backport set and dict comprehensions syntax.Alexandre Vassalotti2010-01-111-0/+49
|
* Issue #2335: Backport set literals syntax from Python 3.x.Alexandre Vassalotti2010-01-091-0/+6
|
* Issue #7092: Fix the DeprecationWarnings emitted by the standard libraryAntoine Pitrou2010-01-041-2/+2
| | | | when using the -3 flag. Patch by Florent Xicluna.
* Backport r69961 to trunk, replacing JUMP_IF_{TRUE,FALSE} withJeffrey Yasskin2009-02-281-35/+12
| | | | | | POP_JUMP_IF_{TRUE,FALSE} and JUMP_IF_{TRUE,FALSE}_OR_POP. This avoids executing a POP_TOP on each conditional and sometimes allows the peephole optimizer to skip a JUMP_ABSOLUTE entirely. It speeds up list comprehensions significantly.
* Issue #999042: The Python compiler now handles explict global statementsNeil Schemenauer2009-02-071-2/+5
| | | | | correctly (should be assigned using STORE_GLOBAL opcode). This was done by having the system table differentiate between explict and implicit globals.
* Make names generated for 'with' variables match the built-in compiler.Neil Schemenauer2009-02-071-1/+1
|
* Overhaul Lib/compiler block ordering. The previous code was filled withNeil Schemenauer2009-02-061-1/+1
| | | | | | hacks. The new code is based on issue #2472 posted by Antoine Pitrou. I did some further cleanups of the pyassem code and optimized the block ordering pass.
* Issue #2183: Simplify and optimize bytecode for list comprehensions.Antoine Pitrou2008-12-171-11/+1
|
* Fixed compiler module so __future__ print_function is compilable.Eric Smith2008-03-191-1/+3
|
* Speed up with statements by storing the __exit__ method on the stack instead ↵Nick Coghlan2008-03-071-4/+1
| | | | of in a temp variable (bumps the magic number for pyc files)
* Patch #1638243: the compiler package is now able to correctly compileGeorg Brandl2007-01-271-0/+2
| | | | | a with statement; previously, executing code containing a with statement compiled by the compiler package crashed the interpreter.
* Remove trailing comma.Georg Brandl2006-10-291-1/+1
|
* Bug #1586448: the compiler module now emits the same bytecode forGeorg Brandl2006-10-291-7/+5
| | | | | list comprehensions as the builtin compiler, using the LIST_APPEND opcode.
* Fix a bug in the ``compiler`` package that caused invalid code to beNeil Schemenauer2006-08-161-5/+14
| | | | generated for generator expressions.
* Fix the 'compiler' package to generate correct code for MAKE_CLOSURE.Neil Schemenauer2006-08-041-26/+13
| | | | | | In the 2.5 development cycle, MAKE_CLOSURE as changed to take free variables as a tuple rather than as individual items on the stack. Closes patch #1534084.
* Get rid of __context__, per the latest changes to PEP 343 and python-devGuido van Rossum2006-05-021-2/+0
| | | | | | | | discussion. There are two places of documentation that still mention __context__: Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without spending a whole lot of time thinking about it; and whatsnew, which Andrew usually likes to change himself.
* Teach the compiler module about augmented assignment to tuple subscriptsNick Coghlan2006-03-141-4/+2
|
* Um, I thought I'd already checked this in.Guido van Rossum2006-03-101-2/+0
| | | | | | | Anyway, this is the changes to the with-statement so that __exit__ must return a true value in order for a pending exception to be ignored. The PEP (343) is already updated.
* Fix compiler breakage related to absolute importsNeal Norwitz2006-03-031-2/+2
|
* Hopefully this removes all vestiges of CO_GENERATOR_ALLOWED that canNeal Norwitz2006-03-031-3/+1
| | | | be removed in 2.x.
* Add support for absolute/relative imports and if/else expressions:Thomas Wouters2006-03-031-2/+26
| | | | | | | | | - regenerate ast.py - add future flags for absolute-import and with-statement so they (hopefully) properly get set in code-object flags - try out if/else expressions in actual code for the hell of it. Seems to generate the same kind of bytecode as the normal compiler.
* Update the compiler package to compile the with-statement.Guido van Rossum2006-02-281-0/+41
| | | | Jeremy, please review!
* No need for types, use isinstanceNeal Norwitz2005-11-251-5/+4
|
* Whitespace normalization.Tim Peters2004-08-201-1/+1
|
* This is Mark Russell's patch:Michael W. Hudson2004-08-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ 1009560 ] Fix @decorator evaluation order From the description: Changes in this patch: - Change Grammar/Grammar to require newlines between adjacent decorators. - Fix order of evaluation of decorators in the C (compile.c) and python (Lib/compiler/pycodegen.py) compilers - Add better order of evaluation check to test_decorators.py (test_eval_order) - Update the decorator documentation in the reference manual (improve description of evaluation order and update syntax description) and the comment: Used Brett's evaluation order (see http://mail.python.org/pipermail/python-dev/2004-August/047835.html) (I'm checking this in for Anthony who was having problems getting SF to talk to him)
* SF patch 836879.Jeremy Hylton2004-08-071-21/+19
| | | | Don't generate code for asserts in -O mode.
* Whitespace normalization.Tim Peters2004-08-041-2/+2
|
* PEP-0318, @decorator-style. In Guido's words:Anthony Baxter2004-08-021-0/+10
| | | | | "@ seems the syntax that everybody can hate equally" Implementation by Mark Russell, from SF #979728.
* Whitespace normalization.Tim Peters2004-07-071-1/+1
|
* SF patch #872326: Generator expression implementationRaymond Hettinger2004-05-191-0/+89
| | | | | | | | | | | | | | (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
* Remove unused instance attributes.Neil Schemenauer2004-03-211-2/+0
|
* Jacob Hallen cornered me here at EuroPython and got me to look atMichael W. Hudson2003-06-271-1/+5
| | | | | | | | | | patch: [ 750008 ] 'compiler' module bug with 'import foo.bar as baz' which I'm now checking in. after import foo.bar as baz, baz would refer to foo.
* Replace all but one explicit emit('SET_LINENO') with call to set_lineno().Jeremy Hylton2002-12-311-8/+2
| | | | | | Remove broken code in visitDict(). I assume the code was trying to add set lineno events for each line of a dict constructor, but I think it was using the wrong object (node instead of k or v).
* SF patch [ 597919 ] compiler package and SET_LINENOJeremy Hylton2002-12-311-27/+28
| | | | | | | | | | | | | | | | | A variety of changes from Michael Hudson to get the compiler working with 2.3. The primary change is the handling of SET_LINENO: # The set_lineno() function and the explicit emit() calls for # SET_LINENO below are only used to generate the line number table. # As of Python 2.3, the interpreter does not have a SET_LINENO # instruction. pyassem treats SET_LINENO opcodes as a special case. A few other small changes: - Remove unused code from pycodegen and pyassem. - Fix error handling in parsermodule. When PyParser_SimplerParseString() fails, it sets an exception with detailed info. The parsermodule was clobbering that exception and replacing it was a generic "could not parse string" exception. Keep the original exception.
* Fixing bugGustavo Niemeyer2002-12-161-2/+2
| | | | | | | | | | | | | | | | | | [#448679] Left to right * Python/compile.c (com_dictmaker): Reordered evaluation of dictionaries to follow strict LTR evaluation. * Lib/compiler/pycodegen.py (CodeGenerator.visitDict): Reordered evaluation of dictionaries to follow strict LTR evaluation. * Doc/ref/ref5.tex Documented the general LTR evaluation order idea. * Misc/NEWS Documented change in evaluation order of dictionaries.
* Remove uses of string module and stat.ST_MODENeal Norwitz2002-06-061-5/+3
|
* Whitespace normalization.Tim Peters2002-02-161-1/+1
|
* Merge of the release22 branch changes back into the trunk.Barry Warsaw2001-12-211-3/+9
|
* Fix [ #484645 ] little bug in pycodegen.pyJeremy Hylton2001-11-271-1/+1
|
* Fix SF bug #479186: compiler generates bad code for "del"Jeremy Hylton2001-11-091-0/+1
| | | | | | | Fix by Neil Schemenauer. Visit the Subscript node when trying to find the operation for a statement. XXX Not sure if there are other nodes that should be visited.
* Whitespace normalization.Tim Peters2001-10-181-19/+19
|
* API change:Jeremy Hylton2001-09-171-5/+95
| | | | | | | | | | | | | | | | | | compile() becomes replacement for builtin compile() compileFile() generates a .pyc from a .py both are exported in __init__ compiler.parse() gets optional second argument to specify compilation mode, e.g. single, eval, exec Add AbstractCompileMode as parent class and Module, Expression, and Interactive as concrete subclasses. Each corresponds to a compilation mode. THe AbstractCompileMode instances in turn delegate to CodeGeneration subclasses specialized for their particular functions -- ModuleCodeGenerator, ExpressionCodeGeneration, InteractiveCodeGenerator.
* Last set of change to get regression tests to passJeremy Hylton2001-09-171-1/+1
| | | | | | | | | | | Remove the only test in the syntax module. It ends up that the transformer must handle this error case. In the transformer, check for a list compression in com_assign_list() by looking for a list_for node where a comma is expected. In pycodegen.compile() re-raise the SyntaxError rather than catching it and exiting
* Handle more syntax errors.Jeremy Hylton2001-09-171-29/+32
| | | | | | | | Invoke compiler.syntax.check() after building AST. If a SyntaxError occurs, print the error and exit without generating a .pyc file. Refactor code to use compiler.misc.set_filename() rather than passing filename argument around to each CodeGenerator instance.
* support true divisionJeremy Hylton2001-09-171-1/+3
|
* Add code generator for yield stmtJeremy Hylton2001-09-141-0/+5
|
* Various sundry changes for 2.2 compatibilityJeremy Hylton2001-09-141-133/+89
| | | | | | | | | | | | | | | Remove the option to have nested scopes or old LGB scopes. This has a large impact on the code base, by removing the need for two variants of each CodeGenerator. Add a get_module() method to CodeGenerator objects, used to get the future features for the current module. Set CO_GENERATOR, CO_GENERATOR_ALLOWED, and CO_FUTURE_DIVISION flags as appropriate. Attempt to fix the value of nlocals in newCodeObject(), assuming that nlocals is 0 if CO_NEWLOCALS is not defined.
* Fix _convert_NAME() so that it doesn't store locals for class bodies.Jeremy Hylton2001-08-301-4/+7
| | | | | | | | | Fix list comp code generation -- emit GET_ITER instead of Const(0) after the list. Add CO_GENERATOR flag to generators. Get CO_xxx flags from the new module
* spurious popJeremy Hylton2001-08-301-1/+0
|
* Track the block stack more reasonably in order to handle continue inJeremy Hylton2001-08-291-13/+45
| | | | | | | | try/except or try/finally. Previous versions had only track SETUP_LOOP blocks and ignored the exception part. This meant that it allowed continue inside a try/except but generated buggy code. Now it does the right thing.