summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* Generally inehrit codeflags that are in PyCF_MASK, instead of writing it outThomas Wouters2006-02-281-4/+4
| | | | | in multiple places. This makes compile()/eval()/etc also inherit the absolute-import codeflag, like division and with-statement already were.
* from __future__ import with_statement addon for 'with', mostly written byThomas Wouters2006-02-281-0/+2
| | | | Neal.
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-0/+27
| | | | | | | | | | | | | | | | | | | | | | | - 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.
* Clarify C-style exception handling with proper label name.Thomas Wouters2006-02-271-3/+3
|
* Fix assertions.Thomas Wouters2006-02-271-3/+3
|
* PEP 343 -- the with-statement.Guido van Rossum2006-02-271-4/+162
| | | | | | | | | | | | | 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).
* PEP 308 implementation, including minor refdocs and some testcases. ItThomas Wouters2006-02-271-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | breaks the parser module, because it adds the if/else construct as well as two new grammar rules for backward compatibility. If no one else fixes parsermodule, I guess I'll go ahead and fix it later this week. The TeX code was checked with texcheck.py, but not rendered. There is actually a slight incompatibility: >>> (x for x in lambda:0) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: iteration over non-sequence changes into >>> (x for x in lambda: 0) File "<stdin>", line 1 (x for x in lambda: 0) ^ SyntaxError: invalid syntax Since there's no way the former version can be useful, it's probably a bugfix ;)
* Merge ssize_t branch.Martin v. Löwis2006-02-151-9/+13
|
* Fix icc warnings: single bit fields should be unsigned, shadowing local ↵Neal Norwitz2006-01-071-16/+16
| | | | variables
* Adjust usage of compiler_use_new_block to its return type.Martin v. Löwis2006-01-021-2/+2
|
* fixed compilation with an ordinary C89 compilerFredrik Lundh2005-12-181-2/+1
|
* Fix Armin's bug 1333982. He found it, he didn't created it :-)Neal Norwitz2005-12-181-9/+1
| | | | | | | | | | This code generated a C assertion: assert 1, ([s for s in x] + [s for s in x]) pass assert was completely broken, it needed to use the proper block. compiler_use_block() is now no longer used, so remove it.
* Handle more error conditions with SystemErrorNeal Norwitz2005-12-181-8/+22
|
* Set MemoryError when alloc failsNeal Norwitz2005-12-181-3/+11
|
* Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,Neal Norwitz2005-12-171-11/+14
| | | | simplifies a lot of error handling code, and fixes many memory leaks.
* Simplify logic for handling import *Neal Norwitz2005-12-061-6/+3
|
* Fix a few more ref leaks. Backport candidateNeal Norwitz2005-11-241-0/+2
|
* Fix a few more memory leaksNeal Norwitz2005-11-201-0/+3
| | | | | Document more info about the benefits of configuring without pymalloc when running valgrind
* Last batch of ref leaks in new AST code.Neal Norwitz2005-11-191-25/+50
| | | | | | Also converted a bunch of assert(0) to SystemError's. There are still printfs, etc that need to be cleaned up.
* Correctly handle identifiers for anonymous scopes and align genexpr name ↵Nick Coghlan2005-11-161-11/+17
| | | | with symtable.c
* Fix a lot of memory and ref leaks in error paths.Neal Norwitz2005-11-131-9/+35
| | | | | | (Call symtable_exit_block or compiler_exit_scope as appropriate) Use PyMem_Free on c_future since it was allocated with PyMem_Malloc
* make internal method staticNeal Norwitz2005-11-131-1/+1
|
* Ensure that compiler_exit_scope() is called as necessary to free memoryNeil Schemenauer2005-10-251-10/+18
| | | | | allocated by compiler_enter_scope(). Change return type for compiler_exit_scope() to be void.
* Fix problem handling EXTENDED_ARGs from SF bug # 1333982Neal Norwitz2005-10-231-1/+30
|
* cleanup a bit and reuse instrsize (instruction size). working towards ↵Neal Norwitz2005-10-231-30/+24
| | | | fixing problems with EXTENDED_ARG
* Remove unnecessary local variable.Neil Schemenauer2005-10-231-3/+2
|
* Fix private name mangling. The symtable also must do mangles so thatNeil Schemenauer2005-10-231-4/+16
| | | | the scope of names can be correctly determined.
* Use PyTuple_Pack instead of Py_BuildValue.Neil Schemenauer2005-10-231-2/+1
|
* Fix arigo's funky LOAD_NAME bug: implicit globals inside classes haveNeil Schemenauer2005-10-231-1/+2
| | | | | historically been looked up using LOAD_NAME, not LOAD_GLOBAL. looked up by LOAD_NAME, not
* Don't stop generating code for import statements after the first "import as"Neil Schemenauer2005-10-231-2/+3
| | | | part. Fixes one bug from #1333982.
* Use <lamba> as the function name for lambdas (matches old compiler).Neil Schemenauer2005-10-211-1/+1
|
* ANSI-C-ify the placement of local var declarations.Armin Rigo2005-10-211-1/+2
|
* Merge ast-branch to headJeremy Hylton2005-10-201-5613/+2880
| | | | | | | | | | 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.
* com_yield_expr(): Squash new compiler wng about unreferenced local.Tim Peters2005-08-031-1/+0
|
* PEP 342 implementation. Per Guido's comments, the generator throw()Phillip J. Eby2005-08-021-12/+64
| | | | | method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
* Fix signedness of various char variables to stop causing a warning under gcc 4.Brett Cannon2005-06-251-1/+1
|
* Allow classes to be defined with empty parentheses. This means thatBrett Cannon2005-03-051-2/+3
| | | | ``class C(): pass`` is no longer a syntax error.
* Silence a gcc warning about putting in parentheses around && expressions mixedBrett Cannon2005-03-031-5/+6
| | | | with || expressions. Also clarifies intend of 'if' conditional.
* Preserve sign of -0.0 when result is run through marshal.Raymond Hettinger2005-02-231-2/+4
|
* Document how the pattern recognizer keeps all of its references in bounds.Raymond Hettinger2005-02-211-0/+8
| | | | | | Add a test in case the underlying assumptions ever change (i.e. the compiler starts generating code blocks that are not punctuated by RETURN_VALUE).
* Teach the peepholer to fold unary operations on constants.Raymond Hettinger2005-02-201-0/+62
| | | | | Afterwards, -0.5 loads in a single step and no longer requires a runtime UNARY_NEGATIVE operation.
* Remove the set conversion which didn't work with: [] in (0,)Raymond Hettinger2005-02-101-53/+1
|
* Have set conversion replace existing constant if not used elsewhere.Raymond Hettinger2005-02-091-1/+7
|
* Adopt Skip's idea to optimize lists of constants in the contextRaymond Hettinger2005-02-071-7/+13
| | | | of a "in" or "not in" test.
* Transform "x in (1,2,3)" to "x in frozenset([1,2,3])".Raymond Hettinger2005-02-061-1/+48
| | | | | Inspired by Skip's idea to recognize the throw-away nature of sequences in this context and to transform their type to one with better performance.
* Do not fold a constant if a large sequence will result.Raymond Hettinger2005-01-261-5/+15
| | | | Saves space in the presence of code like: (None,)*10000
* Re-running python with/without the -Qnew flag uses incorrectly optimizedArmin Rigo2005-01-071-6/+3
| | | | | bytecodes from the previously saved .pyc files. Fixed by disabling the static optimization of BINARY_DIVIDE between two constants.
* Teach the peephole optimizer to fold simple constant expressions.Raymond Hettinger2005-01-021-1/+118
|
* SF patch 1025636: Check for NULL returns in compile.c:com_import_stmtJeremy Hylton2004-11-071-4/+14
| | | | There is no test for this change, because there is no way to provoke memory errors on demand. Test suite passes, though.
* Maintain peepholer's cumlc invariant by updating the running totalRaymond Hettinger2004-11-021-0/+4
| | | | | | everytime a LOAD_CONSTANT is encountered, created, or overwritten. Added two tests to cover cases affected by the patch.