summaryrefslogtreecommitdiffstats
path: root/Parser
Commit message (Collapse)AuthorAgeFilesLines
...
* 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
|
* Improved handling of syntax errors.Jeremy Hylton2006-01-271-0/+1
| | | | | | | | | | | | | | | | | 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.
* Revert previous checkin, the check is for <, not ==. i is unsed in ↵Neal Norwitz2006-01-081-2/+5
| | | | non-debug builds, but is used in debug builds
* Fix icc warnings. This couldn't have been correct since i is checkedNeal Norwitz2006-01-081-5/+2
| | | | | for 2 different values without changing. I think this was the intent. The unused warning only occurs when not building in debug mode.
* Whitespace normalization.Tim Peters2005-12-253-814/+814
|
* Fix SF bug #1072182, problems with signed characters.Neal Norwitz2005-12-192-2/+3
| | | | Most of these can be backported.
* Fix Bug #1378022, UTF-8 files with a leading BOM crashed the interpreter.Neal Norwitz2005-12-181-0/+6
| | | | Needs backport.
* Merge from ast-arena. This reduces the code in Python/ast.c by ~300 lines,Neal Norwitz2005-12-171-5/+10
| | | | simplifies a lot of error handling code, and fixes many memory leaks.
* When regenerating files like Python-ast.h, take care that the generatedArmin Rigo2005-12-141-3/+2
| | | | | | | comment based on 'sys.args[0]' does not depend on the path. For Python builds from a remote directory ("/path/to/configure; make") the previous logic used to include the "/path/to" portion in Python-ast.h. Then svn would consider this file to be locally modified.
* SF #1373150, diffs in working copy after a buildNeal Norwitz2005-12-111-1/+5
| | | | | | | | Strip off leading dots and slash so the generated files are the same regardless of whether you configure in the checkout directory or build. If anyone configures in a different directory, we might want a cleaner approach using os.path.*(). Hopefully this is good enough.
* Fix some more memory leaks.Neal Norwitz2005-11-161-6/+11
| | | | | | Call error_ret() in decode_str(). It was called in some other places, but seemed inconsistent. It is safe to call PyTokenizer_Free() after calling error_ret().
* Prevent unlikely memory leak, tok should always be freed when parsetok() returnsNeal Norwitz2005-11-151-0/+1
|
* Thou shalt not lie, there are really 5 types nowNeal Norwitz2005-11-151-1/+1
|
* Whoops, checkin consistent versions of *all* files to stop pollutingNeal Norwitz2005-11-131-6/+80
| | | | a bunch of names
* Prevent name pollution by making lots of internal functions static.Neal Norwitz2005-11-131-4/+4
|
* Remove .cvsignore files, as they live in svn:ignoreMartin v. Löwis2005-10-301-6/+0
| | | | properties now.
* Use PyErr_NoMemory() instead of rolling our own.Neal Norwitz2005-10-231-7/+5
| | | | Get rid of "int i" unused warnings from Python-ast.c which we are generating.
* Free coding spec (cs) if there was an error to prevent mem leak. Maybe ↵Neal Norwitz2005-10-211-0/+3
| | | | backport candidate
* Merge ast-branch to headJeremy Hylton2005-10-207-4/+1967
| | | | | | | | | | 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.
* - Fix segfault with invalid coding.Neal Norwitz2005-10-023-2/+12
| | | | | | | - SF Bug #772896, unknown encoding results in MemoryError, which is not helpful I will only backport the segfault fix. I'll let Anthony decide if he wants the other changes backported. I will do the backport if asked.
* Apply SF patch #1101726: Fix buffer overrun in tokenizer.c when a source fileWalter Dörwald2005-07-121-27/+45
| | | | with a PEP 263 encoding declaration results in long decoded line.
* In a threads-disabled build, typing Ctrl-C into a raw_input() crashed,Michael W. Hudson2005-04-071-0/+4
| | | | | | | | | because (essentially) I didn't realise that PY_BEGIN/END_ALLOW_THREADS actually expanded to nothing under a no-threads build, so if you somehow NULLed out the threadstate (e.g. by calling PyThread_SaveThread) it would stay NULLed when you return to Python. Argh! Backport candidate.
* Patch #802188: better parser error message for non-EOL following line cont.Martin v. Löwis2005-03-031-1/+1
|
* Patch #975056 - fixes for restartable signals on *BSD. In addition,Anthony Baxter2004-10-131-13/+4
| | | | a few remaining calls to signal() were converted to PyOS_setsig().
* SF #941229: Decode source code with sys.stdin.encoding in interactiveHye-Shik Chang2004-08-041-0/+61
| | | | | | | modes like non-interactive modes. This allows for non-latin-1 users to write unicode strings directly and sets Japanese users free from weird manual escaping <wink> in shift_jis environments. (Reviewed by Martin v. Loewis)
* PEP-0318, @decorator-style. In Guido's words:Anthony Baxter2004-08-021-0/+2
| | | | | "@ seems the syntax that everybody can hate equally" Implementation by Mark Russell, from SF #979728.
* PyThreadState_Swap(NULL) didn't do what I thought it did. FixesMichael W. Hudson2004-07-081-1/+1
| | | | [ 987287 ] Python 2.4a1, interpreter hanging on Keyboard Interrupt