summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* Use 'void' directly instead of the ANY #define, now that all code is ANSI C.Thomas Wouters2000-07-251-5/+5
| | | | Leave the actual #define in for API compatibility.
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-112/+49
| | | | declarations yet, those come later.
* Spelling fixes supplied by Rob W. W. Hooft. All these are fixes in eitherThomas Wouters2000-07-161-1/+1
| | | | | | | | | | comments, docstrings or error messages. I fixed two minor things in test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't"). There is a minor style issue involved: Guido seems to have preferred English grammar (behaviour, honour) in a couple places. This patch changes that to American, which is the more prominent style in the source. I prefer English myself, so if English is preferred, I'd be happy to supply a patch myself ;)
* Include macglue.h for some function prototypes, and renamed a fewJack Jansen2000-07-111-0/+4
| | | | mac-specific functions to have a PyMac_ name.
* Nuke all remaining occurrences of Py_PROTO and Py_FPROTO.Tim Peters2000-07-091-31/+29
|
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* Trent Mick's Win64 changes: size_t vs. int or long; also some overflowGuido van Rossum2000-06-281-1/+1
| | | | tests.
* Trent Mick:Guido van Rossum2000-05-081-11/+14
| | | | | Change static slice_index() to extern _PyEval_SliceIndex() (with different return value interpretation: 0 for failure, 1 for success).
* Add useless 'return 1' to prtrace() to shut up VC++.Guido van Rossum2000-05-041-0/+1
|
* Vladimir Marangozov's long-awaited malloc restructuring.Guido van Rossum2000-05-031-1/+2
| | | | | | | | | | 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.)
* Charles Waldman writes:Guido van Rossum2000-04-211-14/+13
| | | | | | | | | | | | | | | | | | | | | | | | | """ Running "test_extcall" repeatedly results in memory leaks. One of these can't be fixed (at least not easily!), it happens since this code: def saboteur(**kw): kw['x'] = locals() d = {} saboteur(a=1, **d) creates a circular reference - d['x']['d']==d The others are due to some missing decrefs in ceval.c, fixed by the patch attached below. Note: I originally wrote this without the "goto", just adding the missing decref's where needed. But I think the goto is justified in keeping the executable code size of ceval as small as possible. """ [I think the circular reference is more like kw['x']['kw'] == kw. --GvR]
* Skip Montanaro: add string precisions to calls to PyErr_FormatGuido van Rossum2000-04-101-1/+1
| | | | to prevent possible buffer overruns.
* Thomas Heller fixes a typo in an error message.Guido van Rossum2000-03-311-1/+1
|
* rename args variable in CALL_FUNCTION to callargs (avoids nameJeremy Hylton2000-03-311-8/+11
| | | | | | override) add missing DECREFs in error handling code of CALL_FUNCTION
* Two fixes for extended call syntax:Jeremy Hylton2000-03-301-12/+21
| | | | | | | If a non-tuple sequence is passed as the *arg, convert it to a tuple before checking its length. If named keyword arguments are used in combination with **kwargs, make a copy of kwargs before inserting the new keys.
* eval_code2(): Oops, in the last checkin, we shouldn't check forBarry Warsaw2000-03-291-6/+2
| | | | | PyErr_Occurred(), just set x=NULL and break. Oh, and make Jeremy stop nagging me about the "special" indentation for this block.
* eval_code2(): In the extended calling syntax opcodes, you must checkBarry Warsaw2000-03-291-0/+8
| | | | | | the return value of PySequence_Length(). If an exception occurred, the returned length will be -1. Make sure this doesn't get obscurred, and that the bogus length isn't used.
* slightly modified version of Greg Ewing's extended call syntax patchJeremy Hylton2000-03-281-119/+160
| | | | | | | | | | | | | | | | | | | | | | | 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
* Allow using long integers as slice indexesAndrew M. Kuchling2000-02-231-2/+34
|
* Remove comment that Guido agree's doesn't make sense:Fred Drake2000-02-211-2/+0
| | | | | PyEval_EvalCode() is *not* a "backward compatible interface", it's the one to use!
* Fix a bug in exec_statement() noted incidentally by Tim Peters inGuido van Rossum2000-01-121-20/+13
| | | | | | | | | PR#175 -- when exec is passed a code object, it didn't sync the locals from the dictionary back into their fast representation. Also took the time to remove some repetitive code there and to do the syncing even when an exception is raised (since a partial effect should still be synced).
* Change the last PyErr_Format %s format to %.400s.Guido van Rossum1999-11-151-1/+1
|
* Fix PR117. The error message is "keywords must be strings". PerhapsGuido van Rossum1999-10-261-0/+5
| | | | | | | | not as descriptive as what Barry suggests, but this also catches the (in my opinion important) case where some other C code besides apply() constructs a kwdict that doesn't have the right format. All the other possibilities of getting it wrong (non-dict, wrong keywords etc) are already caught so this makes sense to check here.
* call_trace(): A fix for PR#73, if an exception occurred in theBarry Warsaw1999-09-081-0/+8
| | | | | | tracefunc (or profilefunc -- we're not sure which), zap the global trace and profile funcs so that we can't get into recursive loop when instantiating the resulting class based exception.
* Patch by Tim Peters:Guido van Rossum1999-06-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new builtin exception, UnboundLocalError, raised when ceval.c tries to retrieve or delete a local name that isn't bound to a value. Currently raises NameError, which makes this behavior a FAQ since the same error is raised for "missing" global names too: when the user has a global of the same name as the unbound local, NameError makes no sense to them. Even in the absence of shadowing, knowing whether a bogus name is local or global is a real aid to quick understanding. Example: D:\src\PCbuild>type local.py x = 42 def f(): print x x = 13 return x f() D:\src\PCbuild>python local.py Traceback (innermost last): File "local.py", line 8, in ? f() File "local.py", line 4, in f print x UnboundLocalError: x D:\src\PCbuild> Note that UnboundLocalError is a subclass of NameError, for compatibility with existing class-exception code that may be trying to catch this as a NameError. Unfortunately, I see no way to make this wholly compatible with -X (see comments in bltinmodule.c): under -X, [UnboundLocalError is an alias for NameError --GvR]. [The ceval.c patch differs slightly from the second version that Tim submitted; I decided not to raise UnboundLocalError for DELETE_NAME, only for DELETE_LOCAL. DELETE_NAME is only generated at the module level, and since at that level a NameError is raised for referencing an undefined name, it should also be raised for deleting one.]
* Changes by Mark Hammond for Windows CE. Mostly of the formGuido van Rossum1999-04-071-0/+2
| | | | #ifdef DONT_HAVE_header_H ... #endif around #include <header.h>.
* Always test for an error return (usually NULL or -1) without settingGuido van Rossum1999-03-091-3/+4
| | | | an exception.
* Thanks to Chris Herborth, the thread primitives now have proper Py*Guido van Rossum1998-12-211-13/+13
| | | | | names in the source code (they already had those for the linker, through some smart macros; but the source still had the old, un-Py names).
* Use PyThreadState_GET() macro.Guido van Rossum1998-12-211-1/+1
|
* Use PyInt_AS_LONG macro instead of explicit inlining.Guido van Rossum1998-12-041-6/+6
|
* Whoops! One the "redundant" initializations removed by Vladimir inGuido van Rossum1998-11-231-2/+2
| | | | | the previous patch wasn't -- there was a path through the code that bypassed all initializations. Thanks to Just for reporting the bug!
* Remove some redundant initializations -- patch by Vladimir Marangozov.Guido van Rossum1998-11-171-4/+4
|
* Changes to support other object types besides stringsGuido van Rossum1998-10-071-5/+8
| | | | | as the code string of code objects, as long as they support the (readonly) buffer interface. By Greg Stein.
* Renamed thread.h to pythread.h.Guido van Rossum1998-10-011-1/+1
|
* Add the type of the object to the error message about calling a non-function.Guido van Rossum1998-08-251-3/+5
|
* In BUILD_LIST, use PyList_SET_ITEM() instead of PyList_SetItem(); andGuido van Rossum1998-08-041-3/+1
| | | | get rid of redundant error check.
* # In case BINARY_SUBSCR, use proper PyList_GET* macros instead of inlining.Guido van Rossum1998-07-081-3/+3
|
* Marc-Andre Lemburg's patch to support instance methods with otherGuido van Rossum1998-07-081-0/+5
| | | | callable objects than regular Pythonm functions as their im_func.
* Moved cmp_member() to abstract.c, as PySequence_Contains() [withGuido van Rossum1998-05-221-53/+2
| | | | | | | | swapped arguments]. Also make sure that no use of a function pointer gotten from a tp_as_sequence or tp_as_mapping structure is made without checking it for NULL first.
* Since PyDict_GetItem() can't raise an exception any more, there's noGuido van Rossum1998-05-141-3/+0
| | | | need to call PyErr_Clear() when it returns NULL.
* DELETE_FAST should issue an exception when the local variable is undefined.Guido van Rossum1998-05-121-0/+7
|
* Make new gcc -Wall happyGuido van Rossum1998-04-101-1/+2
|
* Make first raise argument optionalGuido van Rossum1998-04-091-0/+12
|
* Last-minute fix for Jim H: don't die after del sys.stdoutGuido van Rossum1997-12-311-2/+11
|
* Plug the most annoying recursive printing problem -- reset '_' to NoneGuido van Rossum1997-12-261-3/+8
| | | | | before printing and set it to the printed variable *after* printing (and only when printing is successful).
* Give more detailed error message when the argument count isn't right.Guido van Rossum1997-11-191-4/+6
|
* Fix memory leak in exec statement with code object -- the None returnedGuido van Rossum1997-11-111-2/+4
| | | | | | by PyEval_EvalCode() on success was never DECREF'ed. Fix by Bernhard Herzog.
* Change PyEval_SaveThread() and PyEval_RestoreThread() to always do theGuido van Rossum1997-09-301-12/+9
| | | | | | tstate swapping. Only the acquiring and releasing of the lock is conditional (twice, under ``#ifdef WITH_THREAD'' and inside ``if (interpreter_lock)'').
* First part of package support.Guido van Rossum1997-09-051-10/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This doesn't yet support "import a.b.c" or "from a.b.c import x", but it does recognize directories. When importing a directory, it initializes __path__ to a list containing the directory name, and loads the __init__ module if found. The (internal) find_module() and load_module() functions are restructured so that they both also handle built-in and frozen modules and Mac resources (and directories of course). The imp module's find_module() and (new) load_module() also have this functionality. Moreover, imp unconditionally defines constants for all module types, and has two more new functions: find_module_in_package() and find_module_in_directory(). There's also a new API function, PyImport_ImportModuleEx(), which takes all four __import__ arguments (name, globals, locals, fromlist). The last three may be NULL. This is currently the same as PyImport_ImportModule() but in the future it will be able to do relative dotted-path imports. Other changes: - bltinmodule.c: in __import__, call PyImport_ImportModuleEx(). - ceval.c: always pass the fromlist to __import__, even if it is a C function, so PyImport_ImportModuleEx() is useful. - getmtime.c: the function has a second argument, the FILE*, on which it applies fstat(). According to Sjoerd this is much faster. The first (pathname) argument is ignored, but remains for backward compatibility (so the Mac version still works without changes). By cleverly combining the new imp functionality, the full support for dotted names in Python (mini.py, not checked in) is now about 7K, lavishly commented (vs. 14K for ni plus 11K for ihooks, also lavishly commented). Good night!