Brett Cannon
6192df10b6
Deprecate the compiler package for removal in 3.0.
2008-05-10 02:58:26 +00:00
Neal Norwitz
311d071541
Fix test_compiler after adding unicode_literals
2008-03-27 05:02:57 +00:00
Eric Smith
5d5c63f462
Fixed compiler module so __future__ print_function is compilable.
2008-03-19 02:11:30 +00:00
Nick Coghlan
7af53be66f
Speed up with statements by storing the __exit__ method on the stack instead of in a temp variable (bumps the magic number for pyc files)
2008-03-07 14:13:28 +00:00
Facundo Batista
4219da4bd0
Issue 2117. Update compiler module to handle class decorators.
...
Thanks Thomas Herve
2008-02-25 18:06:00 +00:00
Christian Heimes
c5f05e45cf
Patch #2167 from calvin: Remove unused imports
2008-02-23 17:40:11 +00:00
Christian Heimes
c756d00cf2
Replaced import of the 'new' module with 'types' module and added a deprecation warning to the 'new' module.
2007-11-27 21:34:01 +00:00
Collin Winter
6290305e67
Backport PEP 3110's new 'except' syntax to 2.6.
2007-05-18 23:11:24 +00:00
Georg Brandl
ab49684f55
Patch #1638243 : the compiler package is now able to correctly compile
...
a with statement; previously, executing code containing a with statement
compiled by the compiler package crashed the interpreter.
2007-01-27 17:43:02 +00:00
Georg Brandl
fe9c71bcd3
Remove trailing comma.
2006-10-29 09:01:01 +00:00
Georg Brandl
5addf70078
Bug #1586448 : the compiler module now emits the same bytecode for
...
list comprehensions as the builtin compiler, using the LIST_APPEND
opcode.
2006-10-29 08:53:06 +00:00
Neil Schemenauer
4c6b0d5bec
Fix a bug in the ``compiler`` package that caused invalid code to be
...
generated for generator expressions.
2006-08-16 23:38:05 +00:00
Neil Schemenauer
06ded09d40
Fix the 'compiler' package to generate correct code for MAKE_CLOSURE.
...
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 .
2006-08-04 16:20:30 +00:00
Georg Brandl
afcd838f1f
Revert rev 42617, it was introduced to work around bug #1441397 .
...
test_compiler now passes again.
2006-07-29 10:25:46 +00:00
Georg Brandl
edd9b0dfb3
Bug #1441397 : The compiler module now recognizes module and function
...
docstrings correctly as it did in Python 2.4.
2006-07-29 09:33:26 +00:00
Tim Peters
3249d00f4d
Whitespace normalization.
2006-06-27 11:52:49 +00:00
Georg Brandl
c3f49ca558
Set lineno correctly on list, tuple and dict literals.
2006-06-22 14:46:17 +00:00
Georg Brandl
ad29e637d8
fix [ 1509132 ] compiler module builds incorrect AST for TryExceptFinally
2006-06-21 17:45:17 +00:00
Neal Norwitz
6aaccc6b55
Fix errors found by pychecker
2006-06-11 08:35:14 +00:00
Georg Brandl
1bb6230930
Bug #1385040 : don't allow "def foo(a=1, b): pass" in the compiler package.
2006-05-03 18:18:32 +00:00
Guido van Rossum
da5b701aee
Get rid of __context__, per the latest changes to PEP 343 and python-dev
...
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.
2006-05-02 19:47:52 +00:00
Neal Norwitz
b902f4e401
Use absolute imports
2006-04-03 04:45:34 +00:00
Nick Coghlan
cb35b95f86
Teach the compiler module about augmented assignment to tuple subscripts
2006-03-14 13:21:14 +00:00
Guido van Rossum
f669436189
Um, I thought I'd already checked this in.
...
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.
2006-03-10 02:28:35 +00:00
Tim Peters
39e11fb104
Whitespace normalization.
2006-03-04 02:43:44 +00:00
Neal Norwitz
10be2ea85d
SF bug 1442442: LIST_APPEND optimization got lost in the AST merge.
...
Add it back.
2006-03-03 20:29:11 +00:00
Neal Norwitz
d4e3035701
Fix compiler breakage related to absolute imports
2006-03-03 20:21:48 +00:00
Neal Norwitz
eaed39f303
Hopefully this removes all vestiges of CO_GENERATOR_ALLOWED that can
...
be removed in 2.x.
2006-03-03 19:12:58 +00:00
Thomas Wouters
fa0cf4f3ae
Add support for absolute/relative imports and if/else expressions:
...
- 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.
2006-03-03 18:16:20 +00:00
Guido van Rossum
5bde08dba3
Fix failure of test_compiler.py when compiling test_contextlib.py.
...
The culprit was an expression-less yield -- the first apparently in
the standard library. I added a unit test for this.
Also removed the hack to force compilation of test_with.py.
2006-03-02 04:24:01 +00:00
Thomas Wouters
34aa7ba114
from __future__ import with_statement addon for 'with', mostly written by
...
Neal.
2006-02-28 19:02:24 +00:00
Tim Peters
710ab3b5f8
Whitespace normalization.
2006-02-28 18:30:36 +00:00
Guido van Rossum
baf3eb2410
Forgot to explain the effect of the new opcode.
...
Sigh -- we really should have one place for all opcode metadata.
2006-02-28 00:40:16 +00:00
Guido van Rossum
7ad94f011e
Update the compiler package to compile the with-statement.
...
Jeremy, please review!
2006-02-28 00:32:16 +00:00
Guido van Rossum
c2e20744b2
PEP 343 -- the with-statement.
...
This was started by Mike Bland and completed by Guido
(with help from Neal).
This still needs a __future__ statement added;
Thomas is working on Michael's patch for that aspect.
There's a small amount of code cleanup and refactoring
in ast.c, compile.c and ceval.c (I fixed the lltrace
behavior when EXT_POP is used -- however I had to make
lltrace a static global).
2006-02-27 22:32:47 +00:00
Martin v. Löwis
59977a677c
Make or_test similar to test, not testlist.
2006-02-27 19:57:01 +00:00
Martin v. Löwis
415ed937c2
Skip over doc strings.
2006-02-27 19:56:30 +00:00
Martin v. Löwis
16c7f71380
Handle testlist_safe and or_test like testlist.
2006-02-27 16:11:03 +00:00
Martin v. Löwis
49a1302952
Alias non-terminals introduced for backwards compatibility.
2006-02-27 16:03:39 +00:00
Neal Norwitz
212a575242
Remove unused _callers member. No need for types, use isinstance
2005-11-25 03:19:29 +00:00
Neal Norwitz
ef260c0803
Stop looping to do nothing, just pass.
2005-11-25 03:18:58 +00:00
Neal Norwitz
d752f7d8e8
No need for types, use isinstance
2005-11-25 03:17:59 +00:00
Neal Norwitz
f9232678ae
Use sorted() builtin
2005-11-25 03:16:34 +00:00
Jeremy Hylton
3e0055f8c6
Merge ast-branch to head
...
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.
2005-10-20 19:59:25 +00:00
Phillip J. Eby
0d6615fd29
PEP 342 implementation. Per Guido's comments, the generator throw()
...
method still needs to support string exceptions, and allow None for the
third argument. Documentation updates are needed, too.
2005-08-02 00:46:46 +00:00
Georg Brandl
f0af0e7a46
patch [ 1231538 ] Typo fix in compiler/transformer.py (WalkerEror)
2005-07-02 18:37:41 +00:00
Neil Schemenauer
f36947032f
Fix compiler.ast.flatten function so that it works on lists.
2005-06-02 05:55:20 +00:00
Brett Cannon
f4189916e3
Flush out support for ``class B(): pass`` syntax by adding support to the
...
'parser' module and 'compiler' package.
Closes patch #1176012 . Thanks logistix.
2005-04-09 02:30:16 +00:00
Michael W. Hudson
05522ad795
Fix bug
...
[ 1057835 ] compiler.transformer, "from module import *"
2004-11-08 12:17:34 +00:00
Michael W. Hudson
c054a8b1a9
This is jiwon's patch to fix:
...
[ 1042238 ] Lib/compiler chokes on certain genexps
2004-10-11 15:35:53 +00:00