summaryrefslogtreecommitdiff
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix a reference leak found by Georg, when compiling a class nested in ↵Amaury Forgeot d'Arc2008-03-281-0/+1
| | | | | | | | another class. Test is run with "regrtest.py -R:: test_compile" Backport of r62015
* Added checks for integer overflows, contributed by Google. Some areMartin v. Löwis2008-02-141-4/+30
| | | | | only available if asserts are left in the code, in cases where they can't be triggered from Python code.
* No need to emit co_lnotab item when both offsets are zeros.Amaury Forgeot d'Arc2008-02-041-0/+3
| | | | | | r60579 broke a test test_compile, which seems to test an "implementation detail" IMO. Also test that this correction does not impact the debugger.
* backport of r60575 (issue #1750076): Debugger did not step on every ↵Amaury Forgeot d'Arc2008-02-041-14/+15
| | | | | | | | | | | | | | iteration of a while statement. The mapping between bytecode offsets and source lines (lnotab) did not contain an entry for the beginning of the loop. Now it does, and the lnotab can be a bit larger: in particular, several statements on the same line generate several entries. However, this does not bother the settrace function, which will trigger only one 'line' event. The lnotab seems to be exactly the same as with python2.4.
* #1920: when considering a block starting by "while 0", the compiler ↵Amaury Forgeot d'Arc2008-01-241-1/+4
| | | | | | | | | | | | | | | | | optimized the whole construct away, even when an 'else' clause is present:: while 0: print("no") else: print("yes") did not generate any code at all. Now the compiler emits the 'else' block, like it already does for 'if' statements. Backport of r60265.
* Issue 1678380: fix a bug identifying -0.0 and 0.0Mark Dickinson2008-01-211-1/+14
|
* Fix #1169: remove docstrings in functions for -OO.Georg Brandl2007-09-191-1/+1
| | | | (backport from rev. 58204)
* Bug #1722484: remove docstrings again when running with -OO.Georg Brandl2007-06-011-1/+2
| | | | (backport from rev. 55732)
* Fix constantification of None.Raymond Hettinger2007-03-021-5/+9
|
* Backport 52504:Neal Norwitz2006-10-281-1/+4
| | | | | | Fix bug #1565514, SystemError not raised on too many nested blocks. It seems like this should be a different error than SystemError, but I don't have any great ideas and SystemError was raised in 2.4 and earlier.
* Fix #1569998: no break inside try statement (outside loop) allowed.Georg Brandl2006-10-081-1/+13
| | | | (backport from rev. 52129)
* Patch #1542451: fix crash with continue in nested try/finallyGeorg Brandl2006-10-081-4/+10
| | | | (backport from rev. 51439)
* Even though _Py_Mangle() isn't truly public anyone can call it andNeal Norwitz2006-08-121-2/+2
| | | | | | | | | | there was no verification that privateobj was a PyString. If it wasn't a string, this could have allowed a NULL pointer to creep in below and crash. I wonder if this should be PyString_CheckExact? Must identifiers be strings or can they be subclasses? Klocwork #275
* Bug #1333982: string/number constants were inappropriately storedNeal Norwitz2006-08-041-2/+4
| | | | | in the byte code and co_consts even if they were not used, ie immediately popped off the stack.
* Bug #1191458: tracing over for loops now produces a line eventNeal Norwitz2006-08-041-7/+46
| | | | | | | | | | | | on each iteration. I'm not positive this is the best way to handle this. I'm also not sure that there aren't other cases where the lnotab is generated incorrectly. It would be great if people that use pdb or tracing could test heavily. Also: * Remove dead/duplicated code that wasn't used/necessary because we already handled the docstring prior to entering the loop. * add some debugging code into the compiler (#if 0'd out).
* Add some asserts and update commentsNeal Norwitz2006-07-301-0/+1
|
* If the for loop isn't entered, entryblock will be NULL. If passedNeal Norwitz2006-07-231-0/+2
| | | | | | to stackdepth_walk it will be dereffed. Not sure if I found with failmalloc or Klockwork #55.
* Fix more memory allocation issues found with failmalloc.Neal Norwitz2006-07-221-13/+23
|
* Handle more memory allocation failures without crashing.Neal Norwitz2006-07-211-0/+9
|
* Bug #1512814, Fix incorrect lineno's when code within a functionNeal Norwitz2006-07-161-5/+6
| | | | had more than 255 blank lines. Byte codes need to go first, line #s second.
* Bug #1512814, Fix incorrect lineno's when code at module scopeNeal Norwitz2006-07-101-1/+9
| | | | started after line 256.
* Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation.Neil Schemenauer2006-07-091-1/+2
|
* Fix indentation of case and a Py_ssize_t issue.Neal Norwitz2006-06-121-2/+2
|
* Patch #1346214: correctly optimize away "if 0"-style stmtsGeorg Brandl2006-06-041-14/+29
| | | | (thanks to Neal for review)
* Replace Py_BuildValue("OO") by PyTuple_Pack.Georg Brandl2006-05-261-3/+3
|
* Get rid of __context__, per the latest changes to PEP 343 and python-devGuido van Rossum2006-05-021-10/+3
| | | | | | | | 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.
* Introduce asdl_int_seq, to hold cmpop_ty.Martin v. Löwis2006-04-131-10/+2
|
* revert - breaks build of Python/ast.c w/ gccSkip Montanaro2006-04-131-2/+5
|
* Use union to discriminate pointer types from enum/int types.Skip Montanaro2006-04-131-5/+2
|
* casting nastiness to make C++ compiler happyAnthony Baxter2006-04-131-2/+10
|
* per Jeremy's email, remove the _WITH_CAST versions of macros. g++Anthony Baxter2006-04-121-46/+24
| | | | | still has errors from the casts of asdl_seq_GET to cmpop_ty, but otherwise it's C++ clean.
* more low-hanging fruit to make code compile under a C++ compiler. NotAnthony Baxter2006-04-111-54/+85
| | | | | entirely happy with the two new VISIT macros in compile.c, but I couldn't see a better approach.
* Use PyObject_* allocator since FutureFeatures is smallNeal Norwitz2006-04-101-1/+1
|
* Fix some warnings on HP-UX when using cc/aCCNeal Norwitz2006-04-101-4/+7
|
* Generate line number table entries for except handlers.Jeremy Hylton2006-04-041-0/+2
| | | | Re-enable all the tests in test_trace.py except one. Still not sure that these tests test what they used to test, but they pass. One failing test seems to be caused by undocumented line number table behavior in Python 2.4.
* Don't abbreviate ABS, use long name ABSOLUTE.Neal Norwitz2006-04-031-2/+2
|
* Expand comments on line numbers and blocks.Jeremy Hylton2006-04-011-6/+21
| | | | Reorder compiler_set_lineno() call for consistency.
* Fix some missing checks after PyTuple_New, PyList_New, PyDict_NewGeorg Brandl2006-03-171-1/+3
|
* Fix SF bug #1448804 and ad a test to ensure that all subscript operations ↵Nick Coghlan2006-03-131-24/+29
| | | | continue to be handled correctly
* Um, I thought I'd already checked this in.Guido van Rossum2006-03-101-3/+1
| | | | | | | 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.
* SF bug 1442442: LIST_APPEND optimization got lost in the AST merge.Neal Norwitz2006-03-031-3/+4
| | | | Add it back.
* Fix refleak if from __future__ import was not firstNeal Norwitz2006-03-021-0/+1
|
* Update known issues to reflect realityNeal Norwitz2006-03-021-4/+1
|
* Patch #1440601: Add col_offset attribute to AST nodes.Martin v. Löwis2006-03-011-2/+2
|
* Tabify and reflow some long lines.Jeremy Hylton2006-03-011-696/+702
| | | | | Much of the peephole optimizer is now indented badly, but it's about to be revised anyway.
* 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
|