summaryrefslogtreecommitdiff
path: root/Modules/parsermodule.c
AgeCommit message (Collapse)AuthorLines
2019-11-07[2.7] bpo-38730: Fix -Wstringop-truncation warnings. (GH-17075)Benjamin Peterson-5/+6
2018-04-19[2.7] bpo-33308: Fix a crash in the parser module when convert an ST object. ↵Serhiy Storchaka-3/+3
(GH-6519) (GH-6532) Converting with line_info=False and col_info=True crashed before. (cherry picked from commit e5362eaa75a154c6e91c5b1c47719d0a0f5ca48b)
2017-04-20[2.7] [3.5] bpo-30070: Fixed leaks and crashes in errors handling in the ↵Serhiy Storchaka-32/+73
parser module. (GH-1131). (GH-1185) (#1189) (cherry picked from commit a79f4c219531c05fc8f670c1e4bbf12c081935d3). (cherry picked from commit 952a05e4e2cf082b74a1676a2804f1f43a9b7702)
2015-12-19Issue #25421: __sizeof__ methods of builtin types now use dynamic basic size.Serhiy Storchaka-1/+1
This allows sys.getsize() to work correctly with their subclasses with __slots__ defined.
2012-12-18Issue #16714: use 'raise' exceptions, don't 'throw'.Andrew Svetlov-3/+3
Patch by Serhiy Storchaka.
2012-08-15Issue #15604: Update uses of PyObject_IsTrue() to check for and handle ↵Antoine Pitrou-5/+13
errors correctly. Patch by Serhiy Storchaka.
2012-08-03#15512: Declarations reorganizationJesus Cea-21/+23
2012-08-03Closes #15512: Correct __sizeof__ support for parserJesus Cea-2/+21
2011-03-15#11515: fix several typos. Patch by Piotr Kasprzyk.Ezio Melotti-1/+1
2010-07-04Issue #9130: Fix validation of relative imports in parser module.Mark Dickinson-3/+4
2010-07-04Issue #9128: Validate class decorator syntax correctly in parser module.Mark Dickinson-8/+9
2010-06-30Issue #9125: Update parser module for "except ... as ..." syntax.Mark Dickinson-4/+7
2010-05-09Untabify C files. Will watch buildbots.Antoine Pitrou-98/+98
2010-01-11Issue #2333: Backport set and dict comprehensions syntax.Alexandre Vassalotti-32/+56
2010-01-09Issue #2335: Backport set literals syntax from Python 3.x.Alexandre Vassalotti-22/+49
2009-05-25Allow multiple context managers in one with statement, as proposedGeorg Brandl-15/+18
in http://codereview.appspot.com/53094 and accepted by Guido. The construct is transformed into multiple With AST nodes so that there should be no problems with the semantics.
2009-05-14Issue #5918: Fix a crash in the parser module.Antoine Pitrou-2/+2
Patch by Amaury.
2008-12-05#4529: fix parser's validation for try-except-finally statements.Georg Brandl-23/+23
2008-11-24#4396 make the parser module correctly validate the with syntaxBenjamin Peterson-1/+37
2008-11-03#4048 make the parser module accept relative imports as validBenjamin Peterson-2/+2
2008-10-31make sure the parser flags and passed onto the compilerBenjamin Peterson-7/+36
This fixes "from __future__ import unicode_literals" in an exec statment See #4225
2008-07-233k-warn about parser's "ast" aliases.Georg Brandl-5/+37
2008-06-09This reverts r63675 based on the discussion in this thread:Gregory P. Smith-7/+7
http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread.
2008-05-26Renamed PyString to PyBytesChristian Heimes-7/+7
2008-05-20Revert copy_reg -> copyreg rename.Georg Brandl-1/+1
2008-05-11Added module stub for copy_reg renaming in 3.0.Alexandre Vassalotti-1/+1
Renamed copy_reg to copyreg in the standard library, to avoid spurious warnings and ease later merging to py3k branch. Public documentation remains intact.
2008-02-23Patch #1759: Backport of PEP 3129 class decoratorsChristian Heimes-10/+25
with some help from Georg
2008-01-03Modified PyImport_Import and PyImport_ImportModule to always use absolute ↵Christian Heimes-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
2007-12-19#1629: Renamed Py_Size, Py_Type and Py_Refcnt to Py_SIZE, Py_TYPE and ↵Christian Heimes-3/+3
Py_REFCNT. Macros for b/w compatibility are available.
2007-07-21PEP 3123: Provide forward compatibility with Python 3.0, while keepingMartin v. Löwis-5/+4
backwards compatibility. Add Py_Refcnt, Py_Type, Py_Size, and PyVarObject_HEAD_INIT.
2006-08-22Expose column offset information in parse trees.Jeremy Hylton-15/+30
2006-05-25Replace PyObject_CallFunction calls with only object argsGeorg Brandl-2/+2
with PyObject_CallFunctionObjArgs, which is 30% faster.
2006-04-12Update for new grammarNeal Norwitz-4/+4
2006-03-26Years in the making.Tim Peters-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.
2006-03-20SF #1445431, fix some leaks in error conditions.Neal Norwitz-9/+14
2006-03-01Patch #1440601: Add col_offset attribute to AST nodes.Martin v. Löwis-1/+1
2006-02-28SF patch #1438387, PEP 328: relative and absolute imports.Thomas Wouters-12/+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.
2006-02-27unconst.Martin v. Löwis-9/+9
2006-02-27Update for PEP 308 patch.Thomas Wouters-3/+54
2006-02-16Use Py_ssize_t for counts and sizes.Martin v. Löwis-1/+1
2006-02-15Merge ssize_t branch.Martin v. Löwis-5/+6
2006-01-19Check return result from Py_InitModule*(). This API can fail.Neal Norwitz-0/+2
Probably should be backported.
2005-12-10Add const to several API functions that take char *.Jeremy Hylton-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 *.
2005-08-02PEP 342 implementation. Per Guido's comments, the generator throw()Phillip J. Eby-11/+44
method still needs to support string exceptions, and allow None for the third argument. Documentation updates are needed, too.
2005-04-09Flush out support for ``class B(): pass`` syntax by adding support to theBrett Cannon-6/+15
'parser' module and 'compiler' package. Closes patch #1176012. Thanks logistix.
2004-08-31SF patch #1007189, multi-line imports, for instance:Anthony Baxter-34/+86
"from blah import (foo, bar baz, bongo)"
2004-08-17This is Mark Russell's patch:Michael W. Hudson-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)
2004-08-02PEP-0318, @decorator-style. In Guido's words:Anthony Baxter-9/+62
"@ seems the syntax that everybody can hate equally" Implementation by Mark Russell, from SF #979728.
2004-05-19SF patch #872326: Generator expression implementationRaymond Hettinger-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.
2003-11-20Getting rid of all the code inside #ifdef macintosh too.Jack Jansen-4/+0