Commit Graph

85 Commits

Author SHA1 Message Date
Andrew MacIntyre 80d4e2acf5 SF patch #578297:
Change the parser and compiler to use PyMalloc.

Only the files implementing processes that will request memory
allocations small enough for PyMalloc to be a win have been
changed, which are:-
 - Python/compile.c
 - Parser/acceler.c
 - Parser/node.c
 - Parser/parsetok.c

This augments the aggressive overallocation strategy implemented by
Tim Peters in PyNode_AddChild() [Parser/node.c], in reducing the
impact of platform malloc()/realloc()/free() corner case behaviour.
Such corner cases are known to be triggered by test_longexp and
test_import.

Jeremy Hylton, in accepting this patch, recommended this as a
bugfix candidate for 2.2.  While the changes to Python/compile.c
and Parser/node.c backport easily (and could go in), the changes
to Parser/acceler.c and Parser/parsetok.c require other not
insignificant changes as a result of the differences in the memory
APIs between 2.3 and 2.2, which I'm not in a position to work
through at the moment.  This is a pity, as the Parser/parsetok.c
changes are the most important after the Parser/node.c changes, due
to the size of the memory requests involved and their frequency.
2002-08-04 06:28:21 +00:00
Thomas Heller 6b17abf6c0 Fix SF Bug 564931: compile() traceback must include filename. 2002-07-09 09:23:27 +00:00
Neil Schemenauer c24ea08644 Disable the parser hacks that enabled the "yield" keyword using a future
statement.
2002-03-22 23:53:36 +00:00
Martin v. Löwis 16eff6f77b Initialize err_ret with filename if available. Fixes #498828. 2002-01-05 21:40:08 +00:00
Guido van Rossum 0c156a5130 Patch from SF bug #472956: UMR when there is a syntax error (Neal Norwitz)
perrdetail.token is unitialized when there is a syntax
    error in a file.
2001-10-20 14:27:56 +00:00
Guido van Rossum da62ecc9aa Add a really stupid warning about 'yield' used as an identifier.
This is really stupid because it cannot be suppressed or altered using
the warning framework; that's because the warning framework is built
on Python interpreter internals, and the parser generator doesn't have
access to any of those (you cannot use anything of type PyObject * in
the parser).

But it's better than nothing, and implementing a proper check for this
appears to require modifying compile.c in a dozen places, for which I
don't have the stamina today.  I promise we'll do better in 2.2a2.

At least it tells you the filename and line number (unlike the first
hack I considered :-).
2001-07-17 16:53:11 +00:00
Tim Peters fe2127d3cb Ugly. A pile of new xxxFlags() functions, to communicate to the parser
that 'yield' is a keyword.  This doesn't help test_generators at all!  I
don't know why not.  These things do work now (and didn't before this
patch):

1. "from __future__ import generators" now works in a native shell.

2. Similarly "python -i xxx.py" now has generators enabled in the
   shell if xxx.py had them enabled.

3. This program (which was my doctest proxy) works fine:

from __future__ import generators

source = """\
def f():
    yield 1
"""

exec compile(source, "", "single") in globals()
print type(f())
2001-07-16 05:37:24 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Barry Warsaw 38aa14afb6 PyParser_ParseString(): When the err_ret structure is initialized, the
fields token and expected must also be initialized, otherwise the
tests in parsetok() can generate uninitialized memory read errors.
This quiets an Insure warning.
2000-08-18 05:04:08 +00:00
Thomas Wouters 23c9e0024a Mass ANSIfication.
Work around intrcheck.c's desire to pass 'PyErr_CheckSignals' to
'Py_AddPendingCall' by providing a (static) wrapper function that has the
right number of arguments.
2000-07-22 19:20:54 +00:00
Fred Drake 85f363990c Create two new exceptions: IndentationError and TabError. These are
used for indentation related errors.  This patch includes Ping's
improvements for indentation-related error messages.

Closes SourceForge patches #100734 and #100856.
2000-07-11 17:53:00 +00:00
Tim Peters dbd9ba6a6c Nuke all remaining occurrences of Py_PROTO and Py_FPROTO. 2000-07-09 03:09:57 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Guido van Rossum 6da3434e03 Trent Mick: familiar simple Win64 patches 2000-06-28 22:00:02 +00:00
Guido van Rossum 6b7a5d8959 Jack Jansen: Removed Macintosh tab-guessing code 2000-06-28 20:54:53 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.

(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode.  I'm also holding back on his
change to main.c, which seems unnecessary to me.)
2000-05-03 23:44:39 +00:00
Guido van Rossum 89ce454498 Make sure that -t and -tt also work on strings passed to compile(). 1998-12-21 18:32:40 +00:00
Guido van Rossum 6135df6626 Declare and use Py_TabcheckFlag here. 1998-04-10 19:35:06 +00:00
Guido van Rossum ff0ec52d3c Finally plug the memory leak caused by syntax error (including
interactive EOF, which leaked *one* byte).
1997-07-27 01:52:50 +00:00
Guido van Rossum 86bea46b3d Another directory quickly renamed. 1997-04-29 21:03:06 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum ec4982761b fix strncpy call (uninitialized memory read) 1995-01-20 16:59:12 +00:00
Guido van Rossum b9f8d6e54d Added 1995 to copyright message. 1995-01-04 19:08:09 +00:00
Guido van Rossum bd0389d5fd don't call strncpy(str, NULL, 0) 1994-08-29 12:25:45 +00:00
Guido van Rossum e537240c25 * Changed many files to use mkvalue() instead of newtupleobject().
* Fixcprt.py: added [-y file] option, do only files younger than file.
* modsupport.[ch]: added vmkvalue().
* intobject.c: use mkvalue().
* stringobject.c: added "formatstring"; renamed string* to string_*;
  ceval.c: call formatstring for string % value.
* longobject.c: close memory leak in divmod.
* parsetok.c: set result node to NULL when returning an error.
1993-03-16 12:15:04 +00:00
Guido van Rossum bab9d03855 Copyright for 1992 added 1992-04-05 14:26:55 +00:00
Guido van Rossum 91ece4205b Guess tab size on the Mac from tab resource. 1992-03-25 22:32:00 +00:00
Guido van Rossum d8b1d37bd8 Append a NEWLINE token at the end of a file. 1992-03-04 16:40:44 +00:00
Guido van Rossum 56b07c8ad9 When printing an error message, don't choke if tok->buf is NULL. 1991-06-07 13:58:56 +00:00
Guido van Rossum 326f582763 Don't print the line number for syntax errors in string parsing. 1991-06-03 11:02:09 +00:00
Guido van Rossum f70e43a073 Added copyright notice. 1991-02-19 12:39:46 +00:00
Guido van Rossum 3f5da24ea3 "Compiling" version 1990-12-20 15:06:42 +00:00
Guido van Rossum 840bcf11a8 Set parse tree in parser data structure to NULL when returning
a valid parse tree to caller, so caller must free the tree.
1990-11-18 17:39:41 +00:00
Guido van Rossum 85a5fbbdfe Initial revision 1990-10-14 12:07:46 +00:00