summaryrefslogtreecommitdiffstats
path: root/Python/pystate.c
Commit message (Collapse)AuthorAgeFilesLines
* Patch #510695: Add TSC profiling for the VM.Martin v. Löwis2004-06-081-0/+3
|
* Changed random calls to PyThreadState_Get() to use the macroNicholas Bastin2004-03-241-1/+1
|
* Initialize thread_id to 0 in unthreaded build. Fixes #770247.Martin v. Löwis2003-07-131-0/+4
|
* Add PyThreadState_SetAsyncExc(long, PyObject *).Guido van Rossum2003-06-281-0/+30
| | | | | | | | | A new API (only accessible from C) to interrupt a thread by sending it an exception. This is not always effective, but might help some people. Requested by Just van Rossum and Alex Martelli. It is intentional that you have to write your own C extension to call it from Python. Docs will have to wait.
* Patch #729300: Disable error message if Python is not built for threads.Martin v. Löwis2003-05-011-1/+1
|
* New PyGILState_ API - implements pep 311, from patch 684256.Mark Hammond2003-04-191-1/+140
|
* - pythunrun.c, Py_Finalize(): move the call to _Py_PrintReferences()Guido van Rossum2003-04-151-5/+9
| | | | | | | | | | | | | | | | | | | even farther down, to just before the call to _PyObject_DebugMallocStats(). This required the following changes: - pystate.c, PyThreadState_GetDict(): changed not to raise an exception or issue a fatal error when no current thread state is available, but simply return NULL without raising an exception (ever). - object.c, Py_ReprEnter(): when PyThreadState_GetDict() returns NULL, don't raise an exception but return 0. This means that when printing a container that's recursive, printing will go on and on and on. But that shouldn't happen in the case we care about (see first bullet). - Updated Misc/NEWS and Doc/api/init.tex to reflect changes to PyThreadState_GetDict() definition.
* Fixed SF bug #663074. The codec system was using global staticGustavo Niemeyer2003-03-191-0/+6
| | | | | | | | | variables to store internal data. As a result, any atempts to use the unicode system with multiple active interpreters, or successive interpreter executions, would fail. Now that information is stored into members of the PyInterpreterState structure.
* - PyEval_GetFrame() is now declared to return a PyFrameObject *Guido van Rossum2003-02-191-2/+2
| | | | instead of a plain PyObject *. (SF patch #686601 by Ben Laurie.)
* Assorted patches from Armin Rigo:Michael W. Hudson2002-11-081-0/+11
| | | | | | | | [ 617309 ] getframe hook (Psyco #1) [ 617311 ] Tiny profiling info (Psyco #2) [ 617312 ] debugger-controlled jumps (Psyco #3) These are forward ports from 2.2.2.
* missed this one on the previous multi-file checkin - seeSkip Montanaro2002-09-031-2/+0
| | | | http://python.org/sf/602191
* Add a low-level API to access interpreters, for David Beazley.Guido van Rossum2001-07-191-0/+25
| | | | SF patch #436376.
* Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.Martin v. Löwis2001-07-181-0/+17
| | | | Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
* This change adjusts the profiling/tracing support so that the commonFred Drake2001-07-031-0/+1
| | | | | | | | | | | | | | | | path (with no profile/trace function) through eval_code2() and eval_frame() avoids several checks. In the common cases of calls, returns, and exception propogation, eval_code2() and eval_frame() used to test two values in the thread-state: the profiling function and the tracing function. With this change, a flag is set in the thread-state if either of these is active, allowing a single check to suffice when both are NULL. This also simplifies the code needed when either function is in use but is already active (to avoid profiling/tracing the profiler/tracer); the flag is set to 0 when the profile/trace code is entered, allowing the same check to suffice for "already in the tracer" for call/return/ exception events.
* Revise the interface to the profiling and tracing support for theFred Drake2001-06-271-4/+8
| | | | | | | | | | | | | | | | | | Python interpreter. This change adds two new C-level APIs: PyEval_SetProfile() and PyEval_SetTrace(). These can be used to install profile and trace functions implemented in C, which can operate at much higher speeds than Python-based functions. The overhead for calling a C-based profile function is a very small fraction of a percent of the overhead involved in calling a Python-based function. The machinery required to call a Python-based profile or trace function been moved to sysmodule.c, where sys.setprofile() and sys.setprofile() simply become users of the new interface. As a side effect, SF bug #436058 is fixed; there is no longer a _PyTrace_Init() function to declare.
* Add a new API, PyThreadState_DeleteCurrent() that combinesGuido van Rossum2001-01-231-4/+27
| | | | | PyThreadState_Delete() and PyEval_ReleaseLock(). It is only defined if WITH_THREAD is defined.
* PyInterpreterState_New is not thread-safe, and the recent fix to _PyPcloseTim Peters2000-09-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | can cause it to get called by multiple threads simultaneously. Ditto for PyInterpreterState_Delete. Of the former, the docs say "The interpreter lock need not be held, but may be held if it is necessary to serialize calls to this function". This kinda implies it both is and isn't thread-safe. Of the latter, the docs merely say "The interpreter lock need not be held.", and the clause about serializing is absent. I expect it was *believed* these are both thread-safe, and the bit about serializing via the global lock was meant as a permission rather than a caution. I also expect we've never seen a problem here because the Python core (prior to the _PyPclose fix) only calls these functions once per run. The Py_NewInterpreter subsystem exposed by the C API (but not used by Python itself) also calls them, but that subsystem appears to be very rarely used. Whatever, they're both thread-safe now.
* 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.
* Removing warnings by gcc -Wall -- cast ugly || to void.Moshe Zadka2000-08-041-1/+1
|
* Mass ANSIfication of function definitions. Doesn't cover all 'extern'Thomas Wouters2000-07-221-17/+10
| | | | declarations yet, those come later.
* Change copyright notice - 2nd try.Guido van Rossum2000-06-301-6/+0
|
* Change copyright notice.Guido van Rossum2000-06-301-22/+7
|
* CRITICAL PATCH!Guido van Rossum1999-06-181-5/+23
| | | | | | | | | | | | | | We occasionally received reports from people getting "invalid tstate" crashes (this is a fatal error in PyThreadState_Delete()). Finally several people were able to reproduce it reliably and Tim Peters discovered that there is a race condition when multiple threads are calling this function without holding the global interpreter lock (the function may be called without holding that). Solved the race condition by adding a lock around the mutating uses of interp->tstate_head. Tim and Jonathan Giddy have run tests that make it likely that this fixes the crashes -- although Tim hasn't heard from the person who reported the original problem.
* Make current_tstate a global, _PyThreadState_Current. This is toGuido van Rossum1998-12-211-10/+10
| | | | support a macro in pystate.h.
* /* An extension mechanism to store arbitrary additional per-thread state.Guido van Rossum1998-04-101-0/+21
| | | | | | | | | | PyThreadState_GetDict() returns a dictionary that can be used to hold such state; the caller should pick a unique key and store its state there. If PyThreadState_GetDict() returns NULL, an exception has been raised (most likely MemoryError) and the caller should pass on the exception. */ PyObject * PyThreadState_GetDict()
* The warning about thread still having a frame now only happens inGuido van Rossum1997-11-031-1/+1
| | | | verbose mode.
* Added missing newline to warning msgGuido van Rossum1997-08-211-1/+1
|
* The last of the mass checkins for separate (sub)interpreters.Guido van Rossum1997-08-021-26/+102
| | | | | | | Everything should now work again. See the comments for the .h files mass checkin (e.g. pystate.h) for more detail.
* Remove confusing usage comments at end.Guido van Rossum1997-07-191-28/+0
|
* Don't use function prototypes in function definition headers.Guido van Rossum1997-05-201-4/+8
|
* Massive changes for separate thread state management.Guido van Rossum1997-05-051-0/+163
All per-thread globals are moved into a struct which is manipulated separately.