Commit Graph

223 Commits

Author SHA1 Message Date
Neal Norwitz d948a43df8 Fix icc warnings: try to set TCL_UNIX_FD for #if TCL_WIN_SOCKET == TCL_UNIX_FD. res is not used, add a XXX comment 2006-01-08 01:08:55 +00:00
Neal Norwitz 9dbc7dd6f2 Remove extra parens 2005-12-19 06:08:59 +00:00
Neal Norwitz 30b5c5d011 Fix SF bug #1072182, problems with signed characters.
Most of these can be backported.
2005-12-19 06:05:18 +00:00
Jeremy Hylton af68c874a6 Add const to several API functions that take char *.
In C++, it's an error to pass a string literal to a char* function
without a const_cast().  Rather than require every C++ extension
module to put a cast around string literals, fix the API to state the
const-ness.

I focused on parts of the API where people usually pass literals:
PyArg_ParseTuple() and friends, Py_BuildValue(), PyMethodDef, the type
slots, etc.  Predictably, there were a large set of functions that
needed to be fixed as a result of these changes.  The most pervasive
change was to make the keyword args list passed to
PyArg_ParseTupleAndKewords() to be a const char *kwlist[].

One cast was required as a result of the changes:  A type object
mallocs the memory for its tp_doc slot and later frees it.
PyTypeObject says that tp_doc is const char *; but if the type was
created by type_new(), we know it is safe to cast to char *.
2005-12-10 18:50:16 +00:00
Martin v. Löwis e2713becd8 Build with --disable-unicode again. Fixes #1158607.
Will backport to 2.4.
2005-03-08 15:03:08 +00:00
Martin v. Löwis fba7369824 Patch #1050475: Fix various x86_64 build issues
regrtest.py: skip rgbimg and imageop as they are not built on 64-bit systems.
_tkinter.c: replace %.8x with %p for printing pointers.
setup.py: add lib64 into the library directories.
2004-11-13 11:13:35 +00:00
Tim Peters 51fa3b740f Tkapp_New(): Rewrite in C so it compiles again. 2004-08-04 02:16:48 +00:00
Martin v. Löwis 1fa649f2d5 Patch #986929: Add support for wish -sync and -use options. 2004-08-03 18:45:31 +00:00
Neal Norwitz 44dbae8cca Remove gcc warning from using "main". Use METH_NOARGS instead of METH_VARARGS 2004-02-19 02:44:22 +00:00
David Ascher e2b4b32025 Implementation of patch 869468
Allow the user to create Tkinter.Tcl objects which are
just like Tkinter.Tk objects except that they do not
initialize Tk. This is useful in circumstances where the
script is being run on machines that do not have an X
server running -- in those cases, Tk initialization fails,
even if no window is ever created.

Includes documentation change and tests.

Tested on Linux, Solaris and Windows.

Reviewed by Martin von Loewis.
2004-02-18 05:59:53 +00:00
Jack Jansen eddc1449ba Getting rid of all the code inside #ifdef macintosh too. 2003-11-20 01:44:59 +00:00
Martin v. Löwis d46e684edd Check for TclError when reading variables. Fixes #807314.
Backported to 2.3.
2003-10-03 17:12:26 +00:00
Martin v. Löwis d6efae500c Properly deal with tuples in Open._fixresult. Fixes bug reported in
follow-up to #621891.
2003-06-14 21:34:32 +00:00
Neal Norwitz d1c5510b99 Fix SF #745055, Memory leak in _tkinter.c/Tkapp_SplitList()
Also fix a memory leak in Tkapp_Split.

This needs to be backported.  I'll leave it up to Barry whether this
is for 2.2.3 or 2.2.4.
2003-05-29 00:17:03 +00:00
Martin v. Löwis 8fd86cc46e Only return objects if wantobjects is set in GetVar. 2003-05-19 19:57:42 +00:00
Martin v. Löwis 28e9ce9df2 Patch #734118: Add {get|set}busywaitinterval. 2003-05-09 08:19:48 +00:00
Martin v. Löwis dd6cd65b98 Implement tcl object __cmp__. 2003-05-03 09:45:12 +00:00
Martin v. Löwis 1869ec5cb7 Convert tcl objects to strings in getvar/setvar. Fixes #730506. 2003-05-01 05:47:00 +00:00
Martin v. Löwis 6f29ff319b Support UCS-4 Tcl for UCS-4 Python builds. Fixes #719880. 2003-04-16 20:34:55 +00:00
Martin v. Löwis ee24e9cad0 Use object interface for global vars. Fixes #721171.
Also move complete processing of get/set/delvar calls to target thread.
2003-04-15 20:33:20 +00:00
Martin v. Löwis a965649386 Wrap thread stuff in WITH_THREAD. Fixes #704641. 2003-03-30 08:44:58 +00:00
Martin v. Löwis 52ae6f67d9 Fake bool API for Python 2.2. 2003-03-30 08:26:04 +00:00
Neal Norwitz 12e2217501 Fix SF #692416, don't crash interpreter for _tkinter.deletefilehandler
in addition to createfilehandler and creaetetimerhandler.
2003-03-03 21:16:39 +00:00
Martin v. Löwis 7f13489bdf Don't crash on _tkinter.createfilehandler in non-threaded Tcl;
disable this function in threaded Tcl. Likewise for creaetetimerhandler.
Fixes #692416.
2003-03-03 10:40:01 +00:00
Neal Norwitz ec74f2fda7 Add more missing PyErr_NoMemory() after failled memory allocs 2003-02-11 23:05:40 +00:00
Martin v. Löwis 70c3dda2fb Convert booleans to integers in IntVar.set. Fixes #671741.
Return booleans from _tkinter.getboolean.
Convert booleans to Tcl booleans in AsObj.
2003-01-22 09:17:38 +00:00
Martin v. Löwis cd9a8b6bcf Avoid usage of PyDoc_STR in 2.2 compatibility code. 2003-01-21 21:52:57 +00:00
Jason Tishler fb8595df4f Patch #661760: Cygwin auto-import module patch
The attached patch enables shared extension
modules to build cleanly under Cygwin without
moving the static initialization of certain function
pointers (i.e., ones exported from the Python
DLL core) to a module initialization function.

Additionally, this patch fixes the modules that
have been changed in the past to accommodate
Cygwin.
2003-01-06 12:41:26 +00:00
Martin v. Löwis 3a57d9de07 Fix typo. 2003-01-04 08:54:59 +00:00
Martin v. Löwis 6a759d9e00 Remove appartment check from dooneevent. Fixes #660961.
Check whether self is NULL in mainloop.
2003-01-04 08:36:57 +00:00
Martin v. Löwis 3919571f82 Wrap doc strings in PyDoc_STRVAR. Fix .string docstring. Provide default
macro definitions for older Python releases.
2003-01-04 00:33:13 +00:00
Martin v. Löwis 25c7b50e8f Convert Tcl path objects to strings. Fixes #661357.
Provide .string attribute and __unicode for Tcl_Objs.
2003-01-04 00:08:09 +00:00
Jason Tishler bbe8961698 Patch #660485: Cygwin _tkinter Tcl/Tk 8.3 patch
The attached patch enables Cygwin Python to
build cleanly against the latest Cygwin Tcl/Tk
which is based on Tcl/Tk 8.3. It also prevents
building against the real X headers, if installed.
2002-12-31 20:30:46 +00:00
Martin v. Löwis ba2f875d90 Eliminate C++ comment. 2002-12-31 17:34:30 +00:00
Martin v. Löwis 5b177f18ee Silence cast warnings for Tcl 8.3. 2002-12-30 18:14:15 +00:00
Martin v. Löwis 5b26abb37a Gracefully delay runtime error up to 1s. Add .willdispatch(). 2002-12-28 09:23:09 +00:00
Martin v. Löwis 7d1349553b Always initialize objc. 2002-12-12 19:05:48 +00:00
Martin v. Löwis b5bfb9f38c Support threads-enabled Tcl installations. 2002-12-12 17:07:58 +00:00
Martin v. Löwis 33ec3ba217 Remove C++ comment. Silence unsigned char* cast warning. 2002-12-07 14:57:11 +00:00
Martin v. Löwis e07e18d41b Decode untyped strings from UTF-8. 2002-12-04 19:54:36 +00:00
Martin v. Löwis 4ec2e7071e Avoid including tclInt.h. 2002-11-26 22:12:12 +00:00
Martin v. Löwis 8c8aa5d666 Rename want_objects to wantobjects throughout, for consistency. 2002-11-26 21:39:48 +00:00
Martin v. Löwis ffad633af9 Patch #518625: Return objects in Tkinter. 2002-11-26 09:28:05 +00:00
Martin v. Löwis 3c6d6f2ff7 Support UCS-4 builds. 2002-10-01 18:50:56 +00:00
Martin v. Löwis 71e25a0e06 Eliminate constness warnings with Tcl 8.4. 2002-10-01 18:08:06 +00:00
Martin v. Löwis 6bfa2e6892 Drop support for Tk 8.0 and 8.1. 2002-10-01 17:48:31 +00:00
Mark Hammond 62b1ab1b31 Replace DL_IMPORT with PyMODINIT_FUNC and remove "/export:init..." link
command line for Windows builds.  This should allow MSVC to import and
build the Python MSVC6 project files without error.
2002-07-23 06:31:15 +00:00
Jeremy Hylton 938ace69a0 staticforward bites the dust.
The staticforward define was needed to support certain broken C
compilers (notably SCO ODT 3.0, perhaps early AIX as well) botched the
static keyword when it was used with a forward declaration of a static
initialized structure.  Standard C allows the forward declaration with
static, and we've decided to stop catering to broken C compilers.  (In
fact, we expect that the compilers are all fixed eight years later.)

I'm leaving staticforward and statichere defined in object.h as
static.  This is only for backwards compatibility with C extensions
that might still use it.

XXX I haven't updated the documentation.
2002-07-17 16:30:39 +00:00
Neal Norwitz b5b5a260ea Fix SF bug #557436, TclError is a str should be an Exception
Make Tkinter.TclError derive from Exception, it was a string.
2002-06-04 17:14:07 +00:00
Neal Norwitz b049325e92 Use symbolic METH_VARARGS/METH_OLDARGS instead of 1/0 for ml_flags 2002-03-31 14:44:22 +00:00
Martin v. Löwis 84432eb4c0 Encode Unicode arguments to split/splitlist as UTF-8. Fixes #507962.
2.2.1 bugfix candidate.
2002-01-26 20:21:50 +00:00
Martin v. Löwis 43b936d08c Patch #477750: Use METH_ constants in Modules. 2002-01-17 23:15:58 +00:00
Jack Jansen cb85244228 Mods by Tony Lownds (patch 490100, slightly massaged by me) to make Tkinter
work with Mac OS X Aqua-Tk, all nicely within ifdefs.

The process is not for the faint of heart, though: you need to download
and install the (alfa) Aqua-Tk, obtain a few needed X11 headers from
somewhere else and then everything builds. To run scripts using Tkinter
you must build with --enable-framework, build Python.app in Mac/OSX
and run your Tkinter scripts with that. Then, about half the tests in
Demo/tkinter work (or at least do something).

Checking this in anyway because it shouldn't break anything, and newer
versions of Aqua-Tk will streamline the process.
2001-12-09 23:15:56 +00:00
Tim Peters 885d457709 sprintf -> PyOS_snprintf in some "obviously safe" cases.
Also changed <>-style #includes to ""-style in some places where the
former didn't make sense.
2001-11-28 20:27:42 +00:00
Martin v. Löwis 339d0f720e Patch #445762: Support --disable-unicode
- Do not compile unicodeobject, unicodectype, and unicodedata if Unicode is disabled
- check for Py_USING_UNICODE in all places that use Unicode functions
- disables unicode literals, and the builtin functions
- add the types.StringTypes list
- remove Unicode literals from most tests.
2001-08-17 18:39:25 +00:00
Jack Jansen f249addeed Got rid of (hopefully) the last 68k-mac related ifdefs. 2001-08-07 15:32:37 +00:00
Jack Jansen 84c10b13bb File handlers don't work on the mac, so don't pretend they do. I guess this is a 2.1.1 candidate, if it isn't too late for that. 2001-07-16 19:32:52 +00:00
Tim Peters 4324aa3572 Cruft cleanup: Removed the unused last_is_sticky argument from the internal
_PyTuple_Resize().
2001-05-28 22:30:08 +00:00
Martin v. Löwis 02956017f9 Do not release unallocated Tcl objects. Closes #117278 and #117167. 2000-10-29 00:44:43 +00:00
Guido van Rossum ada6d87c0c Fix for Bug #116453.
Direct use of interp->result is deprecated; changing this to
Tcl_GetStringResult(interp) everywhere fixed the problem of losing the
error message with TclError exceptions, on Windows.
2000-10-12 17:14:46 +00:00
Guido van Rossum 2834b974b6 [ Bug #113803 ] [2.0b1 NT4.0] printing non asci char causes idle to abort
http://sourceforge.net/bugs/?func=detailbug&bug_id=113803&group_id=5470

Add Unicode support and error handling to AsString().  Both AsString()
and Merge() now return NULL and set a proper Python exception
condition when an error happens; Merge() and other callers of
AsString() check for errors from AsString().  Also fixed cleanup in
Merge() and Tkapp_Call() return cleanup code; the fv array was not
necessarily completely initialized, causing calls to ckfree() with
garbage arguments!

(Also reindented some lines that were longer than 80 chars and
reformatted some code that used an alien coding standard.)
2000-10-06 16:58:26 +00:00
Tim Peters 98dc065c1b SF "bug" 115973: patches from Norman Vine so that shared libraries and
Tkinter work under Cygwin.  Accepted on faith & reasonableness.
2000-10-05 19:24:26 +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
Peter Schneider-Kamp 7e01890986 merge Include/my*.h into Include/pyport.h
marked my*.h as obsolete
2000-07-31 15:28:04 +00:00
Thomas Wouters 58d0510245 ANSIfy some more forward declarations. 2000-07-24 14:43:35 +00:00
Thomas Wouters f3f33dcf03 Bunch of minor ANSIfications: 'void initfunc()' -> 'void initfunc(void)',
and a couple of functions that were missed in the previous batches. Not
terribly tested, but very carefully scrutinized, three times.

All these were found by the little findkrc.py that I posted to python-dev,
which means there might be more lurking. Cases such as this:

long
func(a, b)
	long a;
	long b; /* flagword */
{

and other cases where the last ; in the argument list isn't followed by a
newline and an opening curly bracket. Regexps to catch all are welcome, of
course ;)
2000-07-21 06:00:07 +00:00
Andrew M. Kuchling 9f28a039f6 Use PyObject_AsFileDescriptor 2000-07-13 23:59:35 +00:00
Jeremy Hylton 03657cfdb0 replace PyXXX_Length calls with PyXXX_Size calls 2000-07-12 13:05:33 +00:00
Peter Schneider-Kamp 286da3b46a ANSI-fying
added excplicit node * parameter to termvalid argument in
validate_two_chain_ops of parsermodule.c (as proposed by fred)
2000-07-10 12:43:58 +00:00
Fred Drake 509d79adaf Removed Py_PROTO, ANSI-fied sources. 2000-07-08 04:04:38 +00:00
Guido van Rossum fd71b9e9d4 Change copyright notice. 2000-06-30 23:50:40 +00:00
Fred Drake a44d353e2b Trent Mick <trentm@activestate.com>:
The common technique for printing out a pointer has been to cast to a long
and use the "%lx" printf modifier. This is incorrect on Win64 where casting
to a long truncates the pointer. The "%p" formatter should be used instead.

The problem as stated by Tim:
> Unfortunately, the C committee refused to define what %p conversion "looks
> like" -- they explicitly allowed it to be implementation-defined. Older
> versions of Microsoft C even stuck a colon in the middle of the address (in
> the days of segment+offset addressing)!

The result is that the hex value of a pointer will maybe/maybe not have a 0x
prepended to it.


Notes on the patch:

There are two main classes of changes:
- in the various repr() functions that print out pointers
- debugging printf's in the various thread_*.h files (these are why the
patch is large)


Closes SourceForge patch #100505.
2000-06-30 15:01:00 +00:00
Andrew M. Kuchling 288e97b7fe Patch from Michael Hudson to fix flatten recursive data structures:
[mwh21@atrus build]$ ./python
>>> import Tkinter
>>> l = []
>>> l.append(l)
>>> Tkinter._flatten(l)
Segmentation fault (core dumped)
2000-06-19 00:55:09 +00:00
Andrew M. Kuchling e475e70128 Patch from /F:
this patch adds a fast _flatten function to the _tkinter
module, and imports it from Tkinter.py (if available).

this speeds up canvas operations like create_line and
create_polygon.  for example, a create_line with 5000
vertices runs about 50 times faster with this patch in
place.
2000-06-18 18:45:50 +00:00
Guido van Rossum 69529ad0cc When the UTF-8 conversion to Unicode fails, return an 8-bit string
instead.  This seems more robust than returning an Unicode string with
some unconverted charcters in it.

This still doesn't support getting truly binary data out of Tcl, since
we look for the trailing null byte; but the old (pre-Unicode) code did
this too, so apparently there's no need.  (Plus, I really don't feel
like finding out how Tcl deals with this in each version.)
2000-05-04 15:55:17 +00:00
Guido van Rossum 990f5c6c98 Two changes to improve (I hope) Unicode support.
1. In Tcl 8.2 and later, use Tcl_NewUnicodeObj() when passing a Python
Unicode object rather than going through UTF-8.  (This function
doesn't exist in Tcl 8.1, so there the original UTF-8 code is still
used; in Tcl 8.0 there is no support for Unicode.)  This assumes that
Tcl_UniChar is the same thing as Py_UNICODE; a run-time error is
issued if this is not the case.

2. In Tcl 8.1 and later (i.e., whenever Tcl supports Unicode), when a
string returned from Tcl contains bytes with the top bit set, we
assume it is encoded in UTF-8, and decode it into a Unicode string
object.

Notes:

- Passing Unicode strings to Tcl 8.0 does not do the right thing; this
isn't worth fixing.

- When passing an 8-bit string to Tcl 8.1 or later that has bytes with
the top bit set, Tcl tries to interpret it as UTF-8; it seems to fall
back on Latin-1 for non-UTF-8 bytes.  I'm not sure what to do about
this besides telling the user to disambiguate such strings by
converting them to Unicode (forcing the user to be explicit about the
encoding).

- Obviously it won't be possible to get binary data out of Tk this
way.  Do we need that ability?  How to do it?
2000-05-04 15:07:16 +00:00
Guido van Rossum b18618dab7 Vladimir Marangozov's long-awaited malloc restructuring.
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.)
2000-05-03 23:44:39 +00:00
Guido van Rossum 8823accd1f Marc-Andre Lemburg:
Fixes a memory leak found by Fredrik Lundh.
2000-04-27 20:14:31 +00:00
Guido van Rossum 64231e5c39 Add back an obscure "feature" to the Obj version of Tkapp_Call(): a
None in an argument list *terminates* the argument list: further
arguments are *ignored*.  This isn't kosher, but too much code relies
on it, implicitly.  For example, IDLE was pretty broken.
2000-03-31 03:29:39 +00:00
Guido van Rossum a1f0a8f4a4 Don't use the object call interface in Tk 8.0 -- the EvalObj* API
changed from 8.0 to 8.1 and I see no big reason to use objects in 8.0.
At least now it works again with all versions from 8.0 - 8.3.
2000-03-31 00:51:37 +00:00
Guido van Rossum 632de27021 The Tcl_Obj patch discussed on the patches list.
This was originally submitted by Martin von Loewis as part of his
Unicode patch; all I did was add special cases for Python int and
float objects and rearrange the object type tests somewhat to speed up
the common cases (string, int, float, tuple, unicode, object).
2000-03-29 00:19:50 +00:00
Guido van Rossum a80649b357 Patch by Neil Schemenauer to remove support for Tcl/Tk versions before
8.0.  There really is no excuse, and for who really still wants those,
they can go back to Python 1.5.2.
2000-03-28 20:07:05 +00:00
Guido van Rossum e187b0eb20 Add a call to Tcl_FindExecutable(). This was inspired by a patch by
Martin von Loewis (whose more elaborate patch to use objects is still
under review).
2000-03-27 21:46:29 +00:00
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