Commit Graph

30 Commits

Author SHA1 Message Date
Brett Cannon 55fa66dd45 Add comments about PyThreadState and the usage of its fields. 2005-06-25 07:07:35 +00:00
Martin v. Löwis f30d60edbc Patch #510695: Add TSC profiling for the VM. 2004-06-08 08:17:44 +00:00
Tim Peters 174175bf3a Added a comment about the unreferenced PyThreadState.tick_counter
member.
2004-03-29 02:24:26 +00:00
Nicholas Bastin c69ebe8d50 Enable the profiling of C functions (builtins and extensions) 2004-03-24 21:57:10 +00:00
Raymond Hettinger 4eec95ad2a SF patch #906501: Fix typos in pystate.h comments
(Contributed by Greg Chapman.)
2004-03-13 20:45:47 +00:00
Guido van Rossum b8b6d0c2c6 Add PyThreadState_SetAsyncExc(long, PyObject *).
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.
2003-06-28 21:53:52 +00:00
Mark Hammond 8d98d2cb95 New PyGILState_ API - implements pep 311, from patch 684256. 2003-04-19 15:41:53 +00:00
Gustavo Niemeyer 5ddd4c3f77 Fixed SF bug #663074. The codec system was using global static
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.
2003-03-19 00:35:36 +00:00
Guido van Rossum 6297a7a9fb - PyEval_GetFrame() is now declared to return a PyFrameObject *
instead of a plain PyObject *.  (SF patch #686601 by Ben Laurie.)
2003-02-19 15:53:17 +00:00
Michael W. Hudson 019a78e76d Assorted patches from Armin Rigo:
[ 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.
2002-11-08 12:53:11 +00:00
Skip Montanaro d581d7792b replace thread state objects' ticker and checkinterval fields with two
globals, _Py_Ticker and _Py_CheckInterval.  This also implements Jeremy's
shortcut in Py_AddPendingCall that zeroes out _Py_Ticker.  This allows the
test in the main loop to only test a single value.

The gory details are at

    http://python.org/sf/602191
2002-09-03 20:10:45 +00:00
Mark Hammond 91a681debf Excise DL_EXPORT from Include.
Thanks to Skip Montanaro and Kalle Svensson for the patches.
2002-08-12 07:21:58 +00:00
Guido van Rossum f5df46d701 Add a low-level API to access interpreters, for David Beazley.
SF patch #436376.
2001-07-19 12:19:27 +00:00
Martin v. Löwis f0473d511b Patch #412229: Add functions sys.getdlopenflags and sys.setdlopenflags.
Add dlopenflags to PyInterpreterState, and use it in dlopen calls.
2001-07-18 16:17:16 +00:00
Fred Drake 9e3ad78444 This change adjusts the profiling/tracing support so that the common
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.
2001-07-03 23:39:52 +00:00
Fred Drake 55fb6e0371 Revise the interface to the profiling and tracing support for the
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.
2001-06-27 19:18:03 +00:00
Guido van Rossum 2975786dec Add a new API, PyThreadState_DeleteCurrent() that combines
PyThreadState_Delete() and PyEval_ReleaseLock().  It is only defined
if WITH_THREAD is defined.
2001-01-23 01:46:06 +00:00
Guido van Rossum 8586991099 REMOVED all CWI, CNRI and BeOpen copyright markings.
This should match the situation in the 1.6b1 tree.
2000-09-01 23:29:29 +00:00
Fred Drake 5eb6d4e3bf ANSI-fication and Py_PROTO extermination. 2000-07-08 23:37:28 +00:00
Guido van Rossum ffcc3813d8 Change copyright notice - 2nd try. 2000-06-30 23:58:06 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Guido van Rossum a8b47fe5c6 I can't seem to do anything right :-)
As Chris H. points out, I should have added 'extern' to the
declaration of _PyThreadState_Current.  Here it is.
1998-12-21 20:21:19 +00:00
Guido van Rossum 275ea67e6b Add macro version of PyThreadState_GET(). This uses
_PyThreadState_Current, defined in pystate.c.
1998-12-21 18:28:10 +00:00
Guido van Rossum 43466ec7b0 Add DL_IMPORT(returntype) for all officially exported functions. 1998-12-04 18:48:25 +00:00
Guido van Rossum 2c69336507 On second though, NEXITFUNCS should be defined in pythonrun.c and not
here; pystate.h doesn't use it (I thought I wanted to move the array
there but that won't work).
1998-10-01 16:02:31 +00:00
Guido van Rossum ee0a63bec5 Move 'dict' struct member to end of struct. This ensures binary
compatibility for shared libraries.

*** WARNING -- IF YOU BUILT 1.5.1BETA1, DO A "MAKE CLEAN" ***
1998-04-13 20:24:05 +00:00
Guido van Rossum 204751b127 Add dict struct member and PyThreadState_GetDict() prototype. 1998-04-10 20:19:01 +00:00
Guido van Rossum 29e46a9a12 Mass checkin (more to follow for other directories).
Introduce truly separate (sub)interpreter objects.  For now, these
must be used by separate threads, created from C.  See Demo/pysvr for
an example of how to use this.  This also rationalizes Python's
initialization and finalization behavior:

Py_Initialize() -- initialize the whole interpreter
Py_Finalize() -- finalize the whole interpreter

tstate = Py_NewInterpreter() -- create a new (sub)interpreter
Py_EndInterpreter(tstate) -- delete a new (sub)interpreter

There are also new interfaces relating to threads and the interpreter
lock, which can be used to create new threads, and sometimes have to
be used to manipulate the interpreter lock when creating or deleting
sub-interpreters.  These are only defined when WITH_THREAD is defined:

PyEval_AcquireLock() -- acquire the interpreter lock
PyEval_ReleaseLock() -- release the interpreter lock

PyEval_AcquireThread(tstate) -- acquire the lock and make the thread current
PyEval_ReleaseThread(tstate) -- release the lock and make NULL current

Other administrative changes:

- The header file bltinmodule.h is deleted.

- The init functions for Import, Sys and Builtin are now internal and
  declared in pythonrun.h.

- Py_Setup() and Py_Cleanup() are no longer declared.

- The interpreter state and thread state structures are now linked
  together in a chain (the chain of interpreters is a static variable
  in pythonrun.c).

- Some members of the interpreter and thread structures have new,
  shorter, more consistent, names.

- Added declarations for _PyImport_{Find,Fixup}Extension() to import.h.
1997-08-02 02:56:48 +00:00
Guido van Rossum 59943ba718 Added Py_PROTO macros for SunOS 4.x /bin/cc. 1997-05-20 22:07:46 +00:00
Guido van Rossum a027efa5bf Massive changes for separate thread state management.
All per-thread globals are moved into a struct which is manipulated
separately.
1997-05-05 20:56:21 +00:00