Commit Graph

90 Commits

Author SHA1 Message Date
Guido van Rossum 43713e5a28 Massive patch by Skip Montanaro to add ":name" to as many
PyArg_ParseTuple() format string arguments as possible.
2000-02-29 13:59:29 +00:00
Guido van Rossum 6b26a06037 Patch by Dieter Maurer to make things work for Tcl/Tk 8.1 (tested with
8.1.1).  His approach doesn't work with Tcl/Tk 8.2, so I've placed it
inside #if TKMAJORMINOR == 8001 and #endif.  See also his patch for
tkappinit.c.
1999-11-05 18:09:56 +00:00
Guido van Rossum 11801859e0 Include myselect.h -- needed on some platforms. 1999-01-25 21:39:03 +00:00
Guido van Rossum 65d5b5763c Thanks to Chris Herborth, the thread primitives now have proper Py*
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).
1998-12-21 19:32:43 +00:00
Guido van Rossum 3886bb6997 Add DL_EXPORT() to all modules that could possibly be used
on BeOS or Windows.
1998-12-04 18:50:17 +00:00
Guido van Rossum e9bc62d993 RajGopal Srinivasan noted that the latest code doesn't work when
running in a non-threaded environment.  He added some #ifdefs that fix
this.
1998-11-17 03:45:24 +00:00
Guido van Rossum 41f0a98f8f Looks like I didn't test this interactively. The EventHook() code was
broken; it asked for the current thread state when there was none.
Fixed by using the saved event_tstate.
1998-10-12 16:26:22 +00:00
Guido van Rossum dc1adabcb8 Patch by Jonathan Giddy (with some cleanup by me) to always use the
thread state of the thread calling mainloop() (or another event
handling function) rather than the thread state of the function that
created the client data structure.
1998-10-09 20:51:18 +00:00
Guido van Rossum 215193bd93 There's no need to declare Tk_GetNumMainWindows() (and it breaks
something in the latest win342 build).
1998-10-08 02:27:41 +00:00
Guido van Rossum 49b560698b Renamed thread.h to pythread.h. 1998-10-01 20:42:43 +00:00
Guido van Rossum 469067800b Get rid of the test for non-NULL thread state in EventHook; it can be
triggered in situations that are not an error.
1998-09-21 14:47:16 +00:00
Guido van Rossum 541f241132 Need mytime.h for Sleep(). 1998-08-13 13:29:22 +00:00
Guido van Rossum 227cf764b2 Undo a silly effect of a global substitution: the macintosh panic()
function had a reference to vPySys_WriteStderr(...) -- turn it back
into fprintf(stder, ...).
1998-08-05 13:53:32 +00:00
Guido van Rossum 43ff8683fe Temporarily get rid of the registration of Tcl_Finalize() as a
low-level Python exit handler.  This can attempt to call Python code
at a point that the interpreter and thread state have already been
destroyed, causing a Bus Error.  Given the intended use of
Py_AtExit(), I'm not convinced that it's a good idea to call it
earlier during Python's finalization sequence...  (Although this is
the only use for it in the entire distribution.)
1998-07-14 18:02:13 +00:00
Guido van Rossum c821d1ecc0 Add a cast that a picky SGI compiler found was necessary. 1998-07-07 22:25:47 +00:00
Guido van Rossum f766e23f63 There was an error check in a loop in PythonCmd which called
PythonCmd_Error() but failed to return.  The error wasn't very likely
(only when we run out of memory) but since the check is there we might
as well return the error.  (I think that Barry introduced this buglet
when he added error checks everywhere.)
1998-06-19 04:28:10 +00:00
Guido van Rossum 5e97783c8f # Note: a previous checkin message was lost because I can now use CVS
# from my PC at home, but it can't send email :-(

Add a clarifying comment about the new ENTER_OVERLAP and
LEAVE_OVERLAP_TCL macros; get rid of all the bogus tests for deleted
interpreters (Tcl already tests for this; they were left over from an
earlier misguided attempt to fix the threading).
1998-06-15 14:03:52 +00:00
Guido van Rossum 62320c9b9b # (My first checkin from Windows NT using remote CVS!)
There were some serious problem with the thread-safety code.
The basic problem was that often the result was gotten out of
the Tcl interpreter object after releasing the Tcl lock.
Of course, another thread might have changed the return value
already, and this was indeed happening.  (Amazing what trying
it on a different thread implementation does!)

The solution is to grab the Python lock without releasing the
Tcl lock, so it's safe to create a string object or set the
exceptions from the Tcl interpreter.  Once that's done, the
Tcl lock is released.

Note that it's now legal to acquire the Python lock while the
the Tcl lock is held; but the reverse is not true: the Python
lock must be released before the Tcl lock is acquired.  This
in order to avoid deadlines.  Fortunately, there don't seem to
be any problems with this.
1998-06-15 04:36:09 +00:00
Guido van Rossum ad4db17552 Fixed the EventHook() code so that it also works on Windows, sort of.
(The "sort of" is because it uses kbhit() to detect that the user
starts typing, and then no events are processed until they hit
return.)

Also fixed a nasty locking bug: EventHook() is called without the Tcl
lock set, so it can't use the ENTER_PYTHON and LEAVE_PYTHON macros,
which manipulate both the Python and the Tcl lock.  I now only acquire
and release the Python lock.

(Haven't tested this on Unix yet...)
1998-06-13 13:56:28 +00:00
Guido van Rossum 2a5119b680 On Windows, need #include <windows.h>; and it's MS_WINDOWS, not MS_WIN32. 1998-05-29 01:28:40 +00:00
Guido van Rossum 00d93066b0 Changes to make it possible to write multi-threaded programs using
Tkinter.  This adds a separate lock -- read the comments.  (This was
also needed for Mark Hammond's attempts to make PythonWin
Tkinter-friendly.)

The changes have affected the EventHook slightly, too; and I've done
some more cleanup of the code that deals with the different versions
of Tcl_CreateFileHandler().
1998-05-28 23:06:38 +00:00
Guido van Rossum 7bf15648a4 Use a different implementation of EventHook(). The new version
registers an input file handler for stdin with Tcl and handles Tcl
events until something is available on stdin; it then deletes the
handler and returns from EventHook().

This works with or without GNU readline, and doesn't busy-wait.

It still doesn't work for Mac or Windows :-(
1998-05-22 18:28:17 +00:00
Guido van Rossum b41addf6a6 Replace all calls to fprintf(stderr, ...) with calls to PySys_WriteStderr(...). 1998-05-12 15:02:41 +00:00
Guido van Rossum 597ac20708 Trivial little change: timer tokens shouldn't have a Print() function,
they should have a Repr() function.
1998-05-12 14:36:19 +00:00
Guido van Rossum 212643f199 Still somewhat experimental speedup. This appears to speed up the
most common interface to Tcl, the call() method, by maybe 20-25%.

The speedup code avoids the construction of a Tcl command string from
the argument list -- the Tcl argument list is immediately parsed back
by Tcl_Eval() into a list that is *guaranteed* (by Tcl_Merge()) to be
exactly the same list, so instead we look up the command info and call
the command function directly.  If the lookup fails, we fall back to
the old method (Tcl_Merge() + Tcl_Eval()) so we don't need to worry
about special cases like undefined commands or the occasional command
("after") that sets the info.proc pointer to NULL -- let TclEval()
deal with these.
1998-04-29 16:22:14 +00:00
Guido van Rossum 9d1b7ae65b Add a new method of interpreter objects, interpaddr(). This returns
the address of the Tcl interpreter object, as an integer.  Not very
useful for the Python programmer, but this can be called by another C
extension that needs to make calls into the Tcl/Tk C API and needs to
get the address of the Tcl interpreter object.  A simple cast of the
return value to (Tcl_Interp *) will do the trick now.
1998-04-29 16:17:01 +00:00
Guido van Rossum 2ea1c94b9a On the Mac a call to TkMacInitMenus is needed. Also, we pass
appropriate events to Sioux so the console window remains functional.
(Jack)
1998-04-28 16:12:43 +00:00
Guido van Rossum 2621637835 Add #ifdefs so Tcl_Finalize isn't referenced when it's not defined. 1998-04-20 18:47:52 +00:00
Guido van Rossum 730806d3d9 Make new gcc -Wall happy 1998-04-10 22:27:42 +00:00
Guido van Rossum 1c0d31565d Delete the 'exit' command from the Tcl interpreter -- it would allow
users to exit Python without the normal precautions.  (The can do this
using os._exit() anyway, but at least that's documented.)
1998-02-19 21:28:49 +00:00
Guido van Rossum 07e9fbf6b9 Register Tcl_Finalize as a Python exit handler. 1998-02-06 22:35:46 +00:00
Guido van Rossum a59406abdf Darn. When thread support is disabled, the BEGIN/END macros don't
save and restore the tstate, but explicitly calling
PyEval_SaveThread() does reset it!  While I think about how to fix
this for real, here's a fix that avoids getting a fatal error.
1997-10-10 17:39:19 +00:00
Guido van Rossum b0105444e2 Mac does support createfilehandler now (Jack) 1997-10-08 15:25:37 +00:00
Guido van Rossum 0e8457c4ec Fix EventHook (the trick to make widgets appear when using GNU
readline) to create and use a new thread state object -- otherwise it
would dump core!
1997-10-07 18:51:41 +00:00
Guido van Rossum 54e2091ba2 Add an optional hack for threads in Tkinter.
This one works!  However it requires using a modified version of
tclNotify.c (provided), which requires access to the Tcl source
to compile it.  In order to enable this hack, add the following
to the Setup line for _tkinter:
   tclNotify.c -DHAVE_PYTCL_WAITUNTILEVENT -I$(TCL)/generic
where TCL points to the source tree of Tcl 8.0.  Other versions
of Tcl are not supported.

The tclNotify.c file is copyrighted by Sun Microsystems; the
licensing terms are in the file license.terms.  According to this
file, no further permission to distribute this is required,
provided the file license.terms is included.  Hence, I am checking
that in, too.
1997-09-28 05:52:41 +00:00
Guido van Rossum 83551bfeda Export names for the types defined by this module: TkappType and TkttType. 1997-09-13 00:44:23 +00:00
Guido van Rossum 75626a3b93 Indent the #error so that a strict K&R cpp doesn't complain. 1997-09-08 02:04:00 +00:00
Guido van Rossum d7a7100c99 Remove redundant decl for PyOS_InputHook. 1997-08-21 17:26:04 +00:00
Guido van Rossum 5b02078e31 Alas, the thread support for Tk didn't work. Withdraw it, until I
figure out how to do this right.
1997-08-19 01:00:50 +00:00
Guido van Rossum bad3c013d2 DeleteTimerHandler was accidentally #ifdef'ed out for macintosh with
Tk 8.0; this was a mistake.
1997-08-18 15:28:52 +00:00
Guido van Rossum 0d2390c549 Merge Mac and Windows mods (which mostly affect the same problem -- no
usable createfilehandler).  Define HAVE_CREATEFILEHANDLER to test
later.  Also other Mac specific patches by Jack.
1997-08-14 19:57:07 +00:00
Guido van Rossum 44620646fd Renamed Py_input_hook to PyOS_InputHook.
Also cleaned out some CR's left by the VC++ editor.
1997-08-11 18:57:29 +00:00
Guido van Rossum 02c0467f67 Rather unsatisfactory temporary hack to get it to run
under WIN32 -- remove file handler interface, don't use Py_input_hook.
1997-08-07 00:12:22 +00:00
Guido van Rossum 0969d36275 New mechanism for GNU readline interface, via module 1997-08-05 21:27:50 +00:00
Guido van Rossum 35d43377b4 Functionality enhancement: allow other threads to use Tk commands
while one thread is blocked in mainloop().  Also, handle signals (not
just interrupts) as soon as they happen.

Cleanup: remove support for Tcl/Tk versions 7.4/4.0.  (I've confirmed
that it works for 7.5/4.1 and 7.6/4.2, as well as 8.0b2.)

Coding style change: instead of ``func (args)'', write ``func(args)''
everywhere.

Minor functionality change: use PyArg_ParseTuple everywhere.  This
should only affect the errors reported for bad argument lists; in
particular, deletefilehandler() is much clearer about what's going
on.

(XXX Still to do: Mac and Win ports to 8.0b2.)
1997-08-02 00:09:09 +00:00
Guido van Rossum 3e819a7aa8 Compatibility with Tcl/Tk 8.0b*. 1997-08-01 19:29:02 +00:00
Guido van Rossum 496f8f632b Removed remaining support for Tk versions below 4.0. 1997-07-19 19:57:42 +00:00
Guido van Rossum 290283bb39 Mac hack to make select() work again... 1997-06-02 22:16:43 +00:00
Guido van Rossum 8813b58ffa On popular demand, re-enable the readline event hook. 1997-05-07 17:42:41 +00:00
Guido van Rossum 8ec9e639ab Adapt Mac specific code to new universal headers (I think -- this is
Jack's code).
1997-04-29 15:49:04 +00:00