summaryrefslogtreecommitdiffstats
path: root/Python/ceval.c
Commit message (Collapse)AuthorAgeFilesLines
* 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!
* Inline PyObject_CallObject (Marc-Andre Lemburg).Guido van Rossum1997-08-301-0/+5
|
* eval_code2(), set_exc_info(): Call PyErr_NormalizeException() theBarry Warsaw1997-08-281-2/+2
| | | | | | former rather than the latter, since PyErr_NormalizeException takes PyObject** and I didn't want to change the interface for set_exc_info (but I did want the changes propagated to eval_code2!).
* unpack_sequence(): In finally clause, watch out for Py_DECREFBarry Warsaw1997-08-251-2/+2
| | | | evaluating its arguments twice.
* eval_code2(): collapsed the implementations of UNPACK_TUPLE andBarry Warsaw1997-08-251-33/+74
| | | | | | | | | | | | | | UNPACK_LIST byte codes and added a third code path that allows generalized sequence unpacking. Now both syntaxes: a, b, c = seq [a, b, c] = seq can be used to unpack any sequence with the exact right number of items. unpack_sequence(): out-lined implementation of generalized sequence unpacking. tuple and list unpacking are still inlined.
* cmp_exception gets promoted (essentially) to the C API functionBarry Warsaw1997-08-221-59/+10
| | | | | | | | | | | PyErr_GivenExceptionMatches(). set_exc_info(): make sure to normalize exceptions. do_raise(): Use PyErr_NormalizeException() if type is a class. loop_subscript(): Use PyErr_ExceptionMatches() instead of raw pointer compare for PyExc_IndexError.
* Reverse the search order for the Don Beaudry hook so that the firstGuido van Rossum1997-08-221-4/+3
| | | | class wins. Makes more sense.
* Renamed a local label that was accidentally grandly renamed toGuido van Rossum1997-08-051-3/+3
| | | | 'Py_Cleanup' back to 'cleanup'.
* The last of the mass checkins for separate (sub)interpreters.Guido van Rossum1997-08-021-9/+20
| | | | | | | Everything should now work again. See the comments for the .h files mass checkin (e.g. pystate.h) for more detail.
* Extend the "Don Beaudry hack" with "Guido's corollary" -- if the baseGuido van Rossum1997-07-311-10/+27
| | | | | class has a __class__ attribute, call that to create the new class. This allows us to write metaclasses purely in C!
* Moved PyEval_{Acquire,Release}Thread() to within the same #ifdefGuido van Rossum1997-07-191-21/+23
| | | | | | WITH_THREAD as PyEval_InitThreads(). Removed use of Py_SuppressPrintingFlag.
* PyEval_SaveThread() and PyEval_RestoreThread() now return/take aGuido van Rossum1997-07-181-6/+28
| | | | | | | | | | | | | | | | PyThreadState pointer instead of a (frame) PyObject pointer. This makes much more sense. It is backward incompatible, but that's no problem, because (a) the heaviest users are the Py_{BEGIN,END}_ ALLOW_THREADS macros here, which have been fixed too; (b) there are very few direct users; (c) those who use it are there will probably appreciate the change. Also, added new functions PyEval_AcquireThread() and PyEval_ReleaseThread() which allows the threads created by the thread module as well threads created by others (!) to set/reset the current thread, and at the same time acquire/release the interpreter lock. Much saner.
* Huge speedup by inlining some common integer operations:Guido van Rossum1997-07-171-5/+75
| | | | | | | int+int, int-int, int <compareop> int, and list[int]. (Unfortunately, int*int is way too much code to inline.) Also corrected a NULL that should have been a zero.
* PyObject_Compare can raise an exception now.Guido van Rossum1997-05-231-0/+7
|
* Py_FlushLine and PyFile_WriteString now return error indicatorsGuido van Rossum1997-05-221-12/+24
| | | | instead of calling PyErr_Clear(). Add checking of those errors.
* Plug leak of stack frame object in exception handling code.Guido van Rossum1997-05-201-9/+26
| | | | | Also delay DECREF calls until after the structures have been updated (for reentrancy awareness).
* Logic for enabling mac-specific signal handling fixed (Jack)Guido van Rossum1997-05-201-1/+1
|
* (int) cast for strlen() to keep picky compilers happy.Guido van Rossum1997-05-131-1/+1
|
* Instead of importing graminit.h whenever one of the three grammar 'root'Guido van Rossum1997-05-071-3/+3
| | | | symbols is needed, define these in Python.h with a Py_ prefix.
* Used operators from abstract.h where possible (arithmetic operators,Guido van Rossum1997-05-061-420/+30
| | | | | | get/set/del item). This removes a pile of duplication. There's no abstract operator for 'not' but I removed the function call for it anyway -- it's a little faster in-line.
* Massive changes for separate thread state management.Guido van Rossum1997-05-051-151/+263
| | | | | All per-thread globals are moved into a struct which is manipulated separately.
* Quickly renamed.Guido van Rossum1997-04-291-799/+798
|
* Clarify error message for unexpected keyword parameter.Guido van Rossum1997-03-101-1/+4
|
* *Don't* kill all local variables on function exit. This will be doneGuido van Rossum1997-02-141-12/+0
| | | | | | | | by the frameobject dealloc when it is time for the locals to go. When there's still a traceback object referencing this stack frame, we don't want the local variables to disappear yet. (Hmm... Shouldn't they be copied to the f_locals dictionary?)
* Two small changes:Guido van Rossum1997-01-271-5/+3
| | | | | | | | | - Use co->... instead of f->f_code->...; save an extra lookup of what we already have in a local variable). - Remove test for nlocals > 0 before setting fastlocals to f->f_localsplus; 0 is a rare case and the assignment is safe even then.
* Plug a leak with calling something other than a function or method isGuido van Rossum1997-01-271-4/+3
| | | | | | | called with keyword arguments -- the keyword and value were leaked. This affected for instance with a __call__() method. Bug reported and fix supplied by Jim Fulton.
* Patches for (two forms of) optional dynamic execution profiling --Guido van Rossum1997-01-241-0/+68
| | | | | | i.e., counting opcode frequencies, or (with DXPAIRS defined) opcode pair frequencies. Define DYNAMIC_EXECUTION_PROFILE on the command line (for this file and for sysmodule.c) to enable.