summaryrefslogtreecommitdiffstats
path: root/Python/compile.c
Commit message (Collapse)AuthorAgeFilesLines
* Plug a memory leak in com_import_stmt(): the tuple created to hold theGuido van Rossum2000-11-271-1/+2
| | | | | | "..." in "from M import ..." was never DECREFed. Leak reported by James Slaughter and nailed by Barry, who also provided an earlier version of this patch.
* SF bug 119622: compile errors due to redundant atof decls. I don't understandTim Peters2000-11-141-1/+0
| | | | | | the bug report (for details, look at it), but agree there's no need for Python to declare atof itself: we #include stdlib.h, and ANSI C sez atof is declared there already.
* Rationalize use of limits.h, moving the inclusion to Python.h.Fred Drake2000-09-261-6/+0
| | | | | | | | Add definitions of INT_MAX and LONG_MAX to pyport.h. Remove includes of limits.h and conditional definitions of INT_MAX and LONG_MAX elsewhere. This closes SourceForge patch #101659 and bug #115323.
* com_continue_stmt(): Improve error message when continue is foundFred Drake2000-09-081-1/+22
| | | | | | in a try statement in a loop. This is related to SourceForge bug #110830.
* changed \x to consume exactly two hex digits. implements PEP-223Fredrik Lundh2000-09-021-16/+28
| | | | for 8-bit strings.
* 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.
* Replace the run-time 'future-bytecode-stream-inspection' hack to find outThomas Wouters2000-08-271-2/+16
| | | | | | | how 'import' was called with a compiletime mechanism: create either a tuple of the import arguments, or None (in the case of a normal import), add it to the code-block constants, and load it onto the stack before calling IMPORT_NAME.
* Re-allow 'import mod.submod as s', and change its meaning to what it shouldThomas Wouters2000-08-271-2/+5
| | | | mean; the same as 'from mod import submod as s'.
* Oops, one pop too many.Thomas Wouters2000-08-271-1/+0
|
* Fix allowable node-types for assignment, need to add 'listmaker'.Thomas Wouters2000-08-251-1/+1
| | | | | | | (This fix is a bit broken, just as the test already was: the test for testlist and listmaker are done always, whereas the test for exprlist and the actual abort() are only done if Py_DEBUG is defined. Suggestions welcome, I guess ;)
* Support for three-token characters (**=, >>=, <<=) which was written byThomas Wouters2000-08-241-33/+188
| | | | | Michael Hudson, and support in general for the augmented assignment syntax. The graminit.c patch is large!
* Charles G. Waldman <cgw@fnal.gov>:Fred Drake2000-08-241-2/+32
| | | | | | | | | Add the EXTENDED_ARG opcode to the virtual machine, allowing 32-bit arguments to opcodes instead of being forced to stick to the 16-bit limit. This is especially useful for machine-generated code, which can be too long for the SET_LINENO parameter to fit into 16 bits. This closes the implementation portion of SourceForge patch #100893.
* require list comprehensions to start with a for clauseSkip Montanaro2000-08-221-4/+4
|
* com_print_stmt(): Guido rightly points out that the stream expressionBarry Warsaw2000-08-211-5/+22
| | | | | in extended prints should only be evaluated once. This patch plays stack games (documented!) to fix this.
* PEP 214, Extended print Statement, has been accepted by the BDFL.Barry Warsaw2000-08-211-8/+36
| | | | | | com_print_stmt(): Implement recognition of, and byte compilation for, extended print using new byte codes PRINT_ITEM_TO and PRINT_NEWLINE_TO.
* Disallow "import mod.submod as m", because the result is ambiguous. Does itThomas Wouters2000-08-191-1/+2
| | | | | | | | | | load mod.submod as m, or mod as m ? Both can be achieved differently, and unambiguously. Also attempt to document this restriction (editor appreciated!) Note that this is an artificial check during compile, because incorporating this in the grammar is hard, and then adjusting the compiler to do the right thing with the right nodes is harder.
* com_error(): Quiet gcc -Wall warning.Barry Warsaw2000-08-181-1/+0
|
* Apply SF patch #101135, adding 'import module as m' and 'from module importThomas Wouters2000-08-171-6/+38
| | | | | | | | name as n'. By doing some twists and turns, "as" is not a reserved word. There is a slight change in semantics for 'from module import name' (it will now honour the 'global' keyword) but only in cases that are explicitly undocumented.
* Fix new compiler warnings. Unused var in compile.c. Argsize mismatchesTim Peters2000-08-151-1/+0
| | | | | | in binascii.c (only on platforms with signed chars -- although Py_CHARMASK is documented as returning an int, it only does so on platforms with signed chars).
* Remove the osdefs.h #include; it was not needed in the final version ofFred Drake2000-08-151-1/+0
| | | | my last set of changes.
* When raising a SyntaxError, make a best-effort attempt to set theFred Drake2000-08-151-9/+29
| | | | | | | | | | filename and lineno attributes, but do not mask the SyntaxError if we fail. This is part of what is needed to close SoruceForge bug #110628 (Jitterbug PR#278). Wrap a long line to fit in under 80 columns.
* The list comp patch checked for the second child node of the 'listmaker'Thomas Wouters2000-08-131-1/+1
| | | | | node, without checking if the node actually had more than one child. It can have only one node, though: '[' test ']'. This fixes it.
* The list comprehensions patch partly reversed the removal of UNPACK_LIST,Thomas Wouters2000-08-121-13/+0
| | | | re-introducing com_assign_list, now unused. Removed it.
* list comprehensions. seeSkip Montanaro2000-08-121-14/+129
| | | | | | http://sourceforge.net/patch/?func=detailpatch&patch_id=100654&group_id=5470 for details.
* Merge UNPACK_LIST and UNPACK_TUPLE into a single UNPACK_SEQUENCE, since theyThomas Wouters2000-08-111-18/+5
| | | | | | | did the same anyway. I'm not sure what to do with Tools/compiler/compiler/* -- that isn't part of distutils, is it ? Should it try to be compatible with old bytecode version ?
* When returning an error from jcompile() (which is passed through byGuido van Rossum2000-08-071-0/+8
| | | | | PyNode_Compile()), make sure that an exception is actually set -- otherwise someone stomped on our error. [2.0 checkin of this fix.]
* Fix some strange indentation and grammar that have been bugging me forThomas Wouters2000-08-051-6/+5
| | | | weeks.
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-324/+104
| | | | declarations yet, those come later.
* just fixing the indentationPeter Schneider-Kamp2000-07-131-1/+1
|
* raise error on duplicate function argumentsPeter Schneider-Kamp2000-07-131-1/+10
| | | | | | | | example: >>> def f(a,a):print a ... SyntaxError: duplicate argument in function definition
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-29/+29
|
* Include limits.h if we have it.Jack Jansen2000-07-031-0/+3
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Trent Mick <trentm@activestate.com>:Fred Drake2000-06-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | The common technique for printing out a pointer has been to cast to a long and use the "%lx" printf modifier. This is incorrect on Win64 where casting to a long truncates the pointer. The "%p" formatter should be used instead. The problem as stated by Tim: > Unfortunately, the C committee refused to define what %p conversion "looks > like" -- they explicitly allowed it to be implementation-defined. Older > versions of Microsoft C even stuck a colon in the middle of the address (in > the days of segment+offset addressing)! The result is that the hex value of a pointer will maybe/maybe not have a 0x prepended to it. Notes on the patch: There are two main classes of changes: - in the various repr() functions that print out pointers - debugging printf's in the various thread_*.h files (these are why the patch is large) Closes SourceForge patch #100505.
* Trent Mick's Win64 changes: size_t vs. int or long; also some overflowGuido van Rossum2000-06-281-8/+12
| | | | tests.
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-1/+1
| | | | | | | | | | 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.)
* Marc-Andre Lemburg:Guido van Rossum2000-05-011-1/+1
| | | | | | | 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"...").
* Charles G Waldman:Guido van Rossum2000-04-281-36/+49
| | | | | | | | 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.
* M.-A. Lemburg <mal@lemburg.com>:Fred Drake2000-04-131-2/+23
| | | | | Fixed problem with Unicode string concatenation: u = (u"abc" u"abc") previously dumped core.
* Patch by Vladimir Marangozov to include the function name whenGuido van Rossum2000-04-101-2/+6
| | | | | | | 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.]
* Vladimir Marangozov: This fixes the line number in the stringGuido van Rossum2000-04-071-4/+2
| | | | | representation of code objects when optimization is on (python -O). It was always reported as -1 instead of the real lineno.
* remove reference (vestigal) to CALL_FUNCTION_STARJeremy Hylton2000-03-291-1/+1
|
* slightly modified version of Greg Ewing's extended call syntax patchJeremy Hylton2000-03-281-2/+23
| | | | | | | | | | | | | | | | | | | | | | | 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
* Marc-Andre Lemburg: support for Unicode string literals (u"...", ur"...").Guido van Rossum2000-03-101-3/+22
|
* The cleanup code in com-init() at label fail_0000 should removeGuido van Rossum1999-12-201-1/+1
| | | | c_varnames, not c_lnotab.
* Tim Peters writes:Guido van Rossum1999-09-151-1/+1
| | | | | | | | 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.
* Implement -OO; "unsafe" optimization that removes docstrings.Guido van Rossum1999-01-281-0/+3
| | | | Marc-Andre Lemburg.
* Remove prototypes for PyOS_strto[u]l -- Chris Herborth.Guido van Rossum1998-12-101-3/+0
|
* Add more SET_LINENO instructions in long argument listsGuido van Rossum1998-12-101-1/+7
|