summaryrefslogtreecommitdiffstats
path: root/Parser
Commit message (Collapse)AuthorAgeFilesLines
* Fix a couple of problems in generating the AST code:Neal Norwitz2007-02-261-5/+3
| | | | | | * use %r instead of backticks since backticks are going away in Py3k * PyArena_Malloc() already sets PyErr_NoMemory so we don't need to do it again * the signature for ast2obj_int incorrectly used a bool, rather than a long
* Modify Parser/asdl_c.py so that the __version__ number for Python/Python-ast.cBrett Cannon2007-02-121-2/+19
| | | | | | is specified at the top of the file. Also add a note that Python/Python-ast.c needs to be committed separately after a change to the AST grammar to capture the revision number of the change (which is what __version__ is set to).
* Change a very minor inconsistency (that is purely cosmetic) in the ASTBrett Cannon2007-02-111-1/+1
| | | | definition.
* Prefix AST symbols with _Py_. Fixes #1637022.Martin v. Löwis2007-01-191-1/+6
| | | | Will backport.
* Comment grammarAndrew M. Kuchling2006-10-061-1/+1
|
* Fix a bug in the parser's future statement handling that led to "with"Georg Brandl2006-09-241-10/+12
| | | | | not being recognized as a keyword after, e.g., this statement: from __future__ import division, with_statement
* with and as are now keywords. There are some generated files I can't recreate.Neal Norwitz2006-09-061-3/+5
|
* Handle malloc failure.Neal Norwitz2006-08-131-0/+4
| | | | Klocwork 281
* Handle NULL nodes while parsing. I'm not entirely sure this is correct.Neal Norwitz2006-08-121-0/+6
| | | | | | There might be something else that needs to be done to setup the error. Klocwork #295.
* Don't truncate if size_t is bigger than uintNeal Norwitz2006-06-121-1/+1
|
* Fix comment typoAndrew M. Kuchling2006-06-061-1/+1
|
* Patch #1357836:Neal Norwitz2006-06-021-9/+11
| | | | | | | | | | Prevent an invalid memory read from test_coding in case the done flag is set. In that case, the loop isn't entered. I wonder if rather than setting the done flag in the cases before the loop, if they should just exit early. This code looks like it should be refactored. Backport candidate (also the early break above if decoding_fgets fails)
* Patch #1475845: Raise IndentationError for unexpected indent.Martin v. Löwis2006-05-041-1/+3
|
* C++ compiler cleanup: cast signed to unsignedSkip Montanaro2006-04-181-1/+1
|
* Patch #1355883: Build Python-ast.c and Python-ast.hMartin v. Löwis2006-04-141-30/+30
| | | | independently. Fixes #1355883.
* Introduce asdl_int_seq, to hold cmpop_ty.Martin v. Löwis2006-04-131-3/+9
|
* more low-hanging fruit to make code compile under a C++ compiler. NotAnthony Baxter2006-04-111-2/+2
| | | | | entirely happy with the two new VISIT macros in compile.c, but I couldn't see a better approach.
* As discussed on python-dev, really fix the PyMem_*/PyObject_* memory APINeal Norwitz2006-04-113-29/+29
| | | | | | | | | | | | | | | | mismatches. At least I hope this fixes them all. This reverts part of my change from yesterday that converted everything in Parser/*.c to use PyObject_* API. The encoding doesn't really need to use PyMem_*, however, it uses new_string() which must return PyMem_* for handling the result of PyOS_Readline() which returns PyMem_* memory. If there were 2 versions of new_string() one that returned PyMem_* for tokens and one that return PyObject_* for encodings that could also fix this problem. I'm not sure which version would be clearer. This seems to fix both Guido's and Phillip's problems, so it's good enough for now. After this change, it would be good to review Parser/*.c for consistent use of the 2 memory APIs.
* Make _kind types global for C++ compilation.Martin v. Löwis2006-04-111-3/+5
| | | | Explicitly cast void* to int to cmpop_ty.
* Fix the code in Parser/ to also compile with C++. This was mostly casts forAnthony Baxter2006-04-117-36/+40
| | | | | | | malloc/realloc type functions, as well as renaming one variable called 'new' in tokensizer.c. Still lots more to be done, going to be checking in one chunk at a time or the patch will be massively huge. Still compiles ok with gcc.
* SF patch #1467512, fix double free with triple quoted string in standard build.Neal Norwitz2006-04-109-37/+45
| | | | | | This was the result of inconsistent use of PyMem_* and PyObject_* allocators. By changing to use PyObject_* allocator almost everywhere, this removes the inconsistency.
* Make path calculation platform independentJeremy Hylton2006-04-041-1/+1
|
* Add lineno, col_offset to excephandler to enable future fix forJeremy Hylton2006-04-042-3/+6
| | | | | | | | | | | | | | | 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.
* * Fix a refleak of *_attributes.Neal Norwitz2006-04-031-5/+7
| | | | | | * Cleanup formatting a bit (add spaces). * Move static var initialized inside init_types() since that's the only place it's used.
* Years in the making.Tim Peters2006-03-261-39/+44
| | | | | | | | | | | | | | | | | | | | | | | | objimpl.h, pymem.h: Stop mapping PyMem_{Del, DEL} and PyMem_{Free, FREE} to PyObject_{Free, FREE} in a release build. They're aliases for the system free() now. _subprocess.c/sp_handle_dealloc(): Since the memory was originally obtained via PyObject_NEW, it must be released via PyObject_FREE (or _DEL). pythonrun.c, tokenizer.c, parsermodule.c: I lost count of the number of PyObject vs PyMem mismatches in these -- it's like the specific function called at each site was picked at random, sometimes even with memory obtained via PyMem getting released via PyObject. Changed most to use PyObject uniformly, since the blobs allocated are predictably small in most cases, and obmalloc is generally faster than system mallocs then. If extension modules in real life prove as sloppy as Python's front end, we'll have to revert the objimpl.h + pymem.h part of this patch. Note that no problems will show up in a debug build (all calls still go thru obmalloc then). Problems will show up only in a release build, most likely segfaults.
* Use macro versions instead of function versions when we already know the type.Neal Norwitz2006-03-201-1/+3
| | | | | | | | This will hopefully get rid of some Coverity warnings, be a hint to developers, and be marginally faster. Some asserts were added when the type is currently known, but depends on values from another function.
* SF #1444030: Fix several potential defects found by Coverity.Hye-Shik Chang2006-03-071-0/+2
| | | | (reviewed by Neal Norwitz)
* Fix crashing bug in tokenizer, when tokenizing files with non-ASCII bytesThomas Wouters2006-03-021-0/+5
| | | | | | | | | | | | | | | | | | | but without a specified encoding: decoding_fgets() (and decoding_feof()) can return NULL and fiddle with the 'tok' struct, making tok->buf NULL. This is okay in the other cases of calls to decoding_*(), it seems, but not in this one. This should get a test added, somewhere, but the testsuite doesn't seem to test encoding anywhere (although plenty of tests use it.) It seems to me that decoding errors in other places in the code (like at the start of a token, instead of in the middle of one) make the code end up adding small integers to NULL pointers, but happen to check for error states before using the calculated new pointers. I haven't been able to trigger any other crashes, in any case. I would nominate this file for a comlete rewrite for Py3k. The whole decoding trick is too bolted-on for my tastes.
* Fix memory leak on attributes.Martin v. Löwis2006-03-021-1/+3
|
* Patch #1440601: Add col_offset attribute to AST nodes.Martin v. Löwis2006-03-018-13/+29
|
* Remove unused field.Martin v. Löwis2006-03-011-1/+0
|
* Don't pollute namespace as bad as before. All the types are static now.Neal Norwitz2006-02-281-7/+7
|
* Make 'as' an actual keyword when with's future statement is used. NotThomas Wouters2006-02-282-12/+14
| | | | actually necessary for functionality, but good for transition.
* Change non-ASCII warning into a SyntaxError.Martin v. Löwis2006-02-281-10/+6
|
* from __future__ import with_statement addon for 'with', mostly written byThomas Wouters2006-02-283-31/+65
| | | | Neal.
* Whitespace normalization.Tim Peters2006-02-282-16/+16
|
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | - 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.
* Generate return statement.Martin v. Löwis2006-02-281-0/+1
|
* Add generation of the version.Martin v. Löwis2006-02-281-1/+2
|
* Add support for version field on ModulesMartin v. Löwis2006-02-283-8/+29
|
* PEP 343 -- the with-statement.Guido van Rossum2006-02-271-0/+1
| | | | | | | | | | | | | 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).
* Create _ast module.Martin v. Löwis2006-02-271-191/+86
| | | | Cleanup Python-ast.c generation.
* PEP 308 implementation, including minor refdocs and some testcases. ItThomas Wouters2006-02-271-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | 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 ;)
* Avoid reinitializing the types twice.Martin v. Löwis2006-02-271-0/+1
|
* Stop generating empty arrays.Martin v. Löwis2006-02-261-12/+22
|
* Fix iterating over cmpop_ty lists.Martin v. Löwis2006-02-261-5/+13
|
* Generate code to recursively copy an AST intoMartin v. Löwis2006-02-261-59/+206
| | | | a tree of Python objects. Expose this through compile().
* Use Py_ssize_t to count the length.Martin v. Löwis2006-02-161-1/+1
|
* Remove C99ism.Martin v. Löwis2006-02-151-1/+2
|
* Merge ssize_t branch.Martin v. Löwis2006-02-152-11/+12
|