summaryrefslogtreecommitdiffstats
path: root/Python
Commit message (Collapse)AuthorAgeFilesLines
* Backed out the unistr() builtin.Marc-André Lemburg2001-01-191-18/+0
|
* clearer error messages for apply() and "no locals"Jeremy Hylton2001-01-192-11/+18
|
* This patch introduces an extra pass to the compiler that generates aJeremy Hylton2001-01-191-284/+1036
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | symbol table for each top-level compilation unit. The information in the symbol table allows the elimination of the later optimize() pass; the bytecode generation emits the correct opcodes. The current version passes the complete regression test, but may still contain some bugs. It's a fairly substantial revision. The current code adds an assert() and a test that may lead to a Py_FatalError(). I expect to remove these before 2.1 beta 1. The symbol table (struct symtable) is described in comments in the code. The changes affects the several com_XXX() functions that were used to emit LOAD_NAME and its ilk. The primary interface for this bytecode is now com_addop_varname() which takes a kind and a name, where kind is one of VAR_LOAD, VAR_STORE, or VAR_DELETE. There are many other smaller changes: - The name mangling code is no longer contained in ifdefs. There are two functions that expose the mangling logical: com_mangle() and symtable_mangle(). - The com_error() function can accept NULL for its first argument; this is useful with is_constant_false() is called during symbol table generation. - The loop index names used by list comprehensions have been changed from __1__ to [1], so that they can not be accessed by Python code. - in com_funcdef(), com_argdefs() is now called before the body of the function is compiled. This provides consistency with com_lambdef() and symtable_funcdef(). - Helpers do_pad(), dump(), and DUMP() are added to aid in debugging the compiler.
* Fix for the bug in complex() just reported by Ping.Guido van Rossum2001-01-191-1/+7
|
* SF Patch #103250, by pj99: Optimize a strspn() out of startup.Guido van Rossum2001-01-191-4/+21
| | | | Minor startup speedup: avoid a call to strspn().
* Add my name to the copyright notice.Guido van Rossum2001-01-181-1/+5
|
* Variant of SF patch 103252: Startup optimize: read *.pyc as string, not with ↵Tim Peters2001-01-181-0/+47
| | | | getc().
* Move distributed and duplicated config for stat() and fstat() into pyport.h.Tim Peters2001-01-182-29/+0
|
* Get rid of the initialization of _PyCompareState_Key.Guido van Rossum2001-01-171-2/+0
|
* This patch adds a new builtin unistr() which behaves like str()Marc-André Lemburg2001-01-171-0/+18
| | | | | | | | | | except that it always returns Unicode objects. A new C API PyObject_Unicode() is also provided. This closes patch #101664. Written by Marc-Andre Lemburg. Copyright assigned to Guido van Rossum.
* Use rich comparisons in min and max.Guido van Rossum2001-01-171-9/+9
|
* Rich comparisons fall-out:Guido van Rossum2001-01-171-148/+147
| | | | | | | | | | | | - Use PyObject_RichCompare*() where possible: when comparing keyword arguments, in _PyEval_SliceIndex(), and of course in cmp_outcome(). Unrelated stuff: - Removed all trailing whitespace. - Folded some long lines.
* This patch makes sure that the function name always appears in the errorKa-Ping Yee2001-01-152-55/+89
| | | | | | | message, and tries to make the messages more consistent and helpful when the wrong number of arguments or duplicate keyword arguments are supplied. Comes with more tests for test_extcall.py and and an update to an error message in test/output/test_pyexpat.
* Added a separate extension (.carbon.slb) for Carbon dynamic modules.Jack Jansen2001-01-151-0/+4
|
* Neil discovered a bad DECREF on warnoptions, that caused repeatedGuido van Rossum2001-01-131-2/+1
| | | | | | re-initializing Python (Py_Finalize() followed by Py_Initialize()) to blow up quickly. With the DECREF removed I can't get it to fail any more. (Except it still leaks, but that's probably a separate issue.)
* Update the docstring for apply() so that "args" is marked as optionalFred Drake2001-01-121-1/+1
| | | | (since it is).
* Two changes to from...import:Guido van Rossum2001-01-121-30/+54
| | | | | | | | | | | 1) "from M import X" now works even if M is not a real module; it's basically a getattr() operation with AttributeError exceptions changed into ImportError. 2) "from M import *" now looks for M.__all__ to decide which names to import; if M.__all__ doesn't exist, it uses M.__dict__.keys() but filters out names starting with '_' as before. Whether or not __all__ exists, there's no restriction on the type of M.
* (Modified) patch by Ping - SF Patch #102681.Guido van Rossum2001-01-121-27/+33
| | | | | | | | | - Make error messages from issubclass() and isinstance() a bit more descriptive (Ping, modified by Guido) - Couple of tiny fixes to other docstrings (Ping) - Get rid of trailing whitespace (Guido)
* Fixed bugs noted by Greg SteinMoshe Zadka2001-01-111-0/+2
| | | | | * x wasn't initialized to NULL * Did not DECREF result from displayhook function
* stdout is sometimes a macro; use "outf" instead.Greg Stein2001-01-111-5/+5
| | | | Submitted by: Mark Favas <m.favas@per.dem.csiro.au>
* Implementation of PEP-0217.Moshe Zadka2001-01-112-27/+63
| | | | This closes the PEP, and patch 103170
* Add missing Py_DECREF in fast_cfunction. Partial fix for SF bugCharles G. Waldman2001-01-101-3/+6
| | | | #127699.
* Oops, one more part of the cygwin patch (SF patch #102409 by jlt63:Guido van Rossum2001-01-101-1/+1
| | | | | | | | Cygwin Python DLL and Shared Extension Patch). Add module.dll as a valid extension. jlt63 writes: Note that his change essentially backs out the fix for bug #115973. Should ".pyd" be retained instead for posterity?
* SF Patch #103154 by jlt63: Cygwin Check Import Case Patch.Guido van Rossum2001-01-101-1/+13
| | | | | Note: I've reordered acconfig.h and config.h.in to obtain alphabetical order (modulo case and leading _).
* Fix signed/unsigned wng. Unfortunately, (unsigned char) << intTim Peters2001-01-051-2/+2
| | | | has type int in C.
* When a PyCFunction that takes only positional parameters is called withFred Drake2001-01-041-18/+19
| | | | | | | | | | an empty keywords dictionary (via apply() or the extended call syntax), the keywords dict should be ignored. If the keywords dict is not empty, TypeError should be raised. (Between the restructuring of the call machinery and this patch, an empty dict in this situation would trigger a SystemError via PyErr_BadInternalCall().) Added regression tests to detect errors for this.
* Recognize pyc files even if they don't end in pyc.Martin v. Löwis2001-01-041-7/+33
| | | | Patch #103067 with modifications as discussed in email.
* Add NotImplemented to the builtin module.Neil Schemenauer2001-01-041-0/+3
|
* Revised implementation of CALL_FUNCTION and friends.Jeremy Hylton2001-01-031-296/+429
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | More revision still needed. Much of the code that was in the mainloop was moved to a series of helper functions. PyEval_CallObjectWithKeywords was split into two parts. The first part now only does argument handling. The second part is now named call_object and delegates the call to a call_(function,method,etc.) helper. XXX The call_XXX helper functions should be replaced with tp_call functions for the respective types. The CALL_FUNCTION implementation contains three kinds of optimization: 1. fast_cfunction and fast_function are called when the arguments on the stack can be passed directly to eval_code2() without copying them into a tuple. 2. PyCFunction objects are dispatched immediately, because they are presumed to occur more often than anything else. 3. Bound methods are dispatched inline. The method object contains a pointer to the function object that will be called. The function is called from within the mainloop, which may allow optimization #1 to be used, too. The extened call implementation -- f(*args) and f(**kw) -- are implemented as a separate case in the mainloop. This allows the common case of normal function calls to execute without wasting time on checks for extended calls, although it does introduce a small amount of code duplication. Also, the unused final argument of eval_code2() was removed. This is probably the last trace of the access statement :-).
* CHange error messages for ord(), using "string" instead of "string or Unicode"Andrew M. Kuchling2000-12-231-2/+3
|
* Whoops! Two stray characters crept in to my last check-inAndrew M. Kuchling2000-12-201-1/+1
|
* Patch #102955, fixing one of the warnings in bug #121479:Andrew M. Kuchling2000-12-201-5/+7
| | | | | Simplifies ord()'s logic at the cost of some code duplication, removing a " `ord' might be used uninitialized in this function" warning
* Add definitions for PySys_ResetWarnOptions() andGuido van Rossum2000-12-151-0/+39
| | | | PySys_AddWarnOption().
* Add PyErr_Warn().Guido van Rossum2000-12-151-0/+34
|
* Add definitions for standard warning category classes (PyExc_WarningGuido van Rossum2000-12-151-0/+36
| | | | etc.).
* Use c2pstr() in stead of Pstring() to convert C-strings toJack Jansen2000-12-121-3/+4
| | | | | Pascal-strings. Safer, because Pstring converts in-place and the pathname may be reused later for error messages.
* vgetargskeywords(): Patch for memory leak identified in bug #119862.Barry Warsaw2000-12-111-0/+1
|
* _getframe(): New sys module function for getting at the stack frame.Barry Warsaw2000-12-061-0/+37
| | | | | Implements and closes SF patch #102106, with Guido's suggested documentation changes.
* Make isinstance() more permissive in what types of arguments itNeil Schemenauer2000-12-041-17/+9
| | | | | accepts. Clarify exception messages for isinstance() and issubclass(). Closes bug #124106.
* Clarified some of the error messages, esp. "read-only characterGuido van Rossum2000-12-011-17/+16
| | | | buffer" replaced by "string or read-only character buffer".
* 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-142-3/+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.
* Fix syntax error. Submitted by Bill Bumgarner. Apparently this isGuido van Rossum2000-11-131-1/+1
| | | | still in use, for Apple Mac OSX.
* Rip out DOS-8x3 support.Guido van Rossum2000-11-131-17/+2
|
* Move our own getopt() implementation to _PyOS_GetOpt(), and use itThomas Wouters2000-11-032-32/+19
| | | | | | | | | regardless of whether the system getopt() does what we want. This avoids the hassle with prototypes and externs, and the check to see if the system getopt() does what we want. Prefix optind, optarg and opterr with _PyOS_ to avoid name clashes. Add new include file to define the right symbols. Fix Demo/pyserv/pyserv.c to include getopt.h itself, instead of relying on Python to provide it.
* Fix for SF bug #117241Jeremy Hylton2000-10-301-1/+15
| | | | | | | | | When a method is called with no regular arguments and * args, defer the first arg is subclass check until after the * args have been expanded. N.B. The CALL_FUNCTION implementation is getting really hairy; should review it to see if it can be simplified.
* Patch 102114, Bug 11725. On OpenBSD (but apparently not on the otherGuido van Rossum2000-10-251-2/+7
| | | | BSDs) you need a leading underscore in the dlsym() lookup name.
* Ka-Ping Yee <ping@lfw.org>:Fred Drake2000-10-244-57/+76
| | | | | | Changes to error messages to increase consistency & clarity. This (mostly) closes SourceForge patch #101839.
* Andy Dustman <adustman@users.sourceforge.net>:Fred Drake2000-10-121-3/+0
| | | | Eliminate unused variables to appease compiler.
* Do a better job at staying on-screen :P (Sorry, it's late here.) I'mThomas Wouters2000-10-111-1/+2
| | | | | assuming here that the ANSI-C adjacent-string-concatenation technique is allowable, now that Python requires an ANSI C compiler.