summaryrefslogtreecommitdiff
path: root/Python/ast.c
AgeCommit message (Collapse)AuthorLines
2006-09-05Bug #1520864 (again): unpacking singleton tuples in list comprehensions andNeal Norwitz-4/+12
generator expressions (x for x, in ... ) works again. Sigh, I only fixed for loops the first time, not list comps and genexprs too. I couldn't find any more unpacking cases where there is a similar bug lurking.
2006-08-12Klocwork made another run and found a bunch more problems.Neal Norwitz-0/+2
This is the first batch of fixes that should be easy to verify based on context. This fixes problem numbers: 220 (ast), 323-324 (symtable), 321-322 (structseq), 215 (array), 210 (hotshot), 182 (codecs), 209 (etree).
2006-07-30Add some asserts and update commentsNeal Norwitz-2/+3
2006-07-30Patch #1531113: Fix augmented assignment with yield expressions.Neal Norwitz-7/+9
Also fix a SystemError when trying to assign to yield expressions.
2006-07-21Handle more memory allocation failures without crashing.Neal Norwitz-2/+4
2006-07-12Bug #1520864: unpacking singleton tuples in for loop (for x, in) work again.Neal Norwitz-2/+6
2006-07-09Fix SF bug 1441486: bad unary minus folding in compiler.Neil Schemenauer-20/+53
2006-07-09Fix AST compiler bug #1501934: incorrect LOAD/STORE_GLOBAL generation.Neil Schemenauer-2/+3
2006-07-08Fix SF bug #1519018: 'as' is now validated properly in import statementsNeal Norwitz-1/+12
2006-05-26Replace Py_BuildValue("OO") by PyTuple_Pack.Georg Brandl-1/+1
2006-05-19Fix #1474677, non-keyword argument following keyword.Neal Norwitz-0/+5
2006-05-15- Bug #1487966: Fix SystemError with conditional expression in assignmentNeal Norwitz-0/+3
Most of the test_syntax changes are just updating the numbers.
2006-04-22Fix more ssize_t issues.Martin v. Löwis-1/+1
2006-04-13Introduce asdl_int_seq, to hold cmpop_ty.Martin v. Löwis-4/+4
2006-04-11Convert 0 to their respective enum types. ConvertMartin v. Löwis-11/+11
void* to their respective _ty types. Fix signature of ast_for_exprlist.
2006-04-11low-hanging fruit in Python/ - g++ still hates all the enum_kind declarationsAnthony Baxter-19/+19
in Python/Python-ast.c. Not sure what to do about those.
2006-04-04Add lineno, col_offset to excephandler to enable future fix forJeremy Hylton-28/+48
tracing/line number table in except blocks. Reflow long lines introduced by col_offset changes. Update test_ast to handle new fields in excepthandler. As note in Python.asdl says, we might want to rethink how attributes are handled. Perhaps they should be the same as other fields, with the primary difference being how they are defined for all types within a sum. Also fix asdl_c so that constructors with int fields don't fail when passed a zero value.
2006-03-27Fix SF bug #1458903 with AST compiler.Neal Norwitz-4/+11
def foo((x)): was getting recognized as requiring tuple unpacking which is not correct. Add tests for this case and the proper way to unpack a tuple of one: def foo((x,)): test_inpsect was incorrect before. I'm not sure why it was passing, but that has been corrected with a test for both functions above. This means the test (and therefore inspect.getargspec()) are broken in 2.4.
2006-03-23Forward port MvL's fix in 43227:Neal Norwitz-0/+4
Fix crash when a Unicode string containing an encoding declaration is compile()d. Fixes #1115379.
2006-03-17Fix bug 1441408 where a double colon didn't trigger extended slice semantics ↵Nick Coghlan-8/+12
(applies patch 1452332)
2006-03-07SF #1444030: Fix several potential defects found by Coverity.Hye-Shik Chang-0/+2
(reviewed by Neal Norwitz)
2006-03-01Patch #1440601: Add col_offset attribute to AST nodes.Martin v. Löwis-81/+91
2006-03-01Fix uninitialized value. (Why are we using bools instead of ints, like we doThomas Wouters-1/+1
everywhere else?)
2006-02-28Make 'as' an actual keyword when with's future statement is used. NotThomas Wouters-2/+2
actually necessary for functionality, but good for transition.
2006-02-28Remove asdl_seq_APPEND() and simplify asdl seq implementation.Jeremy Hylton-61/+55
Clarify intended use of set_context() and check errors at all call sites.
2006-02-28SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters-12/+33
- 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.
2006-02-27PEP 343 -- the with-statement.Guido van Rossum-2/+44
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-27Fix parsing of subscriptlist.Jeremy Hylton-4/+30
(Armin's SF bug report). d = {} d[1,] = 1 Now handled correctly
2006-02-27And some more cleanup.Thomas Wouters-2/+2
2006-02-27Clean up from-import handling.Thomas Wouters-22/+21
2006-02-27Simplify ast_for_trailer() in anticipation of more changes.Jeremy Hylton-17/+11
2006-02-27Fix old not-reading-pep-308-right artifact.Thomas Wouters-1/+1
2006-02-27Fix assertion errors in debug build, brought on by PEP 308 patch.Thomas Wouters-1/+1
2006-02-27PEP 308 implementation, including minor refdocs and some testcases. ItThomas Wouters-3/+37
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 ;)
2006-02-05Use C-style commentNeal Norwitz-1/+1
2006-01-27Improved handling of syntax errors.Jeremy Hylton-35/+74
Expand set of errors caught in set_context(). Some new errors, some old error messages changed for consistency. Fixed error checking in generator expression code. The first set of tests were impossible condition given the grammar. In general, the ast code uses REQ() for those sanity checks. Fix some error handling for augmented assignments. As comments in the code explain, set_context() ought to work here, but I got unexpected crashes when I tried it. Should come back to this. Add note to Grammar that yield expression is a special case. Add doctest cases for SyntaxErrors raised by ast.c.
2006-01-08Repair bizarre indentation created by VC 7.1.Tim Peters-1/+1
2006-01-08alias_for_import_name(): Dueling compiler warnings ;-)Tim Peters-1/+2
Squash new warnings from VC 7.1 about mixing signed and unsigned types in comparisons. I can see why `len` was changed to size_t here, but don't see why `i` was also changed. Change `i` back to int.
2006-01-08Fix icc warnings: conversion from "long" to "int" may lose significant bitsNeal Norwitz-5/+4
2006-01-07Fix icc warnings: shadowing local variablesNeal Norwitz-2/+1
2005-12-29SF#1391872Fredrik Lundh-2/+2
Floating point literals don't work in non-US locale in 2.5. Patch and new locale tests by Hye-Shik Chang.
2005-12-19Fix SF bug #1072182, problems with signed characters.Neal Norwitz-1/+1
Most of these can be backported.
2005-12-18Cleanup a bit and make things more consistent.Neal Norwitz-135/+85
Don't double check for NULLs and don't initialize if not necessary. No functional changes.
2005-12-17SF patch #1355913, PEP 341 - Unification of try/except and try/finallyNeal Norwitz-50/+62
Modified since ast-arenas was implemented.
2005-12-17Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,Neal Norwitz-541/+250
simplifies a lot of error handling code, and fixes many memory leaks.
2005-12-11SF #1377897, Bus error in astNeal Norwitz-0/+5
If a line had multiple semi-colons and ended with a semi-colon, we would loop too many times and access a NULL node. Exit the loop early if there are no more children.
2005-12-11SF #1370197, memory leak - ast_error_finish (in error conditions).Neal Norwitz-2/+6
2005-12-05Remove unnecessary extern variableNeal Norwitz-2/+0
2005-11-20Fix a few more memory leaksNeal Norwitz-2/+10
Document more info about the benefits of configuring without pymalloc when running valgrind
2005-11-16add more docNeal Norwitz-1/+22