summaryrefslogtreecommitdiffstats
path: root/Modules/parsermodule.c
Commit message (Collapse)AuthorAgeFilesLines
* Patch #1759: Backport of PEP 3129 class decoratorsChristian Heimes2008-02-231-10/+25
| | | | with some help from Georg
* Modified PyImport_Import and PyImport_ImportModule to always use absolute ↵Christian Heimes2008-01-031-1/+1
| | | | | | imports by calling __import__ with an explicit level of 0 Added a new API function PyImport_ImportModuleNoBlock. It solves the problem with dead locks when mixing threads and imports
* #1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes2007-12-191-3/+3
| | | | Py_REFCNT. Macros for b/w compatibility are available.
* PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis2007-07-211-5/+4
| | | | | backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
* Expose column offset information in parse trees.Jeremy Hylton2006-08-221-15/+30
|
* Replace PyObject_CallFunction calls with only object argsGeorg Brandl2006-05-251-2/+2
| | | | with PyObject_CallFunctionObjArgs, which is 30% faster.
* Update for new grammarNeal Norwitz2006-04-121-4/+4
|
* Years in the making.Tim Peters2006-03-261-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* SF #1445431, fix some leaks in error conditions.Neal Norwitz2006-03-201-9/+14
|
* Patch #1440601: Add col_offset attribute to AST nodes.Martin v. Löwis2006-03-011-1/+1
|
* SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters2006-02-281-13/+28
| | | | | | | | | | | | | | | | | | | | | | | - 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.
* unconst.Martin v. Löwis2006-02-271-9/+9
|
* Update for PEP 308 patch.Thomas Wouters2006-02-271-3/+54
|
* Use Py_ssize_t for counts and sizes.Martin v. Löwis2006-02-161-1/+1
|
* Merge ssize_t branch.Martin v. Löwis2006-02-151-5/+6
|
* Check return result from Py_InitModule*(). This API can fail.Neal Norwitz2006-01-191-0/+2
| | | | Probably should be backported.
* Add const to several API functions that take char *.Jeremy Hylton2005-12-101-9/+9
| | | | | | | | | | | | | | | | | | | In C++, it's an error to pass a string literal to a char* function without a const_cast(). Rather than require every C++ extension module to put a cast around string literals, fix the API to state the const-ness. I focused on parts of the API where people usually pass literals: PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type slots, etc. Predictably, there were a large set of functions that needed to be fixed as a result of these changes. The most pervasive change was to make the keyword args list passed to PyArg_ParseTupleAndKewords() to be a const char *kwlist[]. One cast was required as a result of the changes: A type object mallocs the memory for its tp_doc slot and later frees it. PyTypeObject says that tp_doc is const char *; but if the type was created by type_new(), we know it is safe to cast to char *.
* PEP 342 implementation. Per Guido's comments, the generator throw()Phillip J. Eby2005-08-021-11/+44
| | | | | method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
* Flush out support for ``class B(): pass`` syntax by adding support to theBrett Cannon2005-04-091-6/+15
| | | | | | 'parser' module and 'compiler' package. Closes patch #1176012. Thanks logistix.
* SF patch #1007189, multi-line imports, for instance:Anthony Baxter2004-08-311-36/+88
| | | | | "from blah import (foo, bar baz, bongo)"
* This is Mark Russell's patch:Michael W. Hudson2004-08-171-18/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ 1009560 ] Fix @decorator evaluation order From the description: Changes in this patch: - Change Grammar/Grammar to require newlines between adjacent decorators. - Fix order of evaluation of decorators in the C (compile.c) and python (Lib/compiler/pycodegen.py) compilers - Add better order of evaluation check to test_decorators.py (test_eval_order) - Update the decorator documentation in the reference manual (improve description of evaluation order and update syntax description) and the comment: Used Brett's evaluation order (see http://mail.python.org/pipermail/python-dev/2004-August/047835.html) (I'm checking this in for Anthony who was having problems getting SF to talk to him)
* PEP-0318, @decorator-style. In Guido's words:Anthony Baxter2004-08-021-9/+62
| | | | | "@ seems the syntax that everybody can hate equally" Implementation by Mark Russell, from SF #979728.
* SF patch #872326: Generator expression implementationRaymond Hettinger2004-05-191-6/+115
| | | | | | | | | | | | | | (Code contributed by Jiwon Seo.) The documentation portion of the patch is being re-worked and will be checked-in soon. Likewise, PEP 289 will be updated to reflect Guido's rationale for the design decisions on binding behavior (as described in in his patch comments and in discussions on python-dev). The test file, test_genexps.py, is written in doctest format and is meant to exercise all aspects of the the patch. Further additions are welcome from everyone. Please stress test this new feature as much as possible before the alpha release.
* Getting rid of all the code inside #ifdef macintosh too.Jack Jansen2003-11-201-4/+0
|
* Merge 23c1-branch back into the head. Barry will send email about theTim Peters2003-07-211-4/+12
| | | | | | New Plan (releases to be made off the head, ongoing random 2.4 stuff to be done on a short-lived branch, provided anyone is motivated enough to create one).
* Don't use (PyObject *)PyObject_Type(x). It is a leaky and verbose wayGuido van Rossum2003-04-091-2/+2
| | | | of saying x->ob_type.
* Remove duplicate code introduced by fixing bug #678518Neal Norwitz2003-02-101-3/+0
|
* Remove unused variable.Guido van Rossum2003-02-091-1/+0
|
* Apply logistix's patch fromMichael W. Hudson2003-02-081-3/+43
| | | | [ 678518 ] Another parsermodule validation error
* Teach the parsermodule about floor division. FixesMichael W. Hudson2003-01-291-0/+2
| | | | | | [ 676521 ] parser module validation failure bugfix candidate.
* SF patch [ 597919 ] compiler package and SET_LINENOJeremy Hylton2002-12-311-6/+7
| | | | | | | | | | | | | | | | | A variety of changes from Michael Hudson to get the compiler working with 2.3. The primary change is the handling of SET_LINENO: # The set_lineno() function and the explicit emit() calls for # SET_LINENO below are only used to generate the line number table. # As of Python 2.3, the interpreter does not have a SET_LINENO # instruction. pyassem treats SET_LINENO opcodes as a special case. A few other small changes: - Remove unused code from pycodegen and pyassem. - Fix error handling in parsermodule. When PyParser_SimplerParseString() fails, it sets an exception with detailed info. The parsermodule was clobbering that exception and replacing it was a generic "could not parse string" exception. Keep the original exception.
* Allow more docstrings to be removed during compilation in some modulesNeal Norwitz2002-08-131-20/+20
|
* Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." linkMark Hammond2002-07-231-2/+2
| | | | | command line for Windows builds. This should allow MSVC to import and build the Python MSVC6 project files without error.
* staticforward bites the dust.Jeremy Hylton2002-07-171-12/+7
| | | | | | | | | | | | | | | The staticforward define was needed to support certain broken C compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the static keyword when it was used with a forward declaration of a static initialized structure. Standard C allows the forward declaration with static, and we've decided to stop catering to broken C compilers. (In fact, we expect that the compilers are all fixed eight years later.) I'm leaving staticforward and statichere defined in object.h as static. This is only for backwards compatibility with C extensions that might still use it. XXX I haven't updated the documentation.
* Patch #568124: Add doc string macros.Martin v. Löwis2002-06-131-8/+5
|
* Disambiguate the grammar for backtick.Guido van Rossum2002-05-241-1/+13
| | | | | | The old syntax suggested that a trailing comma was OK inside backticks, but in fact (due to ideosyncrasies of pgen) it was not. Fix the grammar to avoid the ambiguity. Fred: you may want to update the refman.
* Patch supplied by Burton Radons for his own SF bug #487390: ModifyingGuido van Rossum2001-12-081-1/+1
| | | | | | | | | | | | | type.__module__ behavior. This adds the module name and a dot in front of the type name in every type object initializer, except for built-in types (and those that already had this). Note that it touches lots of Mac modules -- I have no way to test these but the changes look right. Apologies if they're not. This also touches the weakref docs, which contains a sample type object initializer. It also touches the mmap test output, because the mmap type's repr is included in that output. It touches object.h to put the correct description in a comment.
* Fix memory leak in the parser module: There were two leaks inFred Drake2001-12-051-5/+22
| | | | | | parser_tuple2st() and a failure to propogate an error in build_node_children() (masking yet another leak, of course!). This closes SF bug #485133 (confirmed by Insure++).
* Very subtle syntax change: in a list comprehension, the testlist inGuido van Rossum2001-10-151-1/+9
| | | | | | | | | | | | | | | "for <var> in <testlist> may no longer be a single test followed by a comma. This solves SF bug #431886. Note that if the testlist contains more than one test, a trailing comma is still allowed, for maximum backward compatibility; but this example is not: [(x, y) for x in range(10), for y in range(10)] ^ The fix involved creating a new nonterminal 'testlist_safe' whose definition doesn't allow the trailing comma if there's only one test: testlist_safe: test [(',' test)+ [',']]
* Use the abstract object interfaces when digging around in module objectsFred Drake2001-08-151-19/+19
| | | | instead of directly manipulating the underlying dictionary.
* Elaborate a comment.Fred Drake2001-07-191-1/+4
|
* The syntax trees handled by this module are not "abstract," so take theFred Drake2001-07-171-132/+136
| | | | | "A" out of the internal abbreviations. For published functions with "ast" in their names, make alternate offerings using just "st".
* Add support for yield statements.Fred Drake2001-07-171-1/+17
| | | | (Should be merged with descr branch.)
* Properly use &&. Closes bug #434989.Martin v. Löwis2001-06-231-1/+1
|
* Fix problems with validation of import statement parse trees.Fred Drake2001-01-071-5/+24
| | | | This closes SF bug #127271.
* validate_varargslist(): Fix two bugs in this function, one that affectedFred Drake2000-12-111-11/+20
| | | | | | | it when *args and/or **kw are used, and one when they are not. This closes bug #125375: "parser.tuple2ast() failure on valid parse tree".
* Ka-Ping Yee <ping@lfw.org>:Fred Drake2000-10-241-21/+21
| | | | | | Changes to error messages to increase consistency & clarity. This (mostly) closes SourceForge patch #101839.
* Simplify some of the code. Use PyErr_Format() instead of sprintf(), etc.Fred Drake2000-09-121-186/+122
| | | | Reduces lines of code and compiled object size.
* REMOVED all CWI, CNRI and BeOpen copyright markings.Guido van Rossum2000-09-011-9/+0
| | | | This should match the situation in the 1.6b1 tree.
* Do the absolute minimal amount of modifications to eradicateBarry Warsaw2000-09-011-5/+4
| | | | | | | | | | | | | | | Py_FatalError() from module initialization functions. The importing mechanism already checks for PyErr_Occurred() after module importation and it Does The Right Thing. Unfortunately, the following either were not compiled or tested by the regression suite, due to issues with my development platform: almodule.c cdmodule.c mpzmodule.c puremodule.c timingmodule.c