Commit Graph

111 Commits

Author SHA1 Message Date
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 fdc8bdb67b Marc-Andre Lemburg:
Support for the new -U command line option option:
with the option enabled the Python compiler
interprets all "..." strings as u"..." (same with r"..." and
ur"...").
2000-05-01 17:54:56 +00:00
Guido van Rossum a2ace6ae25 Charles G Waldman:
Follow a suggestion in an /*XXX*/ comment [in com_add()] to speed up
compilation by using supplemental dictionaries to keep track of names
and constants, eliminating quadratic behavior.  With this patch in
place, the time to import a 5000-line file with lots of constants [at
the global level] is reduced from 20 seconds to under 3 on my system.
2000-04-28 16:42:25 +00:00
Fred Drake 4e998bc658 M.-A. Lemburg <mal@lemburg.com>:
Fixed problem with Unicode string concatenation:
u = (u"abc" u"abc") previously dumped core.
2000-04-13 14:10:44 +00:00
Guido van Rossum 44679590e0 Patch by Vladimir Marangozov to include the function name when
comparing code objects.  This give sless surprising results in
-Optimized code.  It also sorts code objects by name, now.

[I changed the patch to hash() slightly to touch fewer lines.]
2000-04-10 16:20:31 +00:00
Guido van Rossum a396a883af Vladimir Marangozov: This fixes the line number in the string
representation of code objects when optimization is on (python -O). It
was always reported as -1 instead of the real lineno.
2000-04-07 01:21:36 +00:00
Jeremy Hylton e4fb958fc2 remove reference (vestigal) to CALL_FUNCTION_STAR 2000-03-29 00:10:44 +00:00
Jeremy Hylton 7690151c7e slightly modified version of Greg Ewing's extended call syntax patch
executive summary:
Instead of typing 'apply(f, args, kwargs)' you can type 'f(*arg, **kwargs)'.
Some file-by-file details follow.

Grammar/Grammar:
    simplify varargslist, replacing '*' '*' with '**'
    add * & ** options to arglist

Include/opcode.h & Lib/dis.py:
    define three new opcodes
        CALL_FUNCTION_VAR
        CALL_FUNCTION_KW
        CALL_FUNCTION_VAR_KW

Python/ceval.c:
    extend TypeError "keyword parameter redefined" message to include
        the name of the offending keyword
    reindent CALL_FUNCTION using four spaces
    add handling of sequences and dictionaries using extend calls
    fix function import_from to use PyErr_Format
2000-03-28 23:49:17 +00:00
Guido van Rossum 5aa88f097f Marc-Andre Lemburg: support for Unicode string literals (u"...", ur"..."). 2000-03-10 23:01:36 +00:00
Guido van Rossum 72badf5404 The cleanup code in com-init() at label fail_0000 should remove
c_varnames, not c_lnotab.
1999-12-20 20:40:12 +00:00
Guido van Rossum 2174dcb061 Tim Peters writes:
For a long time I've seen absurd tracebacks under -O (e.g., negative
line numbers), but very rarely.  Since I was looking at tracebacks
anyway, thought I'd track it down.  Turns out to be Guido's only
predictable blind spot <wink -- "char" is signed on some non-GvR
systems>.  Patch follows.
1999-09-15 22:48:09 +00:00
Guido van Rossum 541563ec7e Implement -OO; "unsafe" optimization that removes docstrings.
Marc-Andre Lemburg.
1999-01-28 15:08:09 +00:00
Guido van Rossum 46e9705eca Remove prototypes for PyOS_strto[u]l -- Chris Herborth. 1998-12-10 16:57:44 +00:00
Guido van Rossum ca90605678 Add more SET_LINENO instructions in long argument lists 1998-12-10 16:56:22 +00:00
Guido van Rossum d076c73cc8 Changes to support other object types besides strings
as the code string of code objects, as long as they support
the (readonly) buffer interface.  By Greg Stein.
1998-10-07 19:42:25 +00:00
Guido van Rossum dfede31c7f Eh, better error message for the previous change. It now says
"non-default argument follows default argument".
1998-10-02 14:06:56 +00:00
Guido van Rossum 29d38cd088 Treat def f(a, b=1, c): ... as an error (missing default for c)
instead of silently supplying a default of None fore c.
1998-10-02 13:41:54 +00:00
Guido van Rossum 90f827c67e Comment out the print statement about underflow. (This only seems to
happen when you use a non-keyword argument after a keyword argument,
and in this case you also get a syntax error.  I fully suspect that
the underflow is caused by the code that stops generating code when it
detects the syntax error, but I can't find the culprit right now.  I
know, I know.)
1998-08-25 18:22:17 +00:00
Guido van Rossum 234e260d5e Since PyDict_GetItem() can't raise an exception any more, there's no
need to call PyErr_Clear() when it returns NULL.
1998-05-14 02:16:20 +00:00
Guido van Rossum d295f120ae Make first raise argument optional 1998-04-09 21:39:57 +00:00
Guido van Rossum ed1100f3b6 Don't use sscanf(s, "%x", &c) to parse \xX... escapes; hardcode it. 1997-10-20 23:24:07 +00:00
Guido van Rossum ac1fc95c3c Fixed for WITHOUT_COMPLEX compilation (Jack) 1997-10-08 15:23:55 +00:00
Guido van Rossum beef8aa719 Cprrect stuoid tyops -- was comparing variabes with themselves because
of co/cp mixup.
1997-08-29 17:12:43 +00:00
Guido van Rossum 275558cb9f Plug a leak in code_dealloc() (and reordered the deallocs to match the
order of the variables in the declarations).

Also removed an entry in the TODO list that's done.
1997-07-25 20:13:49 +00:00
Guido van Rossum db9e20f418 Fix bug reported by Just: anonymous arguments used for tuples should
have a unique name, otherwise they get squished by locals2fast (or
fast2locals, I dunno) when the debugger is invoked before they have
been transferred to real locals.
1997-07-10 01:06:53 +00:00
Guido van Rossum c8b6df9004 PyObject_Compare can raise an exception now. 1997-05-23 00:06:51 +00:00
Guido van Rossum 2f75b29630 Indent the #error directives so a classic K&R cpp doesn't see them. 1997-05-20 22:18:48 +00:00
Guido van Rossum 9a0f04d4cd Get rid of obsolete support for access statement. 1997-05-09 00:58:02 +00:00
Guido van Rossum b05a5c7698 Instead of importing graminit.h whenever one of the three grammar 'root'
symbols is needed, define these in Python.h with a Py_ prefix.
1997-05-07 17:46:13 +00:00
Guido van Rossum 79f25d9a7b Quickly renamed the remaining files -- this directory is done. 1997-04-29 20:08:16 +00:00
Guido van Rossum 644a12b00c Tweaks to keep the Microsoft compiler quier. 1997-04-09 19:24:53 +00:00
Guido van Rossum 5f5e817e00 Support for alternative string quotes (a"xx", b"xx", c"xx", ...).
In interactive mode, do generate code for single-string statements.
1997-04-06 03:41:40 +00:00
Guido van Rossum 228d7f3f67 Added assert statement. 1997-04-02 05:24:36 +00:00
Guido van Rossum 45b83915f8 New form of PyFPE_END_PROTECT macro. 1997-03-14 04:32:50 +00:00
Guido van Rossum 6af0c00ab6 Fix dumb bug calling parsestrplus with wrong node as argument.
Add prototypes for parsestr() and parsestrplus() (unrelated, but
seemed to make sense.)
1997-03-11 21:25:55 +00:00
Guido van Rossum 7c53111d5b Added support for ``if __debug__:'' -- if -O is given, this form is
recognized by the code generator and code generation for the test and
the subsequent suite is suppressed.

One must write *exactly* ``if __debug__:'' or ``elif __debug__:'' --
no parentheses or operators must be present, or the optimization is
not carried through.  Whitespace doesn't matter.  Other uses of
__debug__ will find __debug__ defined as 0 or 1 in the __builtin__
module.
1997-03-11 18:42:21 +00:00
Guido van Rossum 8e793d925c Add global Py_OptimizeFlag. SET_LINENO is omitted again unless this is
nonzero.
1997-03-03 19:13:14 +00:00
Guido van Rossum 0ae748d3c4 Changes for Lee Busby's SIGFPE patch set.
New file pyfpe.c and exception FloatingPointError.
Surround some f.p. operations with PyFPE macro brackets.
1997-02-14 22:58:07 +00:00
Guido van Rossum da4eb5c3b5 Instead of emitting SET_LINENO instructions, generate a line number
table which is incorporated in the code object.  This way, the runtime
overhead to keep track of line numbers is only incurred when an
exception has to be reported.
1997-01-24 03:43:35 +00:00
Guido van Rossum 7eb883a18e Remove unused variable. 1997-01-18 20:04:05 +00:00
Guido van Rossum 7b89b6a660 Intern all names and varnames in newcodeobject(), plus those string
literals that look like identifiers.  Also intern all strings used as
names during the compilation.
1997-01-18 08:02:57 +00:00
Guido van Rossum 8b993a98db Add co_stacksize field to codeobject structure, and stacksize argument
to PyCode_New() argument list.  Move MAXBLOCKS constant to conpile.h.

Added accurate calculation of the actual stack size needed by the
generated code.

Also commented out all fprintf statements (except for a new one to
diagnose stack underflow, and one in #ifdef'ed out code), and added
some new TO DO suggestions (now that the stacksize is taken of the TO
DO list).
1997-01-17 21:04:03 +00:00
Guido van Rossum 635abd24f0 Check for duplicate keyword arguments at compile time. 1997-01-06 22:56:52 +00:00
Guido van Rossum 80bb9655f0 Keep gcc -Wall happy. 1996-12-05 23:27:02 +00:00
Guido van Rossum d266eb460e New permission notice, includes CNRI. 1996-10-25 14:44:06 +00:00
Guido van Rossum e449af7da9 Ellipses -> Ellipsis rename (the dictionary really says that it should
be Ellipsis!).
Bumped the API version because a linker-visible symbol is affected.
Old C code will still compile -- there's a b/w compat macro.
Similarly, old Python code will still run, builtin exports both
Ellipses and Ellipsis.
1996-10-11 16:25:41 +00:00
Guido van Rossum 452a9833c9 Added line number to most compile-time error messages. 1996-09-17 14:32:04 +00:00
Guido van Rossum d8a6d1c2e7 Afterthough: leave both leading underscores in,
so __spam becomes _ClassName__spam.
1996-08-24 07:54:27 +00:00
Guido van Rossum fe2236f3c8 Oops need to mangle global statement separately 1996-08-24 07:29:04 +00:00
Guido van Rossum 8ff077b094 Name mangling, what the heck! 1996-08-24 06:21:31 +00:00