You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

3183 lines
82 KiB

32 years ago
31 years ago
31 years ago
24 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
32 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
32 years ago
32 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merge the rest of the trunk. Merged revisions 46490-46494,46496,46498,46500,46506,46521,46538,46558,46563-46567,46570-46571,46583,46593,46595-46598,46604,46606,46609-46753 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r46610 | martin.v.loewis | 2006-06-03 09:42:26 +0200 (Sat, 03 Jun 2006) | 2 lines Updated version (win32-icons2.zip) from #1490384. ........ r46612 | andrew.kuchling | 2006-06-03 20:09:41 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1472084] Fix description of do_tag ........ r46614 | andrew.kuchling | 2006-06-03 20:33:35 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1475554] Strengthen text to say 'must' instead of 'should' ........ r46616 | andrew.kuchling | 2006-06-03 20:41:28 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1441864] Clarify description of 'data' argument ........ r46617 | andrew.kuchling | 2006-06-03 20:43:24 +0200 (Sat, 03 Jun 2006) | 1 line Minor rewording ........ r46619 | andrew.kuchling | 2006-06-03 21:02:35 +0200 (Sat, 03 Jun 2006) | 9 lines [Bug #1497414] _self is a reserved word in the WATCOM 10.6 C compiler. Fix by renaming the variable. In a different module, Neal fixed it by renaming _self to self. There's already a variable named 'self' here, so I used selfptr. (I'm committing this on a Mac without Tk, but it's a simple search-and-replace. <crosses fingers>, so I'll watch the buildbots and see what happens.) ........ r46621 | fredrik.lundh | 2006-06-03 23:56:05 +0200 (Sat, 03 Jun 2006) | 5 lines "_self" is a said to be a reserved word in Watcom C 10.6. I'm not sure that's really standard compliant behaviour, but I guess we have to fix that anyway... ........ r46622 | andrew.kuchling | 2006-06-04 00:44:42 +0200 (Sun, 04 Jun 2006) | 1 line Update readme ........ r46623 | andrew.kuchling | 2006-06-04 00:59:23 +0200 (Sun, 04 Jun 2006) | 1 line Drop 0 parameter ........ r46624 | andrew.kuchling | 2006-06-04 00:59:59 +0200 (Sun, 04 Jun 2006) | 1 line Some code tidying; use curses.wrapper ........ r46625 | andrew.kuchling | 2006-06-04 01:02:15 +0200 (Sun, 04 Jun 2006) | 1 line Use True; value returned from main is unused ........ r46626 | andrew.kuchling | 2006-06-04 01:07:21 +0200 (Sun, 04 Jun 2006) | 1 line Use true division, and the True value ........ r46627 | andrew.kuchling | 2006-06-04 01:09:58 +0200 (Sun, 04 Jun 2006) | 1 line Docstring fix; use True ........ r46628 | andrew.kuchling | 2006-06-04 01:15:56 +0200 (Sun, 04 Jun 2006) | 1 line Put code in a main() function; loosen up the spacing to match current code style ........ r46629 | andrew.kuchling | 2006-06-04 01:39:07 +0200 (Sun, 04 Jun 2006) | 1 line Use functions; modernize code ........ r46630 | andrew.kuchling | 2006-06-04 01:43:22 +0200 (Sun, 04 Jun 2006) | 1 line This demo requires Medusa (not just asyncore); remove it ........ r46631 | andrew.kuchling | 2006-06-04 01:46:36 +0200 (Sun, 04 Jun 2006) | 2 lines Remove xmlrpc demo -- it duplicates the SimpleXMLRPCServer module. ........ r46632 | andrew.kuchling | 2006-06-04 01:47:22 +0200 (Sun, 04 Jun 2006) | 1 line Remove xmlrpc/ directory ........ r46633 | andrew.kuchling | 2006-06-04 01:51:21 +0200 (Sun, 04 Jun 2006) | 1 line Remove dangling reference ........ r46634 | andrew.kuchling | 2006-06-04 01:59:36 +0200 (Sun, 04 Jun 2006) | 1 line Add more whitespace; use a better socket name ........ r46635 | tim.peters | 2006-06-04 03:22:53 +0200 (Sun, 04 Jun 2006) | 2 lines Whitespace normalization. ........ r46637 | tim.peters | 2006-06-04 05:26:02 +0200 (Sun, 04 Jun 2006) | 16 lines In a PYMALLOC_DEBUG build obmalloc adds extra debugging info to each allocated block. This was using 4 bytes for each such piece of info regardless of platform. This didn't really matter before (proof: no bug reports, and the debug-build obmalloc would have assert-failed if it was ever asked for a chunk of memory >= 2**32 bytes), since container indices were plain ints. But after the Py_ssize_t changes, it's at least theoretically possible to allocate a list or string whose guts exceed 2**32 bytes, and the PYMALLOC_DEBUG routines would fail then (having only 4 bytes to record the originally requested size). Now we use sizeof(size_t) bytes for each of a PYMALLOC_DEBUG build's extra debugging fields. This won't make any difference on 32-bit boxes, but will add 16 bytes to each allocation in a debug build on a 64-bit box. ........ r46638 | tim.peters | 2006-06-04 05:38:04 +0200 (Sun, 04 Jun 2006) | 4 lines _PyObject_DebugMalloc(): The return value should add 2*sizeof(size_t) now, not 8. This probably accounts for current disasters on the 64-bit buildbot slaves. ........ r46639 | neal.norwitz | 2006-06-04 08:19:31 +0200 (Sun, 04 Jun 2006) | 1 line SF #1499797, Fix for memory leak in WindowsError_str ........ r46640 | andrew.macintyre | 2006-06-04 14:31:09 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1454481: Make thread stack size runtime tunable. ........ r46641 | andrew.macintyre | 2006-06-04 14:59:59 +0200 (Sun, 04 Jun 2006) | 2 lines clean up function declarations to conform to PEP-7 style. ........ r46642 | martin.blais | 2006-06-04 15:49:49 +0200 (Sun, 04 Jun 2006) | 15 lines Fixes in struct and socket from merge reviews. - Following Guido's comments, renamed * pack_to -> pack_into * recv_buf -> recv_into * recvfrom_buf -> recvfrom_into - Made fixes to _struct.c according to Neal Norwitz comments on the checkins list. - Converted some ints into the appropriate -- I hope -- ssize_t and size_t. ........ r46643 | ronald.oussoren | 2006-06-04 16:05:28 +0200 (Sun, 04 Jun 2006) | 3 lines "Import" LDFLAGS in Mac/OSX/Makefile.in to ensure pythonw gets build with the right compiler flags. ........ r46644 | ronald.oussoren | 2006-06-04 16:24:59 +0200 (Sun, 04 Jun 2006) | 2 lines Drop Mac wrappers for the WASTE library. ........ r46645 | tim.peters | 2006-06-04 17:49:07 +0200 (Sun, 04 Jun 2006) | 3 lines s_methods[]: Stop compiler warnings by casting s_unpack_from to PyCFunction. ........ r46646 | george.yoshida | 2006-06-04 19:04:12 +0200 (Sun, 04 Jun 2006) | 2 lines Remove a redundant word ........ r46647 | george.yoshida | 2006-06-04 19:17:25 +0200 (Sun, 04 Jun 2006) | 2 lines Markup fix ........ r46648 | martin.v.loewis | 2006-06-04 21:36:28 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1359618: Speed-up charmap encoder. ........ r46649 | georg.brandl | 2006-06-04 23:46:16 +0200 (Sun, 04 Jun 2006) | 3 lines Repair refleaks in unicodeobject. ........ r46650 | georg.brandl | 2006-06-04 23:56:52 +0200 (Sun, 04 Jun 2006) | 4 lines Patch #1346214: correctly optimize away "if 0"-style stmts (thanks to Neal for review) ........ r46651 | georg.brandl | 2006-06-05 00:15:37 +0200 (Mon, 05 Jun 2006) | 2 lines Bug #1500293: fix memory leaks in _subprocess module. ........ r46654 | tim.peters | 2006-06-05 01:43:53 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46655 | tim.peters | 2006-06-05 01:52:47 +0200 (Mon, 05 Jun 2006) | 16 lines Revert revisions: 46640 Patch #1454481: Make thread stack size runtime tunable. 46647 Markup fix The first is causing many buildbots to fail test runs, and there are multiple causes with seemingly no immediate prospects for repairing them. See python-dev discussion. Note that a branch can (and should) be created for resolving these problems, like svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH followed by merging rev 46647 to the new branch. ........ r46656 | andrew.kuchling | 2006-06-05 02:08:09 +0200 (Mon, 05 Jun 2006) | 1 line Mention second encoding speedup ........ r46657 | gregory.p.smith | 2006-06-05 02:31:01 +0200 (Mon, 05 Jun 2006) | 7 lines bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized char **log_list. feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2. ........ r46658 | gregory.p.smith | 2006-06-05 02:33:35 +0200 (Mon, 05 Jun 2006) | 5 lines fix a bug in the previous commit. don't leak empty list on error return and fix the additional rare (out of memory only) bug that it was supposed to fix of not freeing log_list when the python allocator failed. ........ r46660 | tim.peters | 2006-06-05 02:55:26 +0200 (Mon, 05 Jun 2006) | 9 lines "Flat is better than nested." Move the long-winded, multiply-nested -R support out of runtest() and into some module-level helper functions. This makes runtest() and the -R code easier to follow. That in turn allowed seeing some opportunities for code simplification, and made it obvious that reglog.txt never got closed. ........ r46661 | hyeshik.chang | 2006-06-05 02:59:54 +0200 (Mon, 05 Jun 2006) | 3 lines Fix a potentially invalid memory access of CJKCodecs' shift-jis decoder. (found by Neal Norwitz) ........ r46663 | gregory.p.smith | 2006-06-05 03:39:52 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] ........ r46664 | tim.peters | 2006-06-05 03:43:03 +0200 (Mon, 05 Jun 2006) | 3 lines Remove doctest.testmod's deprecated (in 2.4) `isprivate` argument. A lot of hair went into supporting that! ........ r46665 | tim.peters | 2006-06-05 03:47:24 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46666 | tim.peters | 2006-06-05 03:48:21 +0200 (Mon, 05 Jun 2006) | 2 lines Make doctest news more accurate. ........ r46667 | gregory.p.smith | 2006-06-05 03:56:15 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] ........ r46668 | gregory.p.smith | 2006-06-05 04:02:25 +0200 (Mon, 05 Jun 2006) | 3 lines mention the just committed bsddb changes ........ r46671 | gregory.p.smith | 2006-06-05 19:38:04 +0200 (Mon, 05 Jun 2006) | 3 lines * add support for DBSequence objects [patch #1466734] ........ r46672 | gregory.p.smith | 2006-06-05 20:20:07 +0200 (Mon, 05 Jun 2006) | 3 lines forgot to add this file in previous commit ........ r46673 | tim.peters | 2006-06-05 20:36:12 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46674 | tim.peters | 2006-06-05 20:36:54 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46675 | gregory.p.smith | 2006-06-05 20:48:21 +0200 (Mon, 05 Jun 2006) | 4 lines * fix DBCursor.pget() bug with keyword argument names when no data= is supplied [SF pybsddb bug #1477863] ........ r46676 | andrew.kuchling | 2006-06-05 21:05:32 +0200 (Mon, 05 Jun 2006) | 1 line Remove use of Trove name, which isn't very helpful to users ........ r46677 | andrew.kuchling | 2006-06-05 21:08:25 +0200 (Mon, 05 Jun 2006) | 1 line [Bug #1470026] Include link to list of classifiers ........ r46679 | tim.peters | 2006-06-05 22:48:49 +0200 (Mon, 05 Jun 2006) | 10 lines Access _struct attributes directly instead of mucking with getattr. string_reverse(): Simplify. assertRaises(): Raise TestFailed on failure. test_unpack_from(), test_pack_into(), test_pack_into_fn(): never use `assert` to test for an expected result (it doesn't test anything when Python is run with -O). ........ r46680 | tim.peters | 2006-06-05 22:49:27 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46681 | gregory.p.smith | 2006-06-06 01:38:06 +0200 (Tue, 06 Jun 2006) | 3 lines add depends = ['md5.h'] to the _md5 module extension for correctness sake. ........ r46682 | brett.cannon | 2006-06-06 01:51:55 +0200 (Tue, 06 Jun 2006) | 4 lines Add 3 more bytes to a buffer to cover constants in string and null byte on top of 10 possible digits for an int. Closes bug #1501223. ........ r46684 | gregory.p.smith | 2006-06-06 01:59:37 +0200 (Tue, 06 Jun 2006) | 5 lines - bsddb: the __len__ method of a DB object has been fixed to return correct results. It could previously incorrectly return 0 in some cases. Fixes SF bug 1493322 (pybsddb bug 1184012). ........ r46686 | tim.peters | 2006-06-06 02:25:07 +0200 (Tue, 06 Jun 2006) | 7 lines _PySys_Init(): It's rarely a good idea to size a buffer to the exact maximum size someone guesses is needed. In this case, if we're really worried about extreme integers, then "cp%d" can actually need 14 bytes (2 for "cp" + 1 for \0 at the end + 11 for -(2**31-1)). So reserve 128 bytes instead -- nothing is actually saved by making a stack-local buffer tiny. ........ r46687 | neal.norwitz | 2006-06-06 09:22:08 +0200 (Tue, 06 Jun 2006) | 1 line Remove unused variable (and stop compiler warning) ........ r46688 | neal.norwitz | 2006-06-06 09:23:01 +0200 (Tue, 06 Jun 2006) | 1 line Fix a bunch of parameter strings ........ r46689 | thomas.heller | 2006-06-06 13:34:33 +0200 (Tue, 06 Jun 2006) | 6 lines Convert CFieldObject tp_members to tp_getset, since there is no structmember typecode for Py_ssize_t fields. This should fix some of the errors on the PPC64 debian machine (64-bit, big endian). Assigning to readonly fields now raises AttributeError instead of TypeError, so the testcase has to be changed as well. ........ r46690 | thomas.heller | 2006-06-06 13:54:32 +0200 (Tue, 06 Jun 2006) | 1 line Damn - the sentinel was missing. And fix another silly mistake. ........ r46691 | martin.blais | 2006-06-06 14:46:55 +0200 (Tue, 06 Jun 2006) | 13 lines Normalized a few cases of whitespace in function declarations. Found them using:: find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done (I was doing this all over my own code anyway, because I'd been using spaces in all defs, so I thought I'd make a run on the Python code as well. If you need to do such fixes in your own code, you can use xx-rename or parenregu.el within emacs.) ........ r46693 | thomas.heller | 2006-06-06 17:34:18 +0200 (Tue, 06 Jun 2006) | 1 line Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures ........ r46694 | tim.peters | 2006-06-06 17:50:17 +0200 (Tue, 06 Jun 2006) | 5 lines BSequence_set_range(): Rev 46688 ("Fix a bunch of parameter strings") changed this function's signature seemingly by mistake, which is causing buildbots to fail test_bsddb3. Restored the pre-46688 signature. ........ r46695 | tim.peters | 2006-06-06 17:52:35 +0200 (Tue, 06 Jun 2006) | 4 lines On python-dev Thomas Heller said these were committed by mistake in rev 46693, so reverting this part of rev 46693. ........ r46696 | andrew.kuchling | 2006-06-06 19:10:41 +0200 (Tue, 06 Jun 2006) | 1 line Fix comment typo ........ r46697 | brett.cannon | 2006-06-06 20:08:16 +0200 (Tue, 06 Jun 2006) | 2 lines Fix coding style guide bug. ........ r46698 | thomas.heller | 2006-06-06 20:50:46 +0200 (Tue, 06 Jun 2006) | 2 lines Add a hack so that foreign functions returning float now do work on 64-bit big endian platforms. ........ r46699 | thomas.heller | 2006-06-06 21:25:13 +0200 (Tue, 06 Jun 2006) | 3 lines Use the same big-endian hack as in _ctypes/callproc.c for callback functions. This fixes the callback function tests that return float. ........ r46700 | ronald.oussoren | 2006-06-06 21:50:24 +0200 (Tue, 06 Jun 2006) | 5 lines * Ensure that "make altinstall" works when the tree was configured with --enable-framework * Also for --enable-framework: allow users to use --prefix to specify the location of the compatibility symlinks (such as /usr/local/bin/python) ........ r46701 | ronald.oussoren | 2006-06-06 21:56:00 +0200 (Tue, 06 Jun 2006) | 3 lines A quick hack to ensure the right key-bindings for IDLE on osx: install patched configuration files during a framework install. ........ r46702 | tim.peters | 2006-06-07 03:04:59 +0200 (Wed, 07 Jun 2006) | 4 lines dash_R_cleanup(): Clear filecmp._cache. This accounts for different results across -R runs (at least on Windows) of test_filecmp. ........ r46705 | tim.peters | 2006-06-07 08:57:51 +0200 (Wed, 07 Jun 2006) | 17 lines SF patch 1501987: Remove randomness from test_exceptions, from ?iga Seilnacht (sorry about the name, but Firefox on my box can't display the first character of the name -- the SF "Unix name" is zseil). This appears to cure the oddball intermittent leaks across runs when running test_exceptions under -R. I'm not sure why, but I'm too sleepy to care ;-) The thrust of the SF patch was to remove randomness in the pickle protocol used. I changed the patch to use range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and cPickle, and randomly mucked with other test lines to put statements on their own lines. Not a bugfix candidate (this is fiddling new-in-2.5 code). ........ r46706 | andrew.kuchling | 2006-06-07 15:55:33 +0200 (Wed, 07 Jun 2006) | 1 line Add an SQLite introduction, taken from the 'What's New' text ........ r46708 | andrew.kuchling | 2006-06-07 19:02:52 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46709 | andrew.kuchling | 2006-06-07 19:03:46 +0200 (Wed, 07 Jun 2006) | 1 line Add an item; also, escape % ........ r46710 | andrew.kuchling | 2006-06-07 19:04:01 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46716 | ronald.oussoren | 2006-06-07 20:57:44 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/Tools one level up ........ r46717 | ronald.oussoren | 2006-06-07 20:58:01 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/PythonLauncher one level up ........ r46718 | ronald.oussoren | 2006-06-07 20:58:42 +0200 (Wed, 07 Jun 2006) | 2 lines mv Mac/OSX/BuildScript one level up ........ r46719 | ronald.oussoren | 2006-06-07 21:02:03 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/* one level up ........ r46720 | ronald.oussoren | 2006-06-07 21:06:01 +0200 (Wed, 07 Jun 2006) | 2 lines And the last bit: move IDLE one level up and adjust makefiles ........ r46723 | ronald.oussoren | 2006-06-07 21:38:53 +0200 (Wed, 07 Jun 2006) | 4 lines - Patch the correct version of python in the Info.plists at build time, instead of relying on a maintainer to update them before releases. - Remove the now empty Mac/OSX directory ........ r46727 | ronald.oussoren | 2006-06-07 22:18:44 +0200 (Wed, 07 Jun 2006) | 7 lines * If BuildApplet.py is used as an applet it starts with a version of sys.exutable that isn't usuable on an #!-line. That results in generated applets that don't actually work. Work around this problem by resetting sys.executable. * argvemulator.py didn't work on intel macs. This patch fixes this (bug #1491468) ........ r46728 | tim.peters | 2006-06-07 22:40:06 +0200 (Wed, 07 Jun 2006) | 2 lines Whitespace normalization. ........ r46729 | tim.peters | 2006-06-07 22:40:54 +0200 (Wed, 07 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46730 | thomas.heller | 2006-06-07 22:43:06 +0200 (Wed, 07 Jun 2006) | 7 lines Fix for foreign functions returning small structures on 64-bit big endian machines. Should fix the remaininf failure in the PPC64 Debian buildbot. Thanks to Matthias Klose for providing access to a machine to debug and test this. ........ r46731 | brett.cannon | 2006-06-07 23:48:17 +0200 (Wed, 07 Jun 2006) | 2 lines Clarify documentation for bf_getcharbuffer. ........ r46735 | neal.norwitz | 2006-06-08 07:12:45 +0200 (Thu, 08 Jun 2006) | 1 line Fix a refleak in recvfrom_into ........ r46736 | gregory.p.smith | 2006-06-08 07:17:08 +0200 (Thu, 08 Jun 2006) | 9 lines - bsddb: the bsddb.dbtables Modify method now raises the proper error and aborts the db transaction safely when a modifier callback fails. Fixes SF python patch/bug #1408584. Also cleans up the bsddb.dbtables docstrings since thats the only documentation that exists for that unadvertised module. (people really should really just use sqlite3) ........ r46737 | gregory.p.smith | 2006-06-08 07:38:11 +0200 (Thu, 08 Jun 2006) | 4 lines * Turn the deadlock situation described in SF bug #775414 into a DBDeadLockError exception. * add the test case for my previous dbtables commit. ........ r46738 | gregory.p.smith | 2006-06-08 07:39:54 +0200 (Thu, 08 Jun 2006) | 2 lines pasted set_lk_detect line in wrong spot in previous commit. fixed. passes tests this time. ........ r46739 | armin.rigo | 2006-06-08 12:56:24 +0200 (Thu, 08 Jun 2006) | 6 lines (arre, arigo) SF bug #1350060 Give a consistent behavior for comparison and hashing of method objects (both user- and built-in methods). Now compares the 'self' recursively. The hash was already asking for the hash of 'self'. ........ r46740 | andrew.kuchling | 2006-06-08 13:56:44 +0200 (Thu, 08 Jun 2006) | 1 line Typo fix ........ r46741 | georg.brandl | 2006-06-08 14:45:01 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. ........ r46743 | georg.brandl | 2006-06-08 14:54:13 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502728: Correctly link against librt library on HP-UX. ........ r46745 | georg.brandl | 2006-06-08 14:55:47 +0200 (Thu, 08 Jun 2006) | 3 lines Add news for recent bugfix. ........ r46746 | georg.brandl | 2006-06-08 15:31:07 +0200 (Thu, 08 Jun 2006) | 4 lines Argh. "integer" is a very confusing word ;) Actually, checking for INT_MAX and INT_MIN is correct since the format code explicitly handles a C "int". ........ r46748 | nick.coghlan | 2006-06-08 15:54:49 +0200 (Thu, 08 Jun 2006) | 1 line Add functools.update_wrapper() and functools.wraps() as described in PEP 356 ........ r46751 | georg.brandl | 2006-06-08 16:50:21 +0200 (Thu, 08 Jun 2006) | 4 lines Bug #1502805: don't alias file.__exit__ to file.close since the latter can return something that's true. ........ r46752 | georg.brandl | 2006-06-08 16:50:53 +0200 (Thu, 08 Jun 2006) | 3 lines Convert test_file to unittest. ........
20 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merge the rest of the trunk. Merged revisions 46490-46494,46496,46498,46500,46506,46521,46538,46558,46563-46567,46570-46571,46583,46593,46595-46598,46604,46606,46609-46753 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r46610 | martin.v.loewis | 2006-06-03 09:42:26 +0200 (Sat, 03 Jun 2006) | 2 lines Updated version (win32-icons2.zip) from #1490384. ........ r46612 | andrew.kuchling | 2006-06-03 20:09:41 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1472084] Fix description of do_tag ........ r46614 | andrew.kuchling | 2006-06-03 20:33:35 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1475554] Strengthen text to say 'must' instead of 'should' ........ r46616 | andrew.kuchling | 2006-06-03 20:41:28 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1441864] Clarify description of 'data' argument ........ r46617 | andrew.kuchling | 2006-06-03 20:43:24 +0200 (Sat, 03 Jun 2006) | 1 line Minor rewording ........ r46619 | andrew.kuchling | 2006-06-03 21:02:35 +0200 (Sat, 03 Jun 2006) | 9 lines [Bug #1497414] _self is a reserved word in the WATCOM 10.6 C compiler. Fix by renaming the variable. In a different module, Neal fixed it by renaming _self to self. There's already a variable named 'self' here, so I used selfptr. (I'm committing this on a Mac without Tk, but it's a simple search-and-replace. <crosses fingers>, so I'll watch the buildbots and see what happens.) ........ r46621 | fredrik.lundh | 2006-06-03 23:56:05 +0200 (Sat, 03 Jun 2006) | 5 lines "_self" is a said to be a reserved word in Watcom C 10.6. I'm not sure that's really standard compliant behaviour, but I guess we have to fix that anyway... ........ r46622 | andrew.kuchling | 2006-06-04 00:44:42 +0200 (Sun, 04 Jun 2006) | 1 line Update readme ........ r46623 | andrew.kuchling | 2006-06-04 00:59:23 +0200 (Sun, 04 Jun 2006) | 1 line Drop 0 parameter ........ r46624 | andrew.kuchling | 2006-06-04 00:59:59 +0200 (Sun, 04 Jun 2006) | 1 line Some code tidying; use curses.wrapper ........ r46625 | andrew.kuchling | 2006-06-04 01:02:15 +0200 (Sun, 04 Jun 2006) | 1 line Use True; value returned from main is unused ........ r46626 | andrew.kuchling | 2006-06-04 01:07:21 +0200 (Sun, 04 Jun 2006) | 1 line Use true division, and the True value ........ r46627 | andrew.kuchling | 2006-06-04 01:09:58 +0200 (Sun, 04 Jun 2006) | 1 line Docstring fix; use True ........ r46628 | andrew.kuchling | 2006-06-04 01:15:56 +0200 (Sun, 04 Jun 2006) | 1 line Put code in a main() function; loosen up the spacing to match current code style ........ r46629 | andrew.kuchling | 2006-06-04 01:39:07 +0200 (Sun, 04 Jun 2006) | 1 line Use functions; modernize code ........ r46630 | andrew.kuchling | 2006-06-04 01:43:22 +0200 (Sun, 04 Jun 2006) | 1 line This demo requires Medusa (not just asyncore); remove it ........ r46631 | andrew.kuchling | 2006-06-04 01:46:36 +0200 (Sun, 04 Jun 2006) | 2 lines Remove xmlrpc demo -- it duplicates the SimpleXMLRPCServer module. ........ r46632 | andrew.kuchling | 2006-06-04 01:47:22 +0200 (Sun, 04 Jun 2006) | 1 line Remove xmlrpc/ directory ........ r46633 | andrew.kuchling | 2006-06-04 01:51:21 +0200 (Sun, 04 Jun 2006) | 1 line Remove dangling reference ........ r46634 | andrew.kuchling | 2006-06-04 01:59:36 +0200 (Sun, 04 Jun 2006) | 1 line Add more whitespace; use a better socket name ........ r46635 | tim.peters | 2006-06-04 03:22:53 +0200 (Sun, 04 Jun 2006) | 2 lines Whitespace normalization. ........ r46637 | tim.peters | 2006-06-04 05:26:02 +0200 (Sun, 04 Jun 2006) | 16 lines In a PYMALLOC_DEBUG build obmalloc adds extra debugging info to each allocated block. This was using 4 bytes for each such piece of info regardless of platform. This didn't really matter before (proof: no bug reports, and the debug-build obmalloc would have assert-failed if it was ever asked for a chunk of memory >= 2**32 bytes), since container indices were plain ints. But after the Py_ssize_t changes, it's at least theoretically possible to allocate a list or string whose guts exceed 2**32 bytes, and the PYMALLOC_DEBUG routines would fail then (having only 4 bytes to record the originally requested size). Now we use sizeof(size_t) bytes for each of a PYMALLOC_DEBUG build's extra debugging fields. This won't make any difference on 32-bit boxes, but will add 16 bytes to each allocation in a debug build on a 64-bit box. ........ r46638 | tim.peters | 2006-06-04 05:38:04 +0200 (Sun, 04 Jun 2006) | 4 lines _PyObject_DebugMalloc(): The return value should add 2*sizeof(size_t) now, not 8. This probably accounts for current disasters on the 64-bit buildbot slaves. ........ r46639 | neal.norwitz | 2006-06-04 08:19:31 +0200 (Sun, 04 Jun 2006) | 1 line SF #1499797, Fix for memory leak in WindowsError_str ........ r46640 | andrew.macintyre | 2006-06-04 14:31:09 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1454481: Make thread stack size runtime tunable. ........ r46641 | andrew.macintyre | 2006-06-04 14:59:59 +0200 (Sun, 04 Jun 2006) | 2 lines clean up function declarations to conform to PEP-7 style. ........ r46642 | martin.blais | 2006-06-04 15:49:49 +0200 (Sun, 04 Jun 2006) | 15 lines Fixes in struct and socket from merge reviews. - Following Guido's comments, renamed * pack_to -> pack_into * recv_buf -> recv_into * recvfrom_buf -> recvfrom_into - Made fixes to _struct.c according to Neal Norwitz comments on the checkins list. - Converted some ints into the appropriate -- I hope -- ssize_t and size_t. ........ r46643 | ronald.oussoren | 2006-06-04 16:05:28 +0200 (Sun, 04 Jun 2006) | 3 lines "Import" LDFLAGS in Mac/OSX/Makefile.in to ensure pythonw gets build with the right compiler flags. ........ r46644 | ronald.oussoren | 2006-06-04 16:24:59 +0200 (Sun, 04 Jun 2006) | 2 lines Drop Mac wrappers for the WASTE library. ........ r46645 | tim.peters | 2006-06-04 17:49:07 +0200 (Sun, 04 Jun 2006) | 3 lines s_methods[]: Stop compiler warnings by casting s_unpack_from to PyCFunction. ........ r46646 | george.yoshida | 2006-06-04 19:04:12 +0200 (Sun, 04 Jun 2006) | 2 lines Remove a redundant word ........ r46647 | george.yoshida | 2006-06-04 19:17:25 +0200 (Sun, 04 Jun 2006) | 2 lines Markup fix ........ r46648 | martin.v.loewis | 2006-06-04 21:36:28 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1359618: Speed-up charmap encoder. ........ r46649 | georg.brandl | 2006-06-04 23:46:16 +0200 (Sun, 04 Jun 2006) | 3 lines Repair refleaks in unicodeobject. ........ r46650 | georg.brandl | 2006-06-04 23:56:52 +0200 (Sun, 04 Jun 2006) | 4 lines Patch #1346214: correctly optimize away "if 0"-style stmts (thanks to Neal for review) ........ r46651 | georg.brandl | 2006-06-05 00:15:37 +0200 (Mon, 05 Jun 2006) | 2 lines Bug #1500293: fix memory leaks in _subprocess module. ........ r46654 | tim.peters | 2006-06-05 01:43:53 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46655 | tim.peters | 2006-06-05 01:52:47 +0200 (Mon, 05 Jun 2006) | 16 lines Revert revisions: 46640 Patch #1454481: Make thread stack size runtime tunable. 46647 Markup fix The first is causing many buildbots to fail test runs, and there are multiple causes with seemingly no immediate prospects for repairing them. See python-dev discussion. Note that a branch can (and should) be created for resolving these problems, like svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH followed by merging rev 46647 to the new branch. ........ r46656 | andrew.kuchling | 2006-06-05 02:08:09 +0200 (Mon, 05 Jun 2006) | 1 line Mention second encoding speedup ........ r46657 | gregory.p.smith | 2006-06-05 02:31:01 +0200 (Mon, 05 Jun 2006) | 7 lines bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized char **log_list. feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2. ........ r46658 | gregory.p.smith | 2006-06-05 02:33:35 +0200 (Mon, 05 Jun 2006) | 5 lines fix a bug in the previous commit. don't leak empty list on error return and fix the additional rare (out of memory only) bug that it was supposed to fix of not freeing log_list when the python allocator failed. ........ r46660 | tim.peters | 2006-06-05 02:55:26 +0200 (Mon, 05 Jun 2006) | 9 lines "Flat is better than nested." Move the long-winded, multiply-nested -R support out of runtest() and into some module-level helper functions. This makes runtest() and the -R code easier to follow. That in turn allowed seeing some opportunities for code simplification, and made it obvious that reglog.txt never got closed. ........ r46661 | hyeshik.chang | 2006-06-05 02:59:54 +0200 (Mon, 05 Jun 2006) | 3 lines Fix a potentially invalid memory access of CJKCodecs' shift-jis decoder. (found by Neal Norwitz) ........ r46663 | gregory.p.smith | 2006-06-05 03:39:52 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] ........ r46664 | tim.peters | 2006-06-05 03:43:03 +0200 (Mon, 05 Jun 2006) | 3 lines Remove doctest.testmod's deprecated (in 2.4) `isprivate` argument. A lot of hair went into supporting that! ........ r46665 | tim.peters | 2006-06-05 03:47:24 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46666 | tim.peters | 2006-06-05 03:48:21 +0200 (Mon, 05 Jun 2006) | 2 lines Make doctest news more accurate. ........ r46667 | gregory.p.smith | 2006-06-05 03:56:15 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] ........ r46668 | gregory.p.smith | 2006-06-05 04:02:25 +0200 (Mon, 05 Jun 2006) | 3 lines mention the just committed bsddb changes ........ r46671 | gregory.p.smith | 2006-06-05 19:38:04 +0200 (Mon, 05 Jun 2006) | 3 lines * add support for DBSequence objects [patch #1466734] ........ r46672 | gregory.p.smith | 2006-06-05 20:20:07 +0200 (Mon, 05 Jun 2006) | 3 lines forgot to add this file in previous commit ........ r46673 | tim.peters | 2006-06-05 20:36:12 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46674 | tim.peters | 2006-06-05 20:36:54 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46675 | gregory.p.smith | 2006-06-05 20:48:21 +0200 (Mon, 05 Jun 2006) | 4 lines * fix DBCursor.pget() bug with keyword argument names when no data= is supplied [SF pybsddb bug #1477863] ........ r46676 | andrew.kuchling | 2006-06-05 21:05:32 +0200 (Mon, 05 Jun 2006) | 1 line Remove use of Trove name, which isn't very helpful to users ........ r46677 | andrew.kuchling | 2006-06-05 21:08:25 +0200 (Mon, 05 Jun 2006) | 1 line [Bug #1470026] Include link to list of classifiers ........ r46679 | tim.peters | 2006-06-05 22:48:49 +0200 (Mon, 05 Jun 2006) | 10 lines Access _struct attributes directly instead of mucking with getattr. string_reverse(): Simplify. assertRaises(): Raise TestFailed on failure. test_unpack_from(), test_pack_into(), test_pack_into_fn(): never use `assert` to test for an expected result (it doesn't test anything when Python is run with -O). ........ r46680 | tim.peters | 2006-06-05 22:49:27 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46681 | gregory.p.smith | 2006-06-06 01:38:06 +0200 (Tue, 06 Jun 2006) | 3 lines add depends = ['md5.h'] to the _md5 module extension for correctness sake. ........ r46682 | brett.cannon | 2006-06-06 01:51:55 +0200 (Tue, 06 Jun 2006) | 4 lines Add 3 more bytes to a buffer to cover constants in string and null byte on top of 10 possible digits for an int. Closes bug #1501223. ........ r46684 | gregory.p.smith | 2006-06-06 01:59:37 +0200 (Tue, 06 Jun 2006) | 5 lines - bsddb: the __len__ method of a DB object has been fixed to return correct results. It could previously incorrectly return 0 in some cases. Fixes SF bug 1493322 (pybsddb bug 1184012). ........ r46686 | tim.peters | 2006-06-06 02:25:07 +0200 (Tue, 06 Jun 2006) | 7 lines _PySys_Init(): It's rarely a good idea to size a buffer to the exact maximum size someone guesses is needed. In this case, if we're really worried about extreme integers, then "cp%d" can actually need 14 bytes (2 for "cp" + 1 for \0 at the end + 11 for -(2**31-1)). So reserve 128 bytes instead -- nothing is actually saved by making a stack-local buffer tiny. ........ r46687 | neal.norwitz | 2006-06-06 09:22:08 +0200 (Tue, 06 Jun 2006) | 1 line Remove unused variable (and stop compiler warning) ........ r46688 | neal.norwitz | 2006-06-06 09:23:01 +0200 (Tue, 06 Jun 2006) | 1 line Fix a bunch of parameter strings ........ r46689 | thomas.heller | 2006-06-06 13:34:33 +0200 (Tue, 06 Jun 2006) | 6 lines Convert CFieldObject tp_members to tp_getset, since there is no structmember typecode for Py_ssize_t fields. This should fix some of the errors on the PPC64 debian machine (64-bit, big endian). Assigning to readonly fields now raises AttributeError instead of TypeError, so the testcase has to be changed as well. ........ r46690 | thomas.heller | 2006-06-06 13:54:32 +0200 (Tue, 06 Jun 2006) | 1 line Damn - the sentinel was missing. And fix another silly mistake. ........ r46691 | martin.blais | 2006-06-06 14:46:55 +0200 (Tue, 06 Jun 2006) | 13 lines Normalized a few cases of whitespace in function declarations. Found them using:: find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done (I was doing this all over my own code anyway, because I'd been using spaces in all defs, so I thought I'd make a run on the Python code as well. If you need to do such fixes in your own code, you can use xx-rename or parenregu.el within emacs.) ........ r46693 | thomas.heller | 2006-06-06 17:34:18 +0200 (Tue, 06 Jun 2006) | 1 line Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures ........ r46694 | tim.peters | 2006-06-06 17:50:17 +0200 (Tue, 06 Jun 2006) | 5 lines BSequence_set_range(): Rev 46688 ("Fix a bunch of parameter strings") changed this function's signature seemingly by mistake, which is causing buildbots to fail test_bsddb3. Restored the pre-46688 signature. ........ r46695 | tim.peters | 2006-06-06 17:52:35 +0200 (Tue, 06 Jun 2006) | 4 lines On python-dev Thomas Heller said these were committed by mistake in rev 46693, so reverting this part of rev 46693. ........ r46696 | andrew.kuchling | 2006-06-06 19:10:41 +0200 (Tue, 06 Jun 2006) | 1 line Fix comment typo ........ r46697 | brett.cannon | 2006-06-06 20:08:16 +0200 (Tue, 06 Jun 2006) | 2 lines Fix coding style guide bug. ........ r46698 | thomas.heller | 2006-06-06 20:50:46 +0200 (Tue, 06 Jun 2006) | 2 lines Add a hack so that foreign functions returning float now do work on 64-bit big endian platforms. ........ r46699 | thomas.heller | 2006-06-06 21:25:13 +0200 (Tue, 06 Jun 2006) | 3 lines Use the same big-endian hack as in _ctypes/callproc.c for callback functions. This fixes the callback function tests that return float. ........ r46700 | ronald.oussoren | 2006-06-06 21:50:24 +0200 (Tue, 06 Jun 2006) | 5 lines * Ensure that "make altinstall" works when the tree was configured with --enable-framework * Also for --enable-framework: allow users to use --prefix to specify the location of the compatibility symlinks (such as /usr/local/bin/python) ........ r46701 | ronald.oussoren | 2006-06-06 21:56:00 +0200 (Tue, 06 Jun 2006) | 3 lines A quick hack to ensure the right key-bindings for IDLE on osx: install patched configuration files during a framework install. ........ r46702 | tim.peters | 2006-06-07 03:04:59 +0200 (Wed, 07 Jun 2006) | 4 lines dash_R_cleanup(): Clear filecmp._cache. This accounts for different results across -R runs (at least on Windows) of test_filecmp. ........ r46705 | tim.peters | 2006-06-07 08:57:51 +0200 (Wed, 07 Jun 2006) | 17 lines SF patch 1501987: Remove randomness from test_exceptions, from ?iga Seilnacht (sorry about the name, but Firefox on my box can't display the first character of the name -- the SF "Unix name" is zseil). This appears to cure the oddball intermittent leaks across runs when running test_exceptions under -R. I'm not sure why, but I'm too sleepy to care ;-) The thrust of the SF patch was to remove randomness in the pickle protocol used. I changed the patch to use range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and cPickle, and randomly mucked with other test lines to put statements on their own lines. Not a bugfix candidate (this is fiddling new-in-2.5 code). ........ r46706 | andrew.kuchling | 2006-06-07 15:55:33 +0200 (Wed, 07 Jun 2006) | 1 line Add an SQLite introduction, taken from the 'What's New' text ........ r46708 | andrew.kuchling | 2006-06-07 19:02:52 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46709 | andrew.kuchling | 2006-06-07 19:03:46 +0200 (Wed, 07 Jun 2006) | 1 line Add an item; also, escape % ........ r46710 | andrew.kuchling | 2006-06-07 19:04:01 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46716 | ronald.oussoren | 2006-06-07 20:57:44 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/Tools one level up ........ r46717 | ronald.oussoren | 2006-06-07 20:58:01 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/PythonLauncher one level up ........ r46718 | ronald.oussoren | 2006-06-07 20:58:42 +0200 (Wed, 07 Jun 2006) | 2 lines mv Mac/OSX/BuildScript one level up ........ r46719 | ronald.oussoren | 2006-06-07 21:02:03 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/* one level up ........ r46720 | ronald.oussoren | 2006-06-07 21:06:01 +0200 (Wed, 07 Jun 2006) | 2 lines And the last bit: move IDLE one level up and adjust makefiles ........ r46723 | ronald.oussoren | 2006-06-07 21:38:53 +0200 (Wed, 07 Jun 2006) | 4 lines - Patch the correct version of python in the Info.plists at build time, instead of relying on a maintainer to update them before releases. - Remove the now empty Mac/OSX directory ........ r46727 | ronald.oussoren | 2006-06-07 22:18:44 +0200 (Wed, 07 Jun 2006) | 7 lines * If BuildApplet.py is used as an applet it starts with a version of sys.exutable that isn't usuable on an #!-line. That results in generated applets that don't actually work. Work around this problem by resetting sys.executable. * argvemulator.py didn't work on intel macs. This patch fixes this (bug #1491468) ........ r46728 | tim.peters | 2006-06-07 22:40:06 +0200 (Wed, 07 Jun 2006) | 2 lines Whitespace normalization. ........ r46729 | tim.peters | 2006-06-07 22:40:54 +0200 (Wed, 07 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46730 | thomas.heller | 2006-06-07 22:43:06 +0200 (Wed, 07 Jun 2006) | 7 lines Fix for foreign functions returning small structures on 64-bit big endian machines. Should fix the remaininf failure in the PPC64 Debian buildbot. Thanks to Matthias Klose for providing access to a machine to debug and test this. ........ r46731 | brett.cannon | 2006-06-07 23:48:17 +0200 (Wed, 07 Jun 2006) | 2 lines Clarify documentation for bf_getcharbuffer. ........ r46735 | neal.norwitz | 2006-06-08 07:12:45 +0200 (Thu, 08 Jun 2006) | 1 line Fix a refleak in recvfrom_into ........ r46736 | gregory.p.smith | 2006-06-08 07:17:08 +0200 (Thu, 08 Jun 2006) | 9 lines - bsddb: the bsddb.dbtables Modify method now raises the proper error and aborts the db transaction safely when a modifier callback fails. Fixes SF python patch/bug #1408584. Also cleans up the bsddb.dbtables docstrings since thats the only documentation that exists for that unadvertised module. (people really should really just use sqlite3) ........ r46737 | gregory.p.smith | 2006-06-08 07:38:11 +0200 (Thu, 08 Jun 2006) | 4 lines * Turn the deadlock situation described in SF bug #775414 into a DBDeadLockError exception. * add the test case for my previous dbtables commit. ........ r46738 | gregory.p.smith | 2006-06-08 07:39:54 +0200 (Thu, 08 Jun 2006) | 2 lines pasted set_lk_detect line in wrong spot in previous commit. fixed. passes tests this time. ........ r46739 | armin.rigo | 2006-06-08 12:56:24 +0200 (Thu, 08 Jun 2006) | 6 lines (arre, arigo) SF bug #1350060 Give a consistent behavior for comparison and hashing of method objects (both user- and built-in methods). Now compares the 'self' recursively. The hash was already asking for the hash of 'self'. ........ r46740 | andrew.kuchling | 2006-06-08 13:56:44 +0200 (Thu, 08 Jun 2006) | 1 line Typo fix ........ r46741 | georg.brandl | 2006-06-08 14:45:01 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. ........ r46743 | georg.brandl | 2006-06-08 14:54:13 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502728: Correctly link against librt library on HP-UX. ........ r46745 | georg.brandl | 2006-06-08 14:55:47 +0200 (Thu, 08 Jun 2006) | 3 lines Add news for recent bugfix. ........ r46746 | georg.brandl | 2006-06-08 15:31:07 +0200 (Thu, 08 Jun 2006) | 4 lines Argh. "integer" is a very confusing word ;) Actually, checking for INT_MAX and INT_MIN is correct since the format code explicitly handles a C "int". ........ r46748 | nick.coghlan | 2006-06-08 15:54:49 +0200 (Thu, 08 Jun 2006) | 1 line Add functools.update_wrapper() and functools.wraps() as described in PEP 356 ........ r46751 | georg.brandl | 2006-06-08 16:50:21 +0200 (Thu, 08 Jun 2006) | 4 lines Bug #1502805: don't alias file.__exit__ to file.close since the latter can return something that's true. ........ r46752 | georg.brandl | 2006-06-08 16:50:53 +0200 (Thu, 08 Jun 2006) | 3 lines Convert test_file to unittest. ........
20 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
32 years ago
Merge the rest of the trunk. Merged revisions 46490-46494,46496,46498,46500,46506,46521,46538,46558,46563-46567,46570-46571,46583,46593,46595-46598,46604,46606,46609-46753 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r46610 | martin.v.loewis | 2006-06-03 09:42:26 +0200 (Sat, 03 Jun 2006) | 2 lines Updated version (win32-icons2.zip) from #1490384. ........ r46612 | andrew.kuchling | 2006-06-03 20:09:41 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1472084] Fix description of do_tag ........ r46614 | andrew.kuchling | 2006-06-03 20:33:35 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1475554] Strengthen text to say 'must' instead of 'should' ........ r46616 | andrew.kuchling | 2006-06-03 20:41:28 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1441864] Clarify description of 'data' argument ........ r46617 | andrew.kuchling | 2006-06-03 20:43:24 +0200 (Sat, 03 Jun 2006) | 1 line Minor rewording ........ r46619 | andrew.kuchling | 2006-06-03 21:02:35 +0200 (Sat, 03 Jun 2006) | 9 lines [Bug #1497414] _self is a reserved word in the WATCOM 10.6 C compiler. Fix by renaming the variable. In a different module, Neal fixed it by renaming _self to self. There's already a variable named 'self' here, so I used selfptr. (I'm committing this on a Mac without Tk, but it's a simple search-and-replace. <crosses fingers>, so I'll watch the buildbots and see what happens.) ........ r46621 | fredrik.lundh | 2006-06-03 23:56:05 +0200 (Sat, 03 Jun 2006) | 5 lines "_self" is a said to be a reserved word in Watcom C 10.6. I'm not sure that's really standard compliant behaviour, but I guess we have to fix that anyway... ........ r46622 | andrew.kuchling | 2006-06-04 00:44:42 +0200 (Sun, 04 Jun 2006) | 1 line Update readme ........ r46623 | andrew.kuchling | 2006-06-04 00:59:23 +0200 (Sun, 04 Jun 2006) | 1 line Drop 0 parameter ........ r46624 | andrew.kuchling | 2006-06-04 00:59:59 +0200 (Sun, 04 Jun 2006) | 1 line Some code tidying; use curses.wrapper ........ r46625 | andrew.kuchling | 2006-06-04 01:02:15 +0200 (Sun, 04 Jun 2006) | 1 line Use True; value returned from main is unused ........ r46626 | andrew.kuchling | 2006-06-04 01:07:21 +0200 (Sun, 04 Jun 2006) | 1 line Use true division, and the True value ........ r46627 | andrew.kuchling | 2006-06-04 01:09:58 +0200 (Sun, 04 Jun 2006) | 1 line Docstring fix; use True ........ r46628 | andrew.kuchling | 2006-06-04 01:15:56 +0200 (Sun, 04 Jun 2006) | 1 line Put code in a main() function; loosen up the spacing to match current code style ........ r46629 | andrew.kuchling | 2006-06-04 01:39:07 +0200 (Sun, 04 Jun 2006) | 1 line Use functions; modernize code ........ r46630 | andrew.kuchling | 2006-06-04 01:43:22 +0200 (Sun, 04 Jun 2006) | 1 line This demo requires Medusa (not just asyncore); remove it ........ r46631 | andrew.kuchling | 2006-06-04 01:46:36 +0200 (Sun, 04 Jun 2006) | 2 lines Remove xmlrpc demo -- it duplicates the SimpleXMLRPCServer module. ........ r46632 | andrew.kuchling | 2006-06-04 01:47:22 +0200 (Sun, 04 Jun 2006) | 1 line Remove xmlrpc/ directory ........ r46633 | andrew.kuchling | 2006-06-04 01:51:21 +0200 (Sun, 04 Jun 2006) | 1 line Remove dangling reference ........ r46634 | andrew.kuchling | 2006-06-04 01:59:36 +0200 (Sun, 04 Jun 2006) | 1 line Add more whitespace; use a better socket name ........ r46635 | tim.peters | 2006-06-04 03:22:53 +0200 (Sun, 04 Jun 2006) | 2 lines Whitespace normalization. ........ r46637 | tim.peters | 2006-06-04 05:26:02 +0200 (Sun, 04 Jun 2006) | 16 lines In a PYMALLOC_DEBUG build obmalloc adds extra debugging info to each allocated block. This was using 4 bytes for each such piece of info regardless of platform. This didn't really matter before (proof: no bug reports, and the debug-build obmalloc would have assert-failed if it was ever asked for a chunk of memory >= 2**32 bytes), since container indices were plain ints. But after the Py_ssize_t changes, it's at least theoretically possible to allocate a list or string whose guts exceed 2**32 bytes, and the PYMALLOC_DEBUG routines would fail then (having only 4 bytes to record the originally requested size). Now we use sizeof(size_t) bytes for each of a PYMALLOC_DEBUG build's extra debugging fields. This won't make any difference on 32-bit boxes, but will add 16 bytes to each allocation in a debug build on a 64-bit box. ........ r46638 | tim.peters | 2006-06-04 05:38:04 +0200 (Sun, 04 Jun 2006) | 4 lines _PyObject_DebugMalloc(): The return value should add 2*sizeof(size_t) now, not 8. This probably accounts for current disasters on the 64-bit buildbot slaves. ........ r46639 | neal.norwitz | 2006-06-04 08:19:31 +0200 (Sun, 04 Jun 2006) | 1 line SF #1499797, Fix for memory leak in WindowsError_str ........ r46640 | andrew.macintyre | 2006-06-04 14:31:09 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1454481: Make thread stack size runtime tunable. ........ r46641 | andrew.macintyre | 2006-06-04 14:59:59 +0200 (Sun, 04 Jun 2006) | 2 lines clean up function declarations to conform to PEP-7 style. ........ r46642 | martin.blais | 2006-06-04 15:49:49 +0200 (Sun, 04 Jun 2006) | 15 lines Fixes in struct and socket from merge reviews. - Following Guido's comments, renamed * pack_to -> pack_into * recv_buf -> recv_into * recvfrom_buf -> recvfrom_into - Made fixes to _struct.c according to Neal Norwitz comments on the checkins list. - Converted some ints into the appropriate -- I hope -- ssize_t and size_t. ........ r46643 | ronald.oussoren | 2006-06-04 16:05:28 +0200 (Sun, 04 Jun 2006) | 3 lines "Import" LDFLAGS in Mac/OSX/Makefile.in to ensure pythonw gets build with the right compiler flags. ........ r46644 | ronald.oussoren | 2006-06-04 16:24:59 +0200 (Sun, 04 Jun 2006) | 2 lines Drop Mac wrappers for the WASTE library. ........ r46645 | tim.peters | 2006-06-04 17:49:07 +0200 (Sun, 04 Jun 2006) | 3 lines s_methods[]: Stop compiler warnings by casting s_unpack_from to PyCFunction. ........ r46646 | george.yoshida | 2006-06-04 19:04:12 +0200 (Sun, 04 Jun 2006) | 2 lines Remove a redundant word ........ r46647 | george.yoshida | 2006-06-04 19:17:25 +0200 (Sun, 04 Jun 2006) | 2 lines Markup fix ........ r46648 | martin.v.loewis | 2006-06-04 21:36:28 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1359618: Speed-up charmap encoder. ........ r46649 | georg.brandl | 2006-06-04 23:46:16 +0200 (Sun, 04 Jun 2006) | 3 lines Repair refleaks in unicodeobject. ........ r46650 | georg.brandl | 2006-06-04 23:56:52 +0200 (Sun, 04 Jun 2006) | 4 lines Patch #1346214: correctly optimize away "if 0"-style stmts (thanks to Neal for review) ........ r46651 | georg.brandl | 2006-06-05 00:15:37 +0200 (Mon, 05 Jun 2006) | 2 lines Bug #1500293: fix memory leaks in _subprocess module. ........ r46654 | tim.peters | 2006-06-05 01:43:53 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46655 | tim.peters | 2006-06-05 01:52:47 +0200 (Mon, 05 Jun 2006) | 16 lines Revert revisions: 46640 Patch #1454481: Make thread stack size runtime tunable. 46647 Markup fix The first is causing many buildbots to fail test runs, and there are multiple causes with seemingly no immediate prospects for repairing them. See python-dev discussion. Note that a branch can (and should) be created for resolving these problems, like svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH followed by merging rev 46647 to the new branch. ........ r46656 | andrew.kuchling | 2006-06-05 02:08:09 +0200 (Mon, 05 Jun 2006) | 1 line Mention second encoding speedup ........ r46657 | gregory.p.smith | 2006-06-05 02:31:01 +0200 (Mon, 05 Jun 2006) | 7 lines bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized char **log_list. feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2. ........ r46658 | gregory.p.smith | 2006-06-05 02:33:35 +0200 (Mon, 05 Jun 2006) | 5 lines fix a bug in the previous commit. don't leak empty list on error return and fix the additional rare (out of memory only) bug that it was supposed to fix of not freeing log_list when the python allocator failed. ........ r46660 | tim.peters | 2006-06-05 02:55:26 +0200 (Mon, 05 Jun 2006) | 9 lines "Flat is better than nested." Move the long-winded, multiply-nested -R support out of runtest() and into some module-level helper functions. This makes runtest() and the -R code easier to follow. That in turn allowed seeing some opportunities for code simplification, and made it obvious that reglog.txt never got closed. ........ r46661 | hyeshik.chang | 2006-06-05 02:59:54 +0200 (Mon, 05 Jun 2006) | 3 lines Fix a potentially invalid memory access of CJKCodecs' shift-jis decoder. (found by Neal Norwitz) ........ r46663 | gregory.p.smith | 2006-06-05 03:39:52 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] ........ r46664 | tim.peters | 2006-06-05 03:43:03 +0200 (Mon, 05 Jun 2006) | 3 lines Remove doctest.testmod's deprecated (in 2.4) `isprivate` argument. A lot of hair went into supporting that! ........ r46665 | tim.peters | 2006-06-05 03:47:24 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46666 | tim.peters | 2006-06-05 03:48:21 +0200 (Mon, 05 Jun 2006) | 2 lines Make doctest news more accurate. ........ r46667 | gregory.p.smith | 2006-06-05 03:56:15 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] ........ r46668 | gregory.p.smith | 2006-06-05 04:02:25 +0200 (Mon, 05 Jun 2006) | 3 lines mention the just committed bsddb changes ........ r46671 | gregory.p.smith | 2006-06-05 19:38:04 +0200 (Mon, 05 Jun 2006) | 3 lines * add support for DBSequence objects [patch #1466734] ........ r46672 | gregory.p.smith | 2006-06-05 20:20:07 +0200 (Mon, 05 Jun 2006) | 3 lines forgot to add this file in previous commit ........ r46673 | tim.peters | 2006-06-05 20:36:12 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46674 | tim.peters | 2006-06-05 20:36:54 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46675 | gregory.p.smith | 2006-06-05 20:48:21 +0200 (Mon, 05 Jun 2006) | 4 lines * fix DBCursor.pget() bug with keyword argument names when no data= is supplied [SF pybsddb bug #1477863] ........ r46676 | andrew.kuchling | 2006-06-05 21:05:32 +0200 (Mon, 05 Jun 2006) | 1 line Remove use of Trove name, which isn't very helpful to users ........ r46677 | andrew.kuchling | 2006-06-05 21:08:25 +0200 (Mon, 05 Jun 2006) | 1 line [Bug #1470026] Include link to list of classifiers ........ r46679 | tim.peters | 2006-06-05 22:48:49 +0200 (Mon, 05 Jun 2006) | 10 lines Access _struct attributes directly instead of mucking with getattr. string_reverse(): Simplify. assertRaises(): Raise TestFailed on failure. test_unpack_from(), test_pack_into(), test_pack_into_fn(): never use `assert` to test for an expected result (it doesn't test anything when Python is run with -O). ........ r46680 | tim.peters | 2006-06-05 22:49:27 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46681 | gregory.p.smith | 2006-06-06 01:38:06 +0200 (Tue, 06 Jun 2006) | 3 lines add depends = ['md5.h'] to the _md5 module extension for correctness sake. ........ r46682 | brett.cannon | 2006-06-06 01:51:55 +0200 (Tue, 06 Jun 2006) | 4 lines Add 3 more bytes to a buffer to cover constants in string and null byte on top of 10 possible digits for an int. Closes bug #1501223. ........ r46684 | gregory.p.smith | 2006-06-06 01:59:37 +0200 (Tue, 06 Jun 2006) | 5 lines - bsddb: the __len__ method of a DB object has been fixed to return correct results. It could previously incorrectly return 0 in some cases. Fixes SF bug 1493322 (pybsddb bug 1184012). ........ r46686 | tim.peters | 2006-06-06 02:25:07 +0200 (Tue, 06 Jun 2006) | 7 lines _PySys_Init(): It's rarely a good idea to size a buffer to the exact maximum size someone guesses is needed. In this case, if we're really worried about extreme integers, then "cp%d" can actually need 14 bytes (2 for "cp" + 1 for \0 at the end + 11 for -(2**31-1)). So reserve 128 bytes instead -- nothing is actually saved by making a stack-local buffer tiny. ........ r46687 | neal.norwitz | 2006-06-06 09:22:08 +0200 (Tue, 06 Jun 2006) | 1 line Remove unused variable (and stop compiler warning) ........ r46688 | neal.norwitz | 2006-06-06 09:23:01 +0200 (Tue, 06 Jun 2006) | 1 line Fix a bunch of parameter strings ........ r46689 | thomas.heller | 2006-06-06 13:34:33 +0200 (Tue, 06 Jun 2006) | 6 lines Convert CFieldObject tp_members to tp_getset, since there is no structmember typecode for Py_ssize_t fields. This should fix some of the errors on the PPC64 debian machine (64-bit, big endian). Assigning to readonly fields now raises AttributeError instead of TypeError, so the testcase has to be changed as well. ........ r46690 | thomas.heller | 2006-06-06 13:54:32 +0200 (Tue, 06 Jun 2006) | 1 line Damn - the sentinel was missing. And fix another silly mistake. ........ r46691 | martin.blais | 2006-06-06 14:46:55 +0200 (Tue, 06 Jun 2006) | 13 lines Normalized a few cases of whitespace in function declarations. Found them using:: find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done (I was doing this all over my own code anyway, because I'd been using spaces in all defs, so I thought I'd make a run on the Python code as well. If you need to do such fixes in your own code, you can use xx-rename or parenregu.el within emacs.) ........ r46693 | thomas.heller | 2006-06-06 17:34:18 +0200 (Tue, 06 Jun 2006) | 1 line Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures ........ r46694 | tim.peters | 2006-06-06 17:50:17 +0200 (Tue, 06 Jun 2006) | 5 lines BSequence_set_range(): Rev 46688 ("Fix a bunch of parameter strings") changed this function's signature seemingly by mistake, which is causing buildbots to fail test_bsddb3. Restored the pre-46688 signature. ........ r46695 | tim.peters | 2006-06-06 17:52:35 +0200 (Tue, 06 Jun 2006) | 4 lines On python-dev Thomas Heller said these were committed by mistake in rev 46693, so reverting this part of rev 46693. ........ r46696 | andrew.kuchling | 2006-06-06 19:10:41 +0200 (Tue, 06 Jun 2006) | 1 line Fix comment typo ........ r46697 | brett.cannon | 2006-06-06 20:08:16 +0200 (Tue, 06 Jun 2006) | 2 lines Fix coding style guide bug. ........ r46698 | thomas.heller | 2006-06-06 20:50:46 +0200 (Tue, 06 Jun 2006) | 2 lines Add a hack so that foreign functions returning float now do work on 64-bit big endian platforms. ........ r46699 | thomas.heller | 2006-06-06 21:25:13 +0200 (Tue, 06 Jun 2006) | 3 lines Use the same big-endian hack as in _ctypes/callproc.c for callback functions. This fixes the callback function tests that return float. ........ r46700 | ronald.oussoren | 2006-06-06 21:50:24 +0200 (Tue, 06 Jun 2006) | 5 lines * Ensure that "make altinstall" works when the tree was configured with --enable-framework * Also for --enable-framework: allow users to use --prefix to specify the location of the compatibility symlinks (such as /usr/local/bin/python) ........ r46701 | ronald.oussoren | 2006-06-06 21:56:00 +0200 (Tue, 06 Jun 2006) | 3 lines A quick hack to ensure the right key-bindings for IDLE on osx: install patched configuration files during a framework install. ........ r46702 | tim.peters | 2006-06-07 03:04:59 +0200 (Wed, 07 Jun 2006) | 4 lines dash_R_cleanup(): Clear filecmp._cache. This accounts for different results across -R runs (at least on Windows) of test_filecmp. ........ r46705 | tim.peters | 2006-06-07 08:57:51 +0200 (Wed, 07 Jun 2006) | 17 lines SF patch 1501987: Remove randomness from test_exceptions, from ?iga Seilnacht (sorry about the name, but Firefox on my box can't display the first character of the name -- the SF "Unix name" is zseil). This appears to cure the oddball intermittent leaks across runs when running test_exceptions under -R. I'm not sure why, but I'm too sleepy to care ;-) The thrust of the SF patch was to remove randomness in the pickle protocol used. I changed the patch to use range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and cPickle, and randomly mucked with other test lines to put statements on their own lines. Not a bugfix candidate (this is fiddling new-in-2.5 code). ........ r46706 | andrew.kuchling | 2006-06-07 15:55:33 +0200 (Wed, 07 Jun 2006) | 1 line Add an SQLite introduction, taken from the 'What's New' text ........ r46708 | andrew.kuchling | 2006-06-07 19:02:52 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46709 | andrew.kuchling | 2006-06-07 19:03:46 +0200 (Wed, 07 Jun 2006) | 1 line Add an item; also, escape % ........ r46710 | andrew.kuchling | 2006-06-07 19:04:01 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46716 | ronald.oussoren | 2006-06-07 20:57:44 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/Tools one level up ........ r46717 | ronald.oussoren | 2006-06-07 20:58:01 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/PythonLauncher one level up ........ r46718 | ronald.oussoren | 2006-06-07 20:58:42 +0200 (Wed, 07 Jun 2006) | 2 lines mv Mac/OSX/BuildScript one level up ........ r46719 | ronald.oussoren | 2006-06-07 21:02:03 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/* one level up ........ r46720 | ronald.oussoren | 2006-06-07 21:06:01 +0200 (Wed, 07 Jun 2006) | 2 lines And the last bit: move IDLE one level up and adjust makefiles ........ r46723 | ronald.oussoren | 2006-06-07 21:38:53 +0200 (Wed, 07 Jun 2006) | 4 lines - Patch the correct version of python in the Info.plists at build time, instead of relying on a maintainer to update them before releases. - Remove the now empty Mac/OSX directory ........ r46727 | ronald.oussoren | 2006-06-07 22:18:44 +0200 (Wed, 07 Jun 2006) | 7 lines * If BuildApplet.py is used as an applet it starts with a version of sys.exutable that isn't usuable on an #!-line. That results in generated applets that don't actually work. Work around this problem by resetting sys.executable. * argvemulator.py didn't work on intel macs. This patch fixes this (bug #1491468) ........ r46728 | tim.peters | 2006-06-07 22:40:06 +0200 (Wed, 07 Jun 2006) | 2 lines Whitespace normalization. ........ r46729 | tim.peters | 2006-06-07 22:40:54 +0200 (Wed, 07 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46730 | thomas.heller | 2006-06-07 22:43:06 +0200 (Wed, 07 Jun 2006) | 7 lines Fix for foreign functions returning small structures on 64-bit big endian machines. Should fix the remaininf failure in the PPC64 Debian buildbot. Thanks to Matthias Klose for providing access to a machine to debug and test this. ........ r46731 | brett.cannon | 2006-06-07 23:48:17 +0200 (Wed, 07 Jun 2006) | 2 lines Clarify documentation for bf_getcharbuffer. ........ r46735 | neal.norwitz | 2006-06-08 07:12:45 +0200 (Thu, 08 Jun 2006) | 1 line Fix a refleak in recvfrom_into ........ r46736 | gregory.p.smith | 2006-06-08 07:17:08 +0200 (Thu, 08 Jun 2006) | 9 lines - bsddb: the bsddb.dbtables Modify method now raises the proper error and aborts the db transaction safely when a modifier callback fails. Fixes SF python patch/bug #1408584. Also cleans up the bsddb.dbtables docstrings since thats the only documentation that exists for that unadvertised module. (people really should really just use sqlite3) ........ r46737 | gregory.p.smith | 2006-06-08 07:38:11 +0200 (Thu, 08 Jun 2006) | 4 lines * Turn the deadlock situation described in SF bug #775414 into a DBDeadLockError exception. * add the test case for my previous dbtables commit. ........ r46738 | gregory.p.smith | 2006-06-08 07:39:54 +0200 (Thu, 08 Jun 2006) | 2 lines pasted set_lk_detect line in wrong spot in previous commit. fixed. passes tests this time. ........ r46739 | armin.rigo | 2006-06-08 12:56:24 +0200 (Thu, 08 Jun 2006) | 6 lines (arre, arigo) SF bug #1350060 Give a consistent behavior for comparison and hashing of method objects (both user- and built-in methods). Now compares the 'self' recursively. The hash was already asking for the hash of 'self'. ........ r46740 | andrew.kuchling | 2006-06-08 13:56:44 +0200 (Thu, 08 Jun 2006) | 1 line Typo fix ........ r46741 | georg.brandl | 2006-06-08 14:45:01 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. ........ r46743 | georg.brandl | 2006-06-08 14:54:13 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502728: Correctly link against librt library on HP-UX. ........ r46745 | georg.brandl | 2006-06-08 14:55:47 +0200 (Thu, 08 Jun 2006) | 3 lines Add news for recent bugfix. ........ r46746 | georg.brandl | 2006-06-08 15:31:07 +0200 (Thu, 08 Jun 2006) | 4 lines Argh. "integer" is a very confusing word ;) Actually, checking for INT_MAX and INT_MIN is correct since the format code explicitly handles a C "int". ........ r46748 | nick.coghlan | 2006-06-08 15:54:49 +0200 (Thu, 08 Jun 2006) | 1 line Add functools.update_wrapper() and functools.wraps() as described in PEP 356 ........ r46751 | georg.brandl | 2006-06-08 16:50:21 +0200 (Thu, 08 Jun 2006) | 4 lines Bug #1502805: don't alias file.__exit__ to file.close since the latter can return something that's true. ........ r46752 | georg.brandl | 2006-06-08 16:50:53 +0200 (Thu, 08 Jun 2006) | 3 lines Convert test_file to unittest. ........
20 years ago
32 years ago
32 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
32 years ago
32 years ago
32 years ago
Merge the rest of the trunk. Merged revisions 46490-46494,46496,46498,46500,46506,46521,46538,46558,46563-46567,46570-46571,46583,46593,46595-46598,46604,46606,46609-46753 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r46610 | martin.v.loewis | 2006-06-03 09:42:26 +0200 (Sat, 03 Jun 2006) | 2 lines Updated version (win32-icons2.zip) from #1490384. ........ r46612 | andrew.kuchling | 2006-06-03 20:09:41 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1472084] Fix description of do_tag ........ r46614 | andrew.kuchling | 2006-06-03 20:33:35 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1475554] Strengthen text to say 'must' instead of 'should' ........ r46616 | andrew.kuchling | 2006-06-03 20:41:28 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1441864] Clarify description of 'data' argument ........ r46617 | andrew.kuchling | 2006-06-03 20:43:24 +0200 (Sat, 03 Jun 2006) | 1 line Minor rewording ........ r46619 | andrew.kuchling | 2006-06-03 21:02:35 +0200 (Sat, 03 Jun 2006) | 9 lines [Bug #1497414] _self is a reserved word in the WATCOM 10.6 C compiler. Fix by renaming the variable. In a different module, Neal fixed it by renaming _self to self. There's already a variable named 'self' here, so I used selfptr. (I'm committing this on a Mac without Tk, but it's a simple search-and-replace. <crosses fingers>, so I'll watch the buildbots and see what happens.) ........ r46621 | fredrik.lundh | 2006-06-03 23:56:05 +0200 (Sat, 03 Jun 2006) | 5 lines "_self" is a said to be a reserved word in Watcom C 10.6. I'm not sure that's really standard compliant behaviour, but I guess we have to fix that anyway... ........ r46622 | andrew.kuchling | 2006-06-04 00:44:42 +0200 (Sun, 04 Jun 2006) | 1 line Update readme ........ r46623 | andrew.kuchling | 2006-06-04 00:59:23 +0200 (Sun, 04 Jun 2006) | 1 line Drop 0 parameter ........ r46624 | andrew.kuchling | 2006-06-04 00:59:59 +0200 (Sun, 04 Jun 2006) | 1 line Some code tidying; use curses.wrapper ........ r46625 | andrew.kuchling | 2006-06-04 01:02:15 +0200 (Sun, 04 Jun 2006) | 1 line Use True; value returned from main is unused ........ r46626 | andrew.kuchling | 2006-06-04 01:07:21 +0200 (Sun, 04 Jun 2006) | 1 line Use true division, and the True value ........ r46627 | andrew.kuchling | 2006-06-04 01:09:58 +0200 (Sun, 04 Jun 2006) | 1 line Docstring fix; use True ........ r46628 | andrew.kuchling | 2006-06-04 01:15:56 +0200 (Sun, 04 Jun 2006) | 1 line Put code in a main() function; loosen up the spacing to match current code style ........ r46629 | andrew.kuchling | 2006-06-04 01:39:07 +0200 (Sun, 04 Jun 2006) | 1 line Use functions; modernize code ........ r46630 | andrew.kuchling | 2006-06-04 01:43:22 +0200 (Sun, 04 Jun 2006) | 1 line This demo requires Medusa (not just asyncore); remove it ........ r46631 | andrew.kuchling | 2006-06-04 01:46:36 +0200 (Sun, 04 Jun 2006) | 2 lines Remove xmlrpc demo -- it duplicates the SimpleXMLRPCServer module. ........ r46632 | andrew.kuchling | 2006-06-04 01:47:22 +0200 (Sun, 04 Jun 2006) | 1 line Remove xmlrpc/ directory ........ r46633 | andrew.kuchling | 2006-06-04 01:51:21 +0200 (Sun, 04 Jun 2006) | 1 line Remove dangling reference ........ r46634 | andrew.kuchling | 2006-06-04 01:59:36 +0200 (Sun, 04 Jun 2006) | 1 line Add more whitespace; use a better socket name ........ r46635 | tim.peters | 2006-06-04 03:22:53 +0200 (Sun, 04 Jun 2006) | 2 lines Whitespace normalization. ........ r46637 | tim.peters | 2006-06-04 05:26:02 +0200 (Sun, 04 Jun 2006) | 16 lines In a PYMALLOC_DEBUG build obmalloc adds extra debugging info to each allocated block. This was using 4 bytes for each such piece of info regardless of platform. This didn't really matter before (proof: no bug reports, and the debug-build obmalloc would have assert-failed if it was ever asked for a chunk of memory >= 2**32 bytes), since container indices were plain ints. But after the Py_ssize_t changes, it's at least theoretically possible to allocate a list or string whose guts exceed 2**32 bytes, and the PYMALLOC_DEBUG routines would fail then (having only 4 bytes to record the originally requested size). Now we use sizeof(size_t) bytes for each of a PYMALLOC_DEBUG build's extra debugging fields. This won't make any difference on 32-bit boxes, but will add 16 bytes to each allocation in a debug build on a 64-bit box. ........ r46638 | tim.peters | 2006-06-04 05:38:04 +0200 (Sun, 04 Jun 2006) | 4 lines _PyObject_DebugMalloc(): The return value should add 2*sizeof(size_t) now, not 8. This probably accounts for current disasters on the 64-bit buildbot slaves. ........ r46639 | neal.norwitz | 2006-06-04 08:19:31 +0200 (Sun, 04 Jun 2006) | 1 line SF #1499797, Fix for memory leak in WindowsError_str ........ r46640 | andrew.macintyre | 2006-06-04 14:31:09 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1454481: Make thread stack size runtime tunable. ........ r46641 | andrew.macintyre | 2006-06-04 14:59:59 +0200 (Sun, 04 Jun 2006) | 2 lines clean up function declarations to conform to PEP-7 style. ........ r46642 | martin.blais | 2006-06-04 15:49:49 +0200 (Sun, 04 Jun 2006) | 15 lines Fixes in struct and socket from merge reviews. - Following Guido's comments, renamed * pack_to -> pack_into * recv_buf -> recv_into * recvfrom_buf -> recvfrom_into - Made fixes to _struct.c according to Neal Norwitz comments on the checkins list. - Converted some ints into the appropriate -- I hope -- ssize_t and size_t. ........ r46643 | ronald.oussoren | 2006-06-04 16:05:28 +0200 (Sun, 04 Jun 2006) | 3 lines "Import" LDFLAGS in Mac/OSX/Makefile.in to ensure pythonw gets build with the right compiler flags. ........ r46644 | ronald.oussoren | 2006-06-04 16:24:59 +0200 (Sun, 04 Jun 2006) | 2 lines Drop Mac wrappers for the WASTE library. ........ r46645 | tim.peters | 2006-06-04 17:49:07 +0200 (Sun, 04 Jun 2006) | 3 lines s_methods[]: Stop compiler warnings by casting s_unpack_from to PyCFunction. ........ r46646 | george.yoshida | 2006-06-04 19:04:12 +0200 (Sun, 04 Jun 2006) | 2 lines Remove a redundant word ........ r46647 | george.yoshida | 2006-06-04 19:17:25 +0200 (Sun, 04 Jun 2006) | 2 lines Markup fix ........ r46648 | martin.v.loewis | 2006-06-04 21:36:28 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1359618: Speed-up charmap encoder. ........ r46649 | georg.brandl | 2006-06-04 23:46:16 +0200 (Sun, 04 Jun 2006) | 3 lines Repair refleaks in unicodeobject. ........ r46650 | georg.brandl | 2006-06-04 23:56:52 +0200 (Sun, 04 Jun 2006) | 4 lines Patch #1346214: correctly optimize away "if 0"-style stmts (thanks to Neal for review) ........ r46651 | georg.brandl | 2006-06-05 00:15:37 +0200 (Mon, 05 Jun 2006) | 2 lines Bug #1500293: fix memory leaks in _subprocess module. ........ r46654 | tim.peters | 2006-06-05 01:43:53 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46655 | tim.peters | 2006-06-05 01:52:47 +0200 (Mon, 05 Jun 2006) | 16 lines Revert revisions: 46640 Patch #1454481: Make thread stack size runtime tunable. 46647 Markup fix The first is causing many buildbots to fail test runs, and there are multiple causes with seemingly no immediate prospects for repairing them. See python-dev discussion. Note that a branch can (and should) be created for resolving these problems, like svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH followed by merging rev 46647 to the new branch. ........ r46656 | andrew.kuchling | 2006-06-05 02:08:09 +0200 (Mon, 05 Jun 2006) | 1 line Mention second encoding speedup ........ r46657 | gregory.p.smith | 2006-06-05 02:31:01 +0200 (Mon, 05 Jun 2006) | 7 lines bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized char **log_list. feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2. ........ r46658 | gregory.p.smith | 2006-06-05 02:33:35 +0200 (Mon, 05 Jun 2006) | 5 lines fix a bug in the previous commit. don't leak empty list on error return and fix the additional rare (out of memory only) bug that it was supposed to fix of not freeing log_list when the python allocator failed. ........ r46660 | tim.peters | 2006-06-05 02:55:26 +0200 (Mon, 05 Jun 2006) | 9 lines "Flat is better than nested." Move the long-winded, multiply-nested -R support out of runtest() and into some module-level helper functions. This makes runtest() and the -R code easier to follow. That in turn allowed seeing some opportunities for code simplification, and made it obvious that reglog.txt never got closed. ........ r46661 | hyeshik.chang | 2006-06-05 02:59:54 +0200 (Mon, 05 Jun 2006) | 3 lines Fix a potentially invalid memory access of CJKCodecs' shift-jis decoder. (found by Neal Norwitz) ........ r46663 | gregory.p.smith | 2006-06-05 03:39:52 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] ........ r46664 | tim.peters | 2006-06-05 03:43:03 +0200 (Mon, 05 Jun 2006) | 3 lines Remove doctest.testmod's deprecated (in 2.4) `isprivate` argument. A lot of hair went into supporting that! ........ r46665 | tim.peters | 2006-06-05 03:47:24 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46666 | tim.peters | 2006-06-05 03:48:21 +0200 (Mon, 05 Jun 2006) | 2 lines Make doctest news more accurate. ........ r46667 | gregory.p.smith | 2006-06-05 03:56:15 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] ........ r46668 | gregory.p.smith | 2006-06-05 04:02:25 +0200 (Mon, 05 Jun 2006) | 3 lines mention the just committed bsddb changes ........ r46671 | gregory.p.smith | 2006-06-05 19:38:04 +0200 (Mon, 05 Jun 2006) | 3 lines * add support for DBSequence objects [patch #1466734] ........ r46672 | gregory.p.smith | 2006-06-05 20:20:07 +0200 (Mon, 05 Jun 2006) | 3 lines forgot to add this file in previous commit ........ r46673 | tim.peters | 2006-06-05 20:36:12 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46674 | tim.peters | 2006-06-05 20:36:54 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46675 | gregory.p.smith | 2006-06-05 20:48:21 +0200 (Mon, 05 Jun 2006) | 4 lines * fix DBCursor.pget() bug with keyword argument names when no data= is supplied [SF pybsddb bug #1477863] ........ r46676 | andrew.kuchling | 2006-06-05 21:05:32 +0200 (Mon, 05 Jun 2006) | 1 line Remove use of Trove name, which isn't very helpful to users ........ r46677 | andrew.kuchling | 2006-06-05 21:08:25 +0200 (Mon, 05 Jun 2006) | 1 line [Bug #1470026] Include link to list of classifiers ........ r46679 | tim.peters | 2006-06-05 22:48:49 +0200 (Mon, 05 Jun 2006) | 10 lines Access _struct attributes directly instead of mucking with getattr. string_reverse(): Simplify. assertRaises(): Raise TestFailed on failure. test_unpack_from(), test_pack_into(), test_pack_into_fn(): never use `assert` to test for an expected result (it doesn't test anything when Python is run with -O). ........ r46680 | tim.peters | 2006-06-05 22:49:27 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46681 | gregory.p.smith | 2006-06-06 01:38:06 +0200 (Tue, 06 Jun 2006) | 3 lines add depends = ['md5.h'] to the _md5 module extension for correctness sake. ........ r46682 | brett.cannon | 2006-06-06 01:51:55 +0200 (Tue, 06 Jun 2006) | 4 lines Add 3 more bytes to a buffer to cover constants in string and null byte on top of 10 possible digits for an int. Closes bug #1501223. ........ r46684 | gregory.p.smith | 2006-06-06 01:59:37 +0200 (Tue, 06 Jun 2006) | 5 lines - bsddb: the __len__ method of a DB object has been fixed to return correct results. It could previously incorrectly return 0 in some cases. Fixes SF bug 1493322 (pybsddb bug 1184012). ........ r46686 | tim.peters | 2006-06-06 02:25:07 +0200 (Tue, 06 Jun 2006) | 7 lines _PySys_Init(): It's rarely a good idea to size a buffer to the exact maximum size someone guesses is needed. In this case, if we're really worried about extreme integers, then "cp%d" can actually need 14 bytes (2 for "cp" + 1 for \0 at the end + 11 for -(2**31-1)). So reserve 128 bytes instead -- nothing is actually saved by making a stack-local buffer tiny. ........ r46687 | neal.norwitz | 2006-06-06 09:22:08 +0200 (Tue, 06 Jun 2006) | 1 line Remove unused variable (and stop compiler warning) ........ r46688 | neal.norwitz | 2006-06-06 09:23:01 +0200 (Tue, 06 Jun 2006) | 1 line Fix a bunch of parameter strings ........ r46689 | thomas.heller | 2006-06-06 13:34:33 +0200 (Tue, 06 Jun 2006) | 6 lines Convert CFieldObject tp_members to tp_getset, since there is no structmember typecode for Py_ssize_t fields. This should fix some of the errors on the PPC64 debian machine (64-bit, big endian). Assigning to readonly fields now raises AttributeError instead of TypeError, so the testcase has to be changed as well. ........ r46690 | thomas.heller | 2006-06-06 13:54:32 +0200 (Tue, 06 Jun 2006) | 1 line Damn - the sentinel was missing. And fix another silly mistake. ........ r46691 | martin.blais | 2006-06-06 14:46:55 +0200 (Tue, 06 Jun 2006) | 13 lines Normalized a few cases of whitespace in function declarations. Found them using:: find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done (I was doing this all over my own code anyway, because I'd been using spaces in all defs, so I thought I'd make a run on the Python code as well. If you need to do such fixes in your own code, you can use xx-rename or parenregu.el within emacs.) ........ r46693 | thomas.heller | 2006-06-06 17:34:18 +0200 (Tue, 06 Jun 2006) | 1 line Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures ........ r46694 | tim.peters | 2006-06-06 17:50:17 +0200 (Tue, 06 Jun 2006) | 5 lines BSequence_set_range(): Rev 46688 ("Fix a bunch of parameter strings") changed this function's signature seemingly by mistake, which is causing buildbots to fail test_bsddb3. Restored the pre-46688 signature. ........ r46695 | tim.peters | 2006-06-06 17:52:35 +0200 (Tue, 06 Jun 2006) | 4 lines On python-dev Thomas Heller said these were committed by mistake in rev 46693, so reverting this part of rev 46693. ........ r46696 | andrew.kuchling | 2006-06-06 19:10:41 +0200 (Tue, 06 Jun 2006) | 1 line Fix comment typo ........ r46697 | brett.cannon | 2006-06-06 20:08:16 +0200 (Tue, 06 Jun 2006) | 2 lines Fix coding style guide bug. ........ r46698 | thomas.heller | 2006-06-06 20:50:46 +0200 (Tue, 06 Jun 2006) | 2 lines Add a hack so that foreign functions returning float now do work on 64-bit big endian platforms. ........ r46699 | thomas.heller | 2006-06-06 21:25:13 +0200 (Tue, 06 Jun 2006) | 3 lines Use the same big-endian hack as in _ctypes/callproc.c for callback functions. This fixes the callback function tests that return float. ........ r46700 | ronald.oussoren | 2006-06-06 21:50:24 +0200 (Tue, 06 Jun 2006) | 5 lines * Ensure that "make altinstall" works when the tree was configured with --enable-framework * Also for --enable-framework: allow users to use --prefix to specify the location of the compatibility symlinks (such as /usr/local/bin/python) ........ r46701 | ronald.oussoren | 2006-06-06 21:56:00 +0200 (Tue, 06 Jun 2006) | 3 lines A quick hack to ensure the right key-bindings for IDLE on osx: install patched configuration files during a framework install. ........ r46702 | tim.peters | 2006-06-07 03:04:59 +0200 (Wed, 07 Jun 2006) | 4 lines dash_R_cleanup(): Clear filecmp._cache. This accounts for different results across -R runs (at least on Windows) of test_filecmp. ........ r46705 | tim.peters | 2006-06-07 08:57:51 +0200 (Wed, 07 Jun 2006) | 17 lines SF patch 1501987: Remove randomness from test_exceptions, from ?iga Seilnacht (sorry about the name, but Firefox on my box can't display the first character of the name -- the SF "Unix name" is zseil). This appears to cure the oddball intermittent leaks across runs when running test_exceptions under -R. I'm not sure why, but I'm too sleepy to care ;-) The thrust of the SF patch was to remove randomness in the pickle protocol used. I changed the patch to use range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and cPickle, and randomly mucked with other test lines to put statements on their own lines. Not a bugfix candidate (this is fiddling new-in-2.5 code). ........ r46706 | andrew.kuchling | 2006-06-07 15:55:33 +0200 (Wed, 07 Jun 2006) | 1 line Add an SQLite introduction, taken from the 'What's New' text ........ r46708 | andrew.kuchling | 2006-06-07 19:02:52 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46709 | andrew.kuchling | 2006-06-07 19:03:46 +0200 (Wed, 07 Jun 2006) | 1 line Add an item; also, escape % ........ r46710 | andrew.kuchling | 2006-06-07 19:04:01 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46716 | ronald.oussoren | 2006-06-07 20:57:44 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/Tools one level up ........ r46717 | ronald.oussoren | 2006-06-07 20:58:01 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/PythonLauncher one level up ........ r46718 | ronald.oussoren | 2006-06-07 20:58:42 +0200 (Wed, 07 Jun 2006) | 2 lines mv Mac/OSX/BuildScript one level up ........ r46719 | ronald.oussoren | 2006-06-07 21:02:03 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/* one level up ........ r46720 | ronald.oussoren | 2006-06-07 21:06:01 +0200 (Wed, 07 Jun 2006) | 2 lines And the last bit: move IDLE one level up and adjust makefiles ........ r46723 | ronald.oussoren | 2006-06-07 21:38:53 +0200 (Wed, 07 Jun 2006) | 4 lines - Patch the correct version of python in the Info.plists at build time, instead of relying on a maintainer to update them before releases. - Remove the now empty Mac/OSX directory ........ r46727 | ronald.oussoren | 2006-06-07 22:18:44 +0200 (Wed, 07 Jun 2006) | 7 lines * If BuildApplet.py is used as an applet it starts with a version of sys.exutable that isn't usuable on an #!-line. That results in generated applets that don't actually work. Work around this problem by resetting sys.executable. * argvemulator.py didn't work on intel macs. This patch fixes this (bug #1491468) ........ r46728 | tim.peters | 2006-06-07 22:40:06 +0200 (Wed, 07 Jun 2006) | 2 lines Whitespace normalization. ........ r46729 | tim.peters | 2006-06-07 22:40:54 +0200 (Wed, 07 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46730 | thomas.heller | 2006-06-07 22:43:06 +0200 (Wed, 07 Jun 2006) | 7 lines Fix for foreign functions returning small structures on 64-bit big endian machines. Should fix the remaininf failure in the PPC64 Debian buildbot. Thanks to Matthias Klose for providing access to a machine to debug and test this. ........ r46731 | brett.cannon | 2006-06-07 23:48:17 +0200 (Wed, 07 Jun 2006) | 2 lines Clarify documentation for bf_getcharbuffer. ........ r46735 | neal.norwitz | 2006-06-08 07:12:45 +0200 (Thu, 08 Jun 2006) | 1 line Fix a refleak in recvfrom_into ........ r46736 | gregory.p.smith | 2006-06-08 07:17:08 +0200 (Thu, 08 Jun 2006) | 9 lines - bsddb: the bsddb.dbtables Modify method now raises the proper error and aborts the db transaction safely when a modifier callback fails. Fixes SF python patch/bug #1408584. Also cleans up the bsddb.dbtables docstrings since thats the only documentation that exists for that unadvertised module. (people really should really just use sqlite3) ........ r46737 | gregory.p.smith | 2006-06-08 07:38:11 +0200 (Thu, 08 Jun 2006) | 4 lines * Turn the deadlock situation described in SF bug #775414 into a DBDeadLockError exception. * add the test case for my previous dbtables commit. ........ r46738 | gregory.p.smith | 2006-06-08 07:39:54 +0200 (Thu, 08 Jun 2006) | 2 lines pasted set_lk_detect line in wrong spot in previous commit. fixed. passes tests this time. ........ r46739 | armin.rigo | 2006-06-08 12:56:24 +0200 (Thu, 08 Jun 2006) | 6 lines (arre, arigo) SF bug #1350060 Give a consistent behavior for comparison and hashing of method objects (both user- and built-in methods). Now compares the 'self' recursively. The hash was already asking for the hash of 'self'. ........ r46740 | andrew.kuchling | 2006-06-08 13:56:44 +0200 (Thu, 08 Jun 2006) | 1 line Typo fix ........ r46741 | georg.brandl | 2006-06-08 14:45:01 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. ........ r46743 | georg.brandl | 2006-06-08 14:54:13 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502728: Correctly link against librt library on HP-UX. ........ r46745 | georg.brandl | 2006-06-08 14:55:47 +0200 (Thu, 08 Jun 2006) | 3 lines Add news for recent bugfix. ........ r46746 | georg.brandl | 2006-06-08 15:31:07 +0200 (Thu, 08 Jun 2006) | 4 lines Argh. "integer" is a very confusing word ;) Actually, checking for INT_MAX and INT_MIN is correct since the format code explicitly handles a C "int". ........ r46748 | nick.coghlan | 2006-06-08 15:54:49 +0200 (Thu, 08 Jun 2006) | 1 line Add functools.update_wrapper() and functools.wraps() as described in PEP 356 ........ r46751 | georg.brandl | 2006-06-08 16:50:21 +0200 (Thu, 08 Jun 2006) | 4 lines Bug #1502805: don't alias file.__exit__ to file.close since the latter can return something that's true. ........ r46752 | georg.brandl | 2006-06-08 16:50:53 +0200 (Thu, 08 Jun 2006) | 3 lines Convert test_file to unittest. ........
20 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
Merged revisions 70578,70599,70641-70642,70650,70660-70661,70674,70691,70697-70698,70700,70704 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r70578 | benjamin.peterson | 2009-03-23 22:24:56 -0500 (Mon, 23 Mar 2009) | 1 line this is better written using assertRaises ........ r70599 | benjamin.peterson | 2009-03-25 16:42:51 -0500 (Wed, 25 Mar 2009) | 1 line this can be slightly less ugly ........ r70641 | guilherme.polo | 2009-03-27 16:43:08 -0500 (Fri, 27 Mar 2009) | 3 lines Adjusted _tkinter to compile without warnings when WITH_THREAD is not defined (part of issue #5035) ........ r70642 | georg.brandl | 2009-03-27 19:48:48 -0500 (Fri, 27 Mar 2009) | 1 line Fix typo. ........ r70650 | benjamin.peterson | 2009-03-28 14:16:10 -0500 (Sat, 28 Mar 2009) | 1 line give os.symlink and os.link() better parameter names #5564 ........ r70660 | georg.brandl | 2009-03-28 14:52:58 -0500 (Sat, 28 Mar 2009) | 1 line Switch to fixed Sphinx version. ........ r70661 | georg.brandl | 2009-03-28 14:57:36 -0500 (Sat, 28 Mar 2009) | 2 lines Add section numbering to some of the larger subdocuments. ........ r70674 | guilherme.polo | 2009-03-29 05:19:05 -0500 (Sun, 29 Mar 2009) | 1 line Typo fix. ........ r70691 | raymond.hettinger | 2009-03-29 13:51:11 -0500 (Sun, 29 Mar 2009) | 1 line Make life easier for non-CPython implementations. ........ r70697 | benjamin.peterson | 2009-03-29 16:22:35 -0500 (Sun, 29 Mar 2009) | 1 line this has been fixed since 2.6 (I love removing these) ........ r70698 | benjamin.peterson | 2009-03-29 16:31:05 -0500 (Sun, 29 Mar 2009) | 1 line thanks to guido's bytecode verifier, this is fixed ........ r70700 | benjamin.peterson | 2009-03-29 16:50:14 -0500 (Sun, 29 Mar 2009) | 1 line use the awesome new status iterator ........ r70704 | benjamin.peterson | 2009-03-29 21:49:32 -0500 (Sun, 29 Mar 2009) | 1 line there's actually three methods here #5600 ........
17 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
Merge the rest of the trunk. Merged revisions 46490-46494,46496,46498,46500,46506,46521,46538,46558,46563-46567,46570-46571,46583,46593,46595-46598,46604,46606,46609-46753 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r46610 | martin.v.loewis | 2006-06-03 09:42:26 +0200 (Sat, 03 Jun 2006) | 2 lines Updated version (win32-icons2.zip) from #1490384. ........ r46612 | andrew.kuchling | 2006-06-03 20:09:41 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1472084] Fix description of do_tag ........ r46614 | andrew.kuchling | 2006-06-03 20:33:35 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1475554] Strengthen text to say 'must' instead of 'should' ........ r46616 | andrew.kuchling | 2006-06-03 20:41:28 +0200 (Sat, 03 Jun 2006) | 1 line [Bug #1441864] Clarify description of 'data' argument ........ r46617 | andrew.kuchling | 2006-06-03 20:43:24 +0200 (Sat, 03 Jun 2006) | 1 line Minor rewording ........ r46619 | andrew.kuchling | 2006-06-03 21:02:35 +0200 (Sat, 03 Jun 2006) | 9 lines [Bug #1497414] _self is a reserved word in the WATCOM 10.6 C compiler. Fix by renaming the variable. In a different module, Neal fixed it by renaming _self to self. There's already a variable named 'self' here, so I used selfptr. (I'm committing this on a Mac without Tk, but it's a simple search-and-replace. <crosses fingers>, so I'll watch the buildbots and see what happens.) ........ r46621 | fredrik.lundh | 2006-06-03 23:56:05 +0200 (Sat, 03 Jun 2006) | 5 lines "_self" is a said to be a reserved word in Watcom C 10.6. I'm not sure that's really standard compliant behaviour, but I guess we have to fix that anyway... ........ r46622 | andrew.kuchling | 2006-06-04 00:44:42 +0200 (Sun, 04 Jun 2006) | 1 line Update readme ........ r46623 | andrew.kuchling | 2006-06-04 00:59:23 +0200 (Sun, 04 Jun 2006) | 1 line Drop 0 parameter ........ r46624 | andrew.kuchling | 2006-06-04 00:59:59 +0200 (Sun, 04 Jun 2006) | 1 line Some code tidying; use curses.wrapper ........ r46625 | andrew.kuchling | 2006-06-04 01:02:15 +0200 (Sun, 04 Jun 2006) | 1 line Use True; value returned from main is unused ........ r46626 | andrew.kuchling | 2006-06-04 01:07:21 +0200 (Sun, 04 Jun 2006) | 1 line Use true division, and the True value ........ r46627 | andrew.kuchling | 2006-06-04 01:09:58 +0200 (Sun, 04 Jun 2006) | 1 line Docstring fix; use True ........ r46628 | andrew.kuchling | 2006-06-04 01:15:56 +0200 (Sun, 04 Jun 2006) | 1 line Put code in a main() function; loosen up the spacing to match current code style ........ r46629 | andrew.kuchling | 2006-06-04 01:39:07 +0200 (Sun, 04 Jun 2006) | 1 line Use functions; modernize code ........ r46630 | andrew.kuchling | 2006-06-04 01:43:22 +0200 (Sun, 04 Jun 2006) | 1 line This demo requires Medusa (not just asyncore); remove it ........ r46631 | andrew.kuchling | 2006-06-04 01:46:36 +0200 (Sun, 04 Jun 2006) | 2 lines Remove xmlrpc demo -- it duplicates the SimpleXMLRPCServer module. ........ r46632 | andrew.kuchling | 2006-06-04 01:47:22 +0200 (Sun, 04 Jun 2006) | 1 line Remove xmlrpc/ directory ........ r46633 | andrew.kuchling | 2006-06-04 01:51:21 +0200 (Sun, 04 Jun 2006) | 1 line Remove dangling reference ........ r46634 | andrew.kuchling | 2006-06-04 01:59:36 +0200 (Sun, 04 Jun 2006) | 1 line Add more whitespace; use a better socket name ........ r46635 | tim.peters | 2006-06-04 03:22:53 +0200 (Sun, 04 Jun 2006) | 2 lines Whitespace normalization. ........ r46637 | tim.peters | 2006-06-04 05:26:02 +0200 (Sun, 04 Jun 2006) | 16 lines In a PYMALLOC_DEBUG build obmalloc adds extra debugging info to each allocated block. This was using 4 bytes for each such piece of info regardless of platform. This didn't really matter before (proof: no bug reports, and the debug-build obmalloc would have assert-failed if it was ever asked for a chunk of memory >= 2**32 bytes), since container indices were plain ints. But after the Py_ssize_t changes, it's at least theoretically possible to allocate a list or string whose guts exceed 2**32 bytes, and the PYMALLOC_DEBUG routines would fail then (having only 4 bytes to record the originally requested size). Now we use sizeof(size_t) bytes for each of a PYMALLOC_DEBUG build's extra debugging fields. This won't make any difference on 32-bit boxes, but will add 16 bytes to each allocation in a debug build on a 64-bit box. ........ r46638 | tim.peters | 2006-06-04 05:38:04 +0200 (Sun, 04 Jun 2006) | 4 lines _PyObject_DebugMalloc(): The return value should add 2*sizeof(size_t) now, not 8. This probably accounts for current disasters on the 64-bit buildbot slaves. ........ r46639 | neal.norwitz | 2006-06-04 08:19:31 +0200 (Sun, 04 Jun 2006) | 1 line SF #1499797, Fix for memory leak in WindowsError_str ........ r46640 | andrew.macintyre | 2006-06-04 14:31:09 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1454481: Make thread stack size runtime tunable. ........ r46641 | andrew.macintyre | 2006-06-04 14:59:59 +0200 (Sun, 04 Jun 2006) | 2 lines clean up function declarations to conform to PEP-7 style. ........ r46642 | martin.blais | 2006-06-04 15:49:49 +0200 (Sun, 04 Jun 2006) | 15 lines Fixes in struct and socket from merge reviews. - Following Guido's comments, renamed * pack_to -> pack_into * recv_buf -> recv_into * recvfrom_buf -> recvfrom_into - Made fixes to _struct.c according to Neal Norwitz comments on the checkins list. - Converted some ints into the appropriate -- I hope -- ssize_t and size_t. ........ r46643 | ronald.oussoren | 2006-06-04 16:05:28 +0200 (Sun, 04 Jun 2006) | 3 lines "Import" LDFLAGS in Mac/OSX/Makefile.in to ensure pythonw gets build with the right compiler flags. ........ r46644 | ronald.oussoren | 2006-06-04 16:24:59 +0200 (Sun, 04 Jun 2006) | 2 lines Drop Mac wrappers for the WASTE library. ........ r46645 | tim.peters | 2006-06-04 17:49:07 +0200 (Sun, 04 Jun 2006) | 3 lines s_methods[]: Stop compiler warnings by casting s_unpack_from to PyCFunction. ........ r46646 | george.yoshida | 2006-06-04 19:04:12 +0200 (Sun, 04 Jun 2006) | 2 lines Remove a redundant word ........ r46647 | george.yoshida | 2006-06-04 19:17:25 +0200 (Sun, 04 Jun 2006) | 2 lines Markup fix ........ r46648 | martin.v.loewis | 2006-06-04 21:36:28 +0200 (Sun, 04 Jun 2006) | 2 lines Patch #1359618: Speed-up charmap encoder. ........ r46649 | georg.brandl | 2006-06-04 23:46:16 +0200 (Sun, 04 Jun 2006) | 3 lines Repair refleaks in unicodeobject. ........ r46650 | georg.brandl | 2006-06-04 23:56:52 +0200 (Sun, 04 Jun 2006) | 4 lines Patch #1346214: correctly optimize away "if 0"-style stmts (thanks to Neal for review) ........ r46651 | georg.brandl | 2006-06-05 00:15:37 +0200 (Mon, 05 Jun 2006) | 2 lines Bug #1500293: fix memory leaks in _subprocess module. ........ r46654 | tim.peters | 2006-06-05 01:43:53 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46655 | tim.peters | 2006-06-05 01:52:47 +0200 (Mon, 05 Jun 2006) | 16 lines Revert revisions: 46640 Patch #1454481: Make thread stack size runtime tunable. 46647 Markup fix The first is causing many buildbots to fail test runs, and there are multiple causes with seemingly no immediate prospects for repairing them. See python-dev discussion. Note that a branch can (and should) be created for resolving these problems, like svn copy svn+ssh://svn.python.org/python/trunk -r46640 svn+ssh://svn.python.org/python/branches/NEW_BRANCH followed by merging rev 46647 to the new branch. ........ r46656 | andrew.kuchling | 2006-06-05 02:08:09 +0200 (Mon, 05 Jun 2006) | 1 line Mention second encoding speedup ........ r46657 | gregory.p.smith | 2006-06-05 02:31:01 +0200 (Mon, 05 Jun 2006) | 7 lines bugfix: when log_archive was called with the DB_ARCH_REMOVE flag present in BerkeleyDB >= 4.2 it tried to construct a list out of an uninitialized char **log_list. feature: export the DB_ARCH_REMOVE flag by name in the module on BerkeleyDB >= 4.2. ........ r46658 | gregory.p.smith | 2006-06-05 02:33:35 +0200 (Mon, 05 Jun 2006) | 5 lines fix a bug in the previous commit. don't leak empty list on error return and fix the additional rare (out of memory only) bug that it was supposed to fix of not freeing log_list when the python allocator failed. ........ r46660 | tim.peters | 2006-06-05 02:55:26 +0200 (Mon, 05 Jun 2006) | 9 lines "Flat is better than nested." Move the long-winded, multiply-nested -R support out of runtest() and into some module-level helper functions. This makes runtest() and the -R code easier to follow. That in turn allowed seeing some opportunities for code simplification, and made it obvious that reglog.txt never got closed. ........ r46661 | hyeshik.chang | 2006-06-05 02:59:54 +0200 (Mon, 05 Jun 2006) | 3 lines Fix a potentially invalid memory access of CJKCodecs' shift-jis decoder. (found by Neal Norwitz) ........ r46663 | gregory.p.smith | 2006-06-05 03:39:52 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.log_stat() method on BerkeleyDB >= 4.0 [patch #1494885] ........ r46664 | tim.peters | 2006-06-05 03:43:03 +0200 (Mon, 05 Jun 2006) | 3 lines Remove doctest.testmod's deprecated (in 2.4) `isprivate` argument. A lot of hair went into supporting that! ........ r46665 | tim.peters | 2006-06-05 03:47:24 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46666 | tim.peters | 2006-06-05 03:48:21 +0200 (Mon, 05 Jun 2006) | 2 lines Make doctest news more accurate. ........ r46667 | gregory.p.smith | 2006-06-05 03:56:15 +0200 (Mon, 05 Jun 2006) | 3 lines * support DBEnv.lsn_reset() method on BerkeleyDB >= 4.4 [patch #1494902] ........ r46668 | gregory.p.smith | 2006-06-05 04:02:25 +0200 (Mon, 05 Jun 2006) | 3 lines mention the just committed bsddb changes ........ r46671 | gregory.p.smith | 2006-06-05 19:38:04 +0200 (Mon, 05 Jun 2006) | 3 lines * add support for DBSequence objects [patch #1466734] ........ r46672 | gregory.p.smith | 2006-06-05 20:20:07 +0200 (Mon, 05 Jun 2006) | 3 lines forgot to add this file in previous commit ........ r46673 | tim.peters | 2006-06-05 20:36:12 +0200 (Mon, 05 Jun 2006) | 2 lines Whitespace normalization. ........ r46674 | tim.peters | 2006-06-05 20:36:54 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46675 | gregory.p.smith | 2006-06-05 20:48:21 +0200 (Mon, 05 Jun 2006) | 4 lines * fix DBCursor.pget() bug with keyword argument names when no data= is supplied [SF pybsddb bug #1477863] ........ r46676 | andrew.kuchling | 2006-06-05 21:05:32 +0200 (Mon, 05 Jun 2006) | 1 line Remove use of Trove name, which isn't very helpful to users ........ r46677 | andrew.kuchling | 2006-06-05 21:08:25 +0200 (Mon, 05 Jun 2006) | 1 line [Bug #1470026] Include link to list of classifiers ........ r46679 | tim.peters | 2006-06-05 22:48:49 +0200 (Mon, 05 Jun 2006) | 10 lines Access _struct attributes directly instead of mucking with getattr. string_reverse(): Simplify. assertRaises(): Raise TestFailed on failure. test_unpack_from(), test_pack_into(), test_pack_into_fn(): never use `assert` to test for an expected result (it doesn't test anything when Python is run with -O). ........ r46680 | tim.peters | 2006-06-05 22:49:27 +0200 (Mon, 05 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46681 | gregory.p.smith | 2006-06-06 01:38:06 +0200 (Tue, 06 Jun 2006) | 3 lines add depends = ['md5.h'] to the _md5 module extension for correctness sake. ........ r46682 | brett.cannon | 2006-06-06 01:51:55 +0200 (Tue, 06 Jun 2006) | 4 lines Add 3 more bytes to a buffer to cover constants in string and null byte on top of 10 possible digits for an int. Closes bug #1501223. ........ r46684 | gregory.p.smith | 2006-06-06 01:59:37 +0200 (Tue, 06 Jun 2006) | 5 lines - bsddb: the __len__ method of a DB object has been fixed to return correct results. It could previously incorrectly return 0 in some cases. Fixes SF bug 1493322 (pybsddb bug 1184012). ........ r46686 | tim.peters | 2006-06-06 02:25:07 +0200 (Tue, 06 Jun 2006) | 7 lines _PySys_Init(): It's rarely a good idea to size a buffer to the exact maximum size someone guesses is needed. In this case, if we're really worried about extreme integers, then "cp%d" can actually need 14 bytes (2 for "cp" + 1 for \0 at the end + 11 for -(2**31-1)). So reserve 128 bytes instead -- nothing is actually saved by making a stack-local buffer tiny. ........ r46687 | neal.norwitz | 2006-06-06 09:22:08 +0200 (Tue, 06 Jun 2006) | 1 line Remove unused variable (and stop compiler warning) ........ r46688 | neal.norwitz | 2006-06-06 09:23:01 +0200 (Tue, 06 Jun 2006) | 1 line Fix a bunch of parameter strings ........ r46689 | thomas.heller | 2006-06-06 13:34:33 +0200 (Tue, 06 Jun 2006) | 6 lines Convert CFieldObject tp_members to tp_getset, since there is no structmember typecode for Py_ssize_t fields. This should fix some of the errors on the PPC64 debian machine (64-bit, big endian). Assigning to readonly fields now raises AttributeError instead of TypeError, so the testcase has to be changed as well. ........ r46690 | thomas.heller | 2006-06-06 13:54:32 +0200 (Tue, 06 Jun 2006) | 1 line Damn - the sentinel was missing. And fix another silly mistake. ........ r46691 | martin.blais | 2006-06-06 14:46:55 +0200 (Tue, 06 Jun 2006) | 13 lines Normalized a few cases of whitespace in function declarations. Found them using:: find . -name '*.py' | while read i ; do grep 'def[^(]*( ' $i /dev/null ; done find . -name '*.py' | while read i ; do grep ' ):' $i /dev/null ; done (I was doing this all over my own code anyway, because I'd been using spaces in all defs, so I thought I'd make a run on the Python code as well. If you need to do such fixes in your own code, you can use xx-rename or parenregu.el within emacs.) ........ r46693 | thomas.heller | 2006-06-06 17:34:18 +0200 (Tue, 06 Jun 2006) | 1 line Specify argtypes for all test functions. Maybe that helps on strange ;-) architectures ........ r46694 | tim.peters | 2006-06-06 17:50:17 +0200 (Tue, 06 Jun 2006) | 5 lines BSequence_set_range(): Rev 46688 ("Fix a bunch of parameter strings") changed this function's signature seemingly by mistake, which is causing buildbots to fail test_bsddb3. Restored the pre-46688 signature. ........ r46695 | tim.peters | 2006-06-06 17:52:35 +0200 (Tue, 06 Jun 2006) | 4 lines On python-dev Thomas Heller said these were committed by mistake in rev 46693, so reverting this part of rev 46693. ........ r46696 | andrew.kuchling | 2006-06-06 19:10:41 +0200 (Tue, 06 Jun 2006) | 1 line Fix comment typo ........ r46697 | brett.cannon | 2006-06-06 20:08:16 +0200 (Tue, 06 Jun 2006) | 2 lines Fix coding style guide bug. ........ r46698 | thomas.heller | 2006-06-06 20:50:46 +0200 (Tue, 06 Jun 2006) | 2 lines Add a hack so that foreign functions returning float now do work on 64-bit big endian platforms. ........ r46699 | thomas.heller | 2006-06-06 21:25:13 +0200 (Tue, 06 Jun 2006) | 3 lines Use the same big-endian hack as in _ctypes/callproc.c for callback functions. This fixes the callback function tests that return float. ........ r46700 | ronald.oussoren | 2006-06-06 21:50:24 +0200 (Tue, 06 Jun 2006) | 5 lines * Ensure that "make altinstall" works when the tree was configured with --enable-framework * Also for --enable-framework: allow users to use --prefix to specify the location of the compatibility symlinks (such as /usr/local/bin/python) ........ r46701 | ronald.oussoren | 2006-06-06 21:56:00 +0200 (Tue, 06 Jun 2006) | 3 lines A quick hack to ensure the right key-bindings for IDLE on osx: install patched configuration files during a framework install. ........ r46702 | tim.peters | 2006-06-07 03:04:59 +0200 (Wed, 07 Jun 2006) | 4 lines dash_R_cleanup(): Clear filecmp._cache. This accounts for different results across -R runs (at least on Windows) of test_filecmp. ........ r46705 | tim.peters | 2006-06-07 08:57:51 +0200 (Wed, 07 Jun 2006) | 17 lines SF patch 1501987: Remove randomness from test_exceptions, from ?iga Seilnacht (sorry about the name, but Firefox on my box can't display the first character of the name -- the SF "Unix name" is zseil). This appears to cure the oddball intermittent leaks across runs when running test_exceptions under -R. I'm not sure why, but I'm too sleepy to care ;-) The thrust of the SF patch was to remove randomness in the pickle protocol used. I changed the patch to use range(pickle.HIGHEST_PROTOCOL + 1), to try both pickle and cPickle, and randomly mucked with other test lines to put statements on their own lines. Not a bugfix candidate (this is fiddling new-in-2.5 code). ........ r46706 | andrew.kuchling | 2006-06-07 15:55:33 +0200 (Wed, 07 Jun 2006) | 1 line Add an SQLite introduction, taken from the 'What's New' text ........ r46708 | andrew.kuchling | 2006-06-07 19:02:52 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46709 | andrew.kuchling | 2006-06-07 19:03:46 +0200 (Wed, 07 Jun 2006) | 1 line Add an item; also, escape % ........ r46710 | andrew.kuchling | 2006-06-07 19:04:01 +0200 (Wed, 07 Jun 2006) | 1 line Mention other placeholders ........ r46716 | ronald.oussoren | 2006-06-07 20:57:44 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/Tools one level up ........ r46717 | ronald.oussoren | 2006-06-07 20:58:01 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/PythonLauncher one level up ........ r46718 | ronald.oussoren | 2006-06-07 20:58:42 +0200 (Wed, 07 Jun 2006) | 2 lines mv Mac/OSX/BuildScript one level up ........ r46719 | ronald.oussoren | 2006-06-07 21:02:03 +0200 (Wed, 07 Jun 2006) | 2 lines Move Mac/OSX/* one level up ........ r46720 | ronald.oussoren | 2006-06-07 21:06:01 +0200 (Wed, 07 Jun 2006) | 2 lines And the last bit: move IDLE one level up and adjust makefiles ........ r46723 | ronald.oussoren | 2006-06-07 21:38:53 +0200 (Wed, 07 Jun 2006) | 4 lines - Patch the correct version of python in the Info.plists at build time, instead of relying on a maintainer to update them before releases. - Remove the now empty Mac/OSX directory ........ r46727 | ronald.oussoren | 2006-06-07 22:18:44 +0200 (Wed, 07 Jun 2006) | 7 lines * If BuildApplet.py is used as an applet it starts with a version of sys.exutable that isn't usuable on an #!-line. That results in generated applets that don't actually work. Work around this problem by resetting sys.executable. * argvemulator.py didn't work on intel macs. This patch fixes this (bug #1491468) ........ r46728 | tim.peters | 2006-06-07 22:40:06 +0200 (Wed, 07 Jun 2006) | 2 lines Whitespace normalization. ........ r46729 | tim.peters | 2006-06-07 22:40:54 +0200 (Wed, 07 Jun 2006) | 2 lines Add missing svn:eol-style property to text files. ........ r46730 | thomas.heller | 2006-06-07 22:43:06 +0200 (Wed, 07 Jun 2006) | 7 lines Fix for foreign functions returning small structures on 64-bit big endian machines. Should fix the remaininf failure in the PPC64 Debian buildbot. Thanks to Matthias Klose for providing access to a machine to debug and test this. ........ r46731 | brett.cannon | 2006-06-07 23:48:17 +0200 (Wed, 07 Jun 2006) | 2 lines Clarify documentation for bf_getcharbuffer. ........ r46735 | neal.norwitz | 2006-06-08 07:12:45 +0200 (Thu, 08 Jun 2006) | 1 line Fix a refleak in recvfrom_into ........ r46736 | gregory.p.smith | 2006-06-08 07:17:08 +0200 (Thu, 08 Jun 2006) | 9 lines - bsddb: the bsddb.dbtables Modify method now raises the proper error and aborts the db transaction safely when a modifier callback fails. Fixes SF python patch/bug #1408584. Also cleans up the bsddb.dbtables docstrings since thats the only documentation that exists for that unadvertised module. (people really should really just use sqlite3) ........ r46737 | gregory.p.smith | 2006-06-08 07:38:11 +0200 (Thu, 08 Jun 2006) | 4 lines * Turn the deadlock situation described in SF bug #775414 into a DBDeadLockError exception. * add the test case for my previous dbtables commit. ........ r46738 | gregory.p.smith | 2006-06-08 07:39:54 +0200 (Thu, 08 Jun 2006) | 2 lines pasted set_lk_detect line in wrong spot in previous commit. fixed. passes tests this time. ........ r46739 | armin.rigo | 2006-06-08 12:56:24 +0200 (Thu, 08 Jun 2006) | 6 lines (arre, arigo) SF bug #1350060 Give a consistent behavior for comparison and hashing of method objects (both user- and built-in methods). Now compares the 'self' recursively. The hash was already asking for the hash of 'self'. ........ r46740 | andrew.kuchling | 2006-06-08 13:56:44 +0200 (Thu, 08 Jun 2006) | 1 line Typo fix ........ r46741 | georg.brandl | 2006-06-08 14:45:01 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502750: Fix getargs "i" format to use LONG_MIN and LONG_MAX for bounds checking. ........ r46743 | georg.brandl | 2006-06-08 14:54:13 +0200 (Thu, 08 Jun 2006) | 2 lines Bug #1502728: Correctly link against librt library on HP-UX. ........ r46745 | georg.brandl | 2006-06-08 14:55:47 +0200 (Thu, 08 Jun 2006) | 3 lines Add news for recent bugfix. ........ r46746 | georg.brandl | 2006-06-08 15:31:07 +0200 (Thu, 08 Jun 2006) | 4 lines Argh. "integer" is a very confusing word ;) Actually, checking for INT_MAX and INT_MIN is correct since the format code explicitly handles a C "int". ........ r46748 | nick.coghlan | 2006-06-08 15:54:49 +0200 (Thu, 08 Jun 2006) | 1 line Add functools.update_wrapper() and functools.wraps() as described in PEP 356 ........ r46751 | georg.brandl | 2006-06-08 16:50:21 +0200 (Thu, 08 Jun 2006) | 4 lines Bug #1502805: don't alias file.__exit__ to file.close since the latter can return something that's true. ........ r46752 | georg.brandl | 2006-06-08 16:50:53 +0200 (Thu, 08 Jun 2006) | 3 lines Convert test_file to unittest. ........
20 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
32 years ago
  1. /***********************************************************
  2. Copyright (C) 1994 Steen Lumholt.
  3. All Rights Reserved
  4. ******************************************************************/
  5. /* _tkinter.c -- Interface to libtk.a and libtcl.a. */
  6. /* TCL/TK VERSION INFO:
  7. Only Tcl/Tk 8.3.1 and later are supported. Older versions are not
  8. supported. Use Python 2.6 or older if you cannot upgrade your
  9. Tcl/Tk libraries.
  10. */
  11. /* XXX Further speed-up ideas, involving Tcl 8.0 features:
  12. - Register a new Tcl type, "Python callable", which can be called more
  13. efficiently and passed to Tcl_EvalObj() directly (if this is possible).
  14. */
  15. #include "Python.h"
  16. #include <ctype.h>
  17. #ifdef WITH_THREAD
  18. #include "pythread.h"
  19. #endif
  20. #ifdef MS_WINDOWS
  21. #include <windows.h>
  22. #endif
  23. /* Allow using this code in Python 2.[12] */
  24. #ifndef PyDoc_STRVAR
  25. #define PyDoc_STRVAR(name,str) static char name[] = str
  26. #endif
  27. #ifndef PyMODINIT_FUNC
  28. #define PyMODINIT_FUNC void
  29. #endif
  30. #ifndef PyBool_Check
  31. #define PyBool_Check(o) 0
  32. #define PyBool_FromLong PyLong_FromLong
  33. #endif
  34. /* Starting with Tcl 8.4, many APIs offer const-correctness. Unfortunately,
  35. making _tkinter correct for this API means to break earlier
  36. versions. USE_COMPAT_CONST allows to make _tkinter work with both 8.4 and
  37. earlier versions. Once Tcl releases before 8.4 don't need to be supported
  38. anymore, this should go. */
  39. #define USE_COMPAT_CONST
  40. /* If Tcl is compiled for threads, we must also define TCL_THREAD. We define
  41. it always; if Tcl is not threaded, the thread functions in
  42. Tcl are empty. */
  43. #define TCL_THREADS
  44. #ifdef TK_FRAMEWORK
  45. #include <Tcl/tcl.h>
  46. #include <Tk/tk.h>
  47. #else
  48. #include <tcl.h>
  49. #include <tk.h>
  50. #endif
  51. #include "tkinter.h"
  52. /* For Tcl 8.2 and 8.3, CONST* is not defined (except on Cygwin). */
  53. #ifndef CONST84_RETURN
  54. #define CONST84_RETURN
  55. #undef CONST
  56. #define CONST
  57. #endif
  58. #if TK_VERSION_HEX < 0x08030102
  59. #error "Tk older than 8.3.1 not supported"
  60. #endif
  61. /* Unicode conversion assumes that Tcl_UniChar is two bytes.
  62. We cannot test this directly, so we test UTF-8 size instead,
  63. expecting that TCL_UTF_MAX is changed if Tcl ever supports
  64. either UTF-16 or UCS-4.
  65. Redhat 8 sets TCL_UTF_MAX to 6, and uses wchar_t for
  66. Tcl_Unichar. This is also ok as long as Python uses UCS-4,
  67. as well.
  68. */
  69. #if TCL_UTF_MAX != 3 && !(defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==6)
  70. #error "unsupported Tcl configuration"
  71. #endif
  72. #if !(defined(MS_WINDOWS) || defined(__CYGWIN__))
  73. #define HAVE_CREATEFILEHANDLER
  74. #endif
  75. #ifdef HAVE_CREATEFILEHANDLER
  76. /* This bit is to ensure that TCL_UNIX_FD is defined and doesn't interfere
  77. with the proper calculation of FHANDLETYPE == TCL_UNIX_FD below. */
  78. #ifndef TCL_UNIX_FD
  79. # ifdef TCL_WIN_SOCKET
  80. # define TCL_UNIX_FD (! TCL_WIN_SOCKET)
  81. # else
  82. # define TCL_UNIX_FD 1
  83. # endif
  84. #endif
  85. /* Tcl_CreateFileHandler() changed several times; these macros deal with the
  86. messiness. In Tcl 8.0 and later, it is not available on Windows (and on
  87. Unix, only because Jack added it back); when available on Windows, it only
  88. applies to sockets. */
  89. #ifdef MS_WINDOWS
  90. #define FHANDLETYPE TCL_WIN_SOCKET
  91. #else
  92. #define FHANDLETYPE TCL_UNIX_FD
  93. #endif
  94. /* If Tcl can wait for a Unix file descriptor, define the EventHook() routine
  95. which uses this to handle Tcl events while the user is typing commands. */
  96. #if FHANDLETYPE == TCL_UNIX_FD
  97. #define WAIT_FOR_STDIN
  98. #endif
  99. #endif /* HAVE_CREATEFILEHANDLER */
  100. #ifdef MS_WINDOWS
  101. #include <conio.h>
  102. #define WAIT_FOR_STDIN
  103. #endif
  104. #ifdef WITH_THREAD
  105. /* The threading situation is complicated. Tcl is not thread-safe, except
  106. when configured with --enable-threads.
  107. So we need to use a lock around all uses of Tcl. Previously, the Python
  108. interpreter lock was used for this. However, this causes problems when
  109. other Python threads need to run while Tcl is blocked waiting for events.
  110. To solve this problem, a separate lock for Tcl is introduced. Holding it
  111. is incompatible with holding Python's interpreter lock. The following four
  112. macros manipulate both locks together.
  113. ENTER_TCL and LEAVE_TCL are brackets, just like Py_BEGIN_ALLOW_THREADS and
  114. Py_END_ALLOW_THREADS. They should be used whenever a call into Tcl is made
  115. that could call an event handler, or otherwise affect the state of a Tcl
  116. interpreter. These assume that the surrounding code has the Python
  117. interpreter lock; inside the brackets, the Python interpreter lock has been
  118. released and the lock for Tcl has been acquired.
  119. Sometimes, it is necessary to have both the Python lock and the Tcl lock.
  120. (For example, when transferring data from the Tcl interpreter result to a
  121. Python string object.) This can be done by using different macros to close
  122. the ENTER_TCL block: ENTER_OVERLAP reacquires the Python lock (and restores
  123. the thread state) but doesn't release the Tcl lock; LEAVE_OVERLAP_TCL
  124. releases the Tcl lock.
  125. By contrast, ENTER_PYTHON and LEAVE_PYTHON are used in Tcl event
  126. handlers when the handler needs to use Python. Such event handlers are
  127. entered while the lock for Tcl is held; the event handler presumably needs
  128. to use Python. ENTER_PYTHON releases the lock for Tcl and acquires
  129. the Python interpreter lock, restoring the appropriate thread state, and
  130. LEAVE_PYTHON releases the Python interpreter lock and re-acquires the lock
  131. for Tcl. It is okay for ENTER_TCL/LEAVE_TCL pairs to be contained inside
  132. the code between ENTER_PYTHON and LEAVE_PYTHON.
  133. These locks expand to several statements and brackets; they should not be
  134. used in branches of if statements and the like.
  135. If Tcl is threaded, this approach won't work anymore. The Tcl interpreter is
  136. only valid in the thread that created it, and all Tk activity must happen in this
  137. thread, also. That means that the mainloop must be invoked in the thread that
  138. created the interpreter. Invoking commands from other threads is possible;
  139. _tkinter will queue an event for the interpreter thread, which will then
  140. execute the command and pass back the result. If the main thread is not in the
  141. mainloop, and invoking commands causes an exception; if the main loop is running
  142. but not processing events, the command invocation will block.
  143. In addition, for a threaded Tcl, a single global tcl_tstate won't be sufficient
  144. anymore, since multiple Tcl interpreters may simultaneously dispatch in different
  145. threads. So we use the Tcl TLS API.
  146. */
  147. static PyThread_type_lock tcl_lock = 0;
  148. #ifdef TCL_THREADS
  149. static Tcl_ThreadDataKey state_key;
  150. typedef PyThreadState *ThreadSpecificData;
  151. #define tcl_tstate (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
  152. #else
  153. static PyThreadState *tcl_tstate = NULL;
  154. #endif
  155. #define ENTER_TCL \
  156. { PyThreadState *tstate = PyThreadState_Get(); Py_BEGIN_ALLOW_THREADS \
  157. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
  158. #define LEAVE_TCL \
  159. tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
  160. #define ENTER_OVERLAP \
  161. Py_END_ALLOW_THREADS
  162. #define LEAVE_OVERLAP_TCL \
  163. tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); }
  164. #define ENTER_PYTHON \
  165. { PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \
  166. if(tcl_lock)PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
  167. #define LEAVE_PYTHON \
  168. { PyThreadState *tstate = PyEval_SaveThread(); \
  169. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
  170. #define CHECK_TCL_APPARTMENT \
  171. if (((TkappObject *)self)->threaded && \
  172. ((TkappObject *)self)->thread_id != Tcl_GetCurrentThread()) { \
  173. PyErr_SetString(PyExc_RuntimeError, "Calling Tcl from different appartment"); \
  174. return 0; \
  175. }
  176. #else
  177. #define ENTER_TCL
  178. #define LEAVE_TCL
  179. #define ENTER_OVERLAP
  180. #define LEAVE_OVERLAP_TCL
  181. #define ENTER_PYTHON
  182. #define LEAVE_PYTHON
  183. #define CHECK_TCL_APPARTMENT
  184. #endif
  185. #ifndef FREECAST
  186. #define FREECAST (char *)
  187. #endif
  188. /**** Tkapp Object Declaration ****/
  189. static PyTypeObject Tkapp_Type;
  190. typedef struct {
  191. PyObject_HEAD
  192. Tcl_Interp *interp;
  193. int wantobjects;
  194. int threaded; /* True if tcl_platform[threaded] */
  195. Tcl_ThreadId thread_id;
  196. int dispatching;
  197. /* We cannot include tclInt.h, as this is internal.
  198. So we cache interesting types here. */
  199. Tcl_ObjType *BooleanType;
  200. Tcl_ObjType *ByteArrayType;
  201. Tcl_ObjType *DoubleType;
  202. Tcl_ObjType *IntType;
  203. Tcl_ObjType *ListType;
  204. Tcl_ObjType *ProcBodyType;
  205. Tcl_ObjType *StringType;
  206. } TkappObject;
  207. #define Tkapp_Check(v) (Py_TYPE(v) == &Tkapp_Type)
  208. #define Tkapp_Interp(v) (((TkappObject *) (v))->interp)
  209. #define Tkapp_Result(v) Tcl_GetStringResult(Tkapp_Interp(v))
  210. #define DEBUG_REFCNT(v) (printf("DEBUG: id=%p, refcnt=%i\n", \
  211. (void *) v, Py_REFCNT(v)))
  212. /**** Error Handling ****/
  213. static PyObject *Tkinter_TclError;
  214. static int quitMainLoop = 0;
  215. static int errorInCmd = 0;
  216. static PyObject *excInCmd;
  217. static PyObject *valInCmd;
  218. static PyObject *trbInCmd;
  219. #ifdef TKINTER_PROTECT_LOADTK
  220. static int tk_load_failed = 0;
  221. #endif
  222. static PyObject *
  223. Tkinter_Error(PyObject *v)
  224. {
  225. PyErr_SetString(Tkinter_TclError, Tkapp_Result(v));
  226. return NULL;
  227. }
  228. /**** Utils ****/
  229. static int Tkinter_busywaitinterval = 20;
  230. #ifdef WITH_THREAD
  231. #ifndef MS_WINDOWS
  232. /* Millisecond sleep() for Unix platforms. */
  233. static void
  234. Sleep(int milli)
  235. {
  236. /* XXX Too bad if you don't have select(). */
  237. struct timeval t;
  238. t.tv_sec = milli/1000;
  239. t.tv_usec = (milli%1000) * 1000;
  240. select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t);
  241. }
  242. #endif /* MS_WINDOWS */
  243. /* Wait up to 1s for the mainloop to come up. */
  244. static int
  245. WaitForMainloop(TkappObject* self)
  246. {
  247. int i;
  248. for (i = 0; i < 10; i++) {
  249. if (self->dispatching)
  250. return 1;
  251. Py_BEGIN_ALLOW_THREADS
  252. Sleep(100);
  253. Py_END_ALLOW_THREADS
  254. }
  255. if (self->dispatching)
  256. return 1;
  257. PyErr_SetString(PyExc_RuntimeError, "main thread is not in main loop");
  258. return 0;
  259. }
  260. #endif /* WITH_THREAD */
  261. static char *
  262. AsString(PyObject *value, PyObject *tmp)
  263. {
  264. if (PyBytes_Check(value))
  265. return PyBytes_AsString(value);
  266. else if (PyUnicode_Check(value)) {
  267. PyObject *v = PyUnicode_AsUTF8String(value);
  268. if (v == NULL)
  269. return NULL;
  270. if (PyList_Append(tmp, v) != 0) {
  271. Py_DECREF(v);
  272. return NULL;
  273. }
  274. Py_DECREF(v);
  275. return PyBytes_AsString(v);
  276. }
  277. else {
  278. PyObject *v = PyObject_Str(value);
  279. if (v == NULL)
  280. return NULL;
  281. if (PyList_Append(tmp, v) != 0) {
  282. Py_DECREF(v);
  283. return NULL;
  284. }
  285. Py_DECREF(v);
  286. return PyBytes_AsString(v);
  287. }
  288. }
  289. #define ARGSZ 64
  290. static char *
  291. Merge(PyObject *args)
  292. {
  293. PyObject *tmp = NULL;
  294. char *argvStore[ARGSZ];
  295. char **argv = NULL;
  296. int fvStore[ARGSZ];
  297. int *fv = NULL;
  298. int argc = 0, fvc = 0, i;
  299. char *res = NULL;
  300. if (!(tmp = PyList_New(0)))
  301. return NULL;
  302. argv = argvStore;
  303. fv = fvStore;
  304. if (args == NULL)
  305. argc = 0;
  306. else if (!PyTuple_Check(args)) {
  307. argc = 1;
  308. fv[0] = 0;
  309. if (!(argv[0] = AsString(args, tmp)))
  310. goto finally;
  311. }
  312. else {
  313. argc = PyTuple_Size(args);
  314. if (argc > ARGSZ) {
  315. argv = (char **)ckalloc(argc * sizeof(char *));
  316. fv = (int *)ckalloc(argc * sizeof(int));
  317. if (argv == NULL || fv == NULL) {
  318. PyErr_NoMemory();
  319. goto finally;
  320. }
  321. }
  322. for (i = 0; i < argc; i++) {
  323. PyObject *v = PyTuple_GetItem(args, i);
  324. if (PyTuple_Check(v)) {
  325. fv[i] = 1;
  326. if (!(argv[i] = Merge(v)))
  327. goto finally;
  328. fvc++;
  329. }
  330. else if (v == Py_None) {
  331. argc = i;
  332. break;
  333. }
  334. else {
  335. fv[i] = 0;
  336. if (!(argv[i] = AsString(v, tmp)))
  337. goto finally;
  338. fvc++;
  339. }
  340. }
  341. }
  342. res = Tcl_Merge(argc, argv);
  343. if (res == NULL)
  344. PyErr_SetString(Tkinter_TclError, "merge failed");
  345. finally:
  346. for (i = 0; i < fvc; i++)
  347. if (fv[i]) {
  348. ckfree(argv[i]);
  349. }
  350. if (argv != argvStore)
  351. ckfree(FREECAST argv);
  352. if (fv != fvStore)
  353. ckfree(FREECAST fv);
  354. Py_DECREF(tmp);
  355. return res;
  356. }
  357. static PyObject *
  358. Split(char *list)
  359. {
  360. int argc;
  361. char **argv;
  362. PyObject *v;
  363. if (list == NULL) {
  364. Py_INCREF(Py_None);
  365. return Py_None;
  366. }
  367. if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
  368. /* Not a list.
  369. * Could be a quoted string containing funnies, e.g. {"}.
  370. * Return the string itself.
  371. */
  372. return PyUnicode_FromString(list);
  373. }
  374. if (argc == 0)
  375. v = PyUnicode_FromString("");
  376. else if (argc == 1)
  377. v = PyUnicode_FromString(argv[0]);
  378. else if ((v = PyTuple_New(argc)) != NULL) {
  379. int i;
  380. PyObject *w;
  381. for (i = 0; i < argc; i++) {
  382. if ((w = Split(argv[i])) == NULL) {
  383. Py_DECREF(v);
  384. v = NULL;
  385. break;
  386. }
  387. PyTuple_SetItem(v, i, w);
  388. }
  389. }
  390. Tcl_Free(FREECAST argv);
  391. return v;
  392. }
  393. /* In some cases, Tcl will still return strings that are supposed to be
  394. lists. SplitObj walks through a nested tuple, finding string objects that
  395. need to be split. */
  396. static PyObject *
  397. SplitObj(PyObject *arg)
  398. {
  399. if (PyTuple_Check(arg)) {
  400. int i, size;
  401. PyObject *elem, *newelem, *result;
  402. size = PyTuple_Size(arg);
  403. result = NULL;
  404. /* Recursively invoke SplitObj for all tuple items.
  405. If this does not return a new object, no action is
  406. needed. */
  407. for(i = 0; i < size; i++) {
  408. elem = PyTuple_GetItem(arg, i);
  409. newelem = SplitObj(elem);
  410. if (!newelem) {
  411. Py_XDECREF(result);
  412. return NULL;
  413. }
  414. if (!result) {
  415. int k;
  416. if (newelem == elem) {
  417. Py_DECREF(newelem);
  418. continue;
  419. }
  420. result = PyTuple_New(size);
  421. if (!result)
  422. return NULL;
  423. for(k = 0; k < i; k++) {
  424. elem = PyTuple_GetItem(arg, k);
  425. Py_INCREF(elem);
  426. PyTuple_SetItem(result, k, elem);
  427. }
  428. }
  429. PyTuple_SetItem(result, i, newelem);
  430. }
  431. if (result)
  432. return result;
  433. /* Fall through, returning arg. */
  434. }
  435. else if (PyBytes_Check(arg)) {
  436. int argc;
  437. char **argv;
  438. char *list = PyBytes_AsString(arg);
  439. if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
  440. Py_INCREF(arg);
  441. return arg;
  442. }
  443. Tcl_Free(FREECAST argv);
  444. if (argc > 1)
  445. return Split(PyBytes_AsString(arg));
  446. /* Fall through, returning arg. */
  447. }
  448. Py_INCREF(arg);
  449. return arg;
  450. }
  451. /**** Tkapp Object ****/
  452. #ifndef WITH_APPINIT
  453. int
  454. Tcl_AppInit(Tcl_Interp *interp)
  455. {
  456. const char * _tkinter_skip_tk_init;
  457. if (Tcl_Init(interp) == TCL_ERROR) {
  458. PySys_WriteStderr("Tcl_Init error: %s\n", Tcl_GetStringResult(interp));
  459. return TCL_ERROR;
  460. }
  461. _tkinter_skip_tk_init = Tcl_GetVar(interp,
  462. "_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
  463. if (_tkinter_skip_tk_init != NULL &&
  464. strcmp(_tkinter_skip_tk_init, "1") == 0) {
  465. return TCL_OK;
  466. }
  467. #ifdef TKINTER_PROTECT_LOADTK
  468. if (tk_load_failed) {
  469. PySys_WriteStderr("Tk_Init error: %s\n", TKINTER_LOADTK_ERRMSG);
  470. return TCL_ERROR;
  471. }
  472. #endif
  473. if (Tk_Init(interp) == TCL_ERROR) {
  474. #ifdef TKINTER_PROTECT_LOADTK
  475. tk_load_failed = 1;
  476. #endif
  477. PySys_WriteStderr("Tk_Init error: %s\n", Tcl_GetStringResult(interp));
  478. return TCL_ERROR;
  479. }
  480. return TCL_OK;
  481. }
  482. #endif /* !WITH_APPINIT */
  483. /* Initialize the Tk application; see the `main' function in
  484. * `tkMain.c'.
  485. */
  486. static void EnableEventHook(void); /* Forward */
  487. static void DisableEventHook(void); /* Forward */
  488. static TkappObject *
  489. Tkapp_New(char *screenName, char *className,
  490. int interactive, int wantobjects, int wantTk, int sync, char *use)
  491. {
  492. TkappObject *v;
  493. char *argv0;
  494. v = PyObject_New(TkappObject, &Tkapp_Type);
  495. if (v == NULL)
  496. return NULL;
  497. v->interp = Tcl_CreateInterp();
  498. v->wantobjects = wantobjects;
  499. v->threaded = Tcl_GetVar2Ex(v->interp, "tcl_platform", "threaded",
  500. TCL_GLOBAL_ONLY) != NULL;
  501. v->thread_id = Tcl_GetCurrentThread();
  502. v->dispatching = 0;
  503. #ifndef TCL_THREADS
  504. if (v->threaded) {
  505. PyErr_SetString(PyExc_RuntimeError, "Tcl is threaded but _tkinter is not");
  506. Py_DECREF(v);
  507. return 0;
  508. }
  509. #endif
  510. #ifdef WITH_THREAD
  511. if (v->threaded && tcl_lock) {
  512. /* If Tcl is threaded, we don't need the lock. */
  513. PyThread_free_lock(tcl_lock);
  514. tcl_lock = NULL;
  515. }
  516. #endif
  517. v->BooleanType = Tcl_GetObjType("boolean");
  518. v->ByteArrayType = Tcl_GetObjType("bytearray");
  519. v->DoubleType = Tcl_GetObjType("double");
  520. v->IntType = Tcl_GetObjType("int");
  521. v->ListType = Tcl_GetObjType("list");
  522. v->ProcBodyType = Tcl_GetObjType("procbody");
  523. v->StringType = Tcl_GetObjType("string");
  524. /* Delete the 'exit' command, which can screw things up */
  525. Tcl_DeleteCommand(v->interp, "exit");
  526. if (screenName != NULL)
  527. Tcl_SetVar2(v->interp, "env", "DISPLAY",
  528. screenName, TCL_GLOBAL_ONLY);
  529. if (interactive)
  530. Tcl_SetVar(v->interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
  531. else
  532. Tcl_SetVar(v->interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
  533. /* This is used to get the application class for Tk 4.1 and up */
  534. argv0 = (char*)ckalloc(strlen(className) + 1);
  535. if (!argv0) {
  536. PyErr_NoMemory();
  537. Py_DECREF(v);
  538. return NULL;
  539. }
  540. strcpy(argv0, className);
  541. if (Py_ISUPPER(Py_CHARMASK(argv0[0])))
  542. argv0[0] = Py_TOLOWER(Py_CHARMASK(argv0[0]));
  543. Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
  544. ckfree(argv0);
  545. if (! wantTk) {
  546. Tcl_SetVar(v->interp,
  547. "_tkinter_skip_tk_init", "1", TCL_GLOBAL_ONLY);
  548. }
  549. #ifdef TKINTER_PROTECT_LOADTK
  550. else if (tk_load_failed) {
  551. Tcl_SetVar(v->interp,
  552. "_tkinter_tk_failed", "1", TCL_GLOBAL_ONLY);
  553. }
  554. #endif
  555. /* some initial arguments need to be in argv */
  556. if (sync || use) {
  557. char *args;
  558. int len = 0;
  559. if (sync)
  560. len += sizeof "-sync";
  561. if (use)
  562. len += strlen(use) + sizeof "-use ";
  563. args = (char*)ckalloc(len);
  564. if (!args) {
  565. PyErr_NoMemory();
  566. Py_DECREF(v);
  567. return NULL;
  568. }
  569. args[0] = '\0';
  570. if (sync)
  571. strcat(args, "-sync");
  572. if (use) {
  573. if (sync)
  574. strcat(args, " ");
  575. strcat(args, "-use ");
  576. strcat(args, use);
  577. }
  578. Tcl_SetVar(v->interp, "argv", args, TCL_GLOBAL_ONLY);
  579. ckfree(args);
  580. }
  581. if (Tcl_AppInit(v->interp) != TCL_OK) {
  582. PyObject *result = Tkinter_Error((PyObject *)v);
  583. #ifdef TKINTER_PROTECT_LOADTK
  584. if (wantTk) {
  585. const char *_tkinter_tk_failed;
  586. _tkinter_tk_failed = Tcl_GetVar(v->interp,
  587. "_tkinter_tk_failed", TCL_GLOBAL_ONLY);
  588. if ( _tkinter_tk_failed != NULL &&
  589. strcmp(_tkinter_tk_failed, "1") == 0) {
  590. tk_load_failed = 1;
  591. }
  592. }
  593. #endif
  594. Py_DECREF((PyObject *)v);
  595. return (TkappObject *)result;
  596. }
  597. EnableEventHook();
  598. return v;
  599. }
  600. #ifdef WITH_THREAD
  601. static void
  602. Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev,
  603. Tcl_Condition *cond, Tcl_Mutex *mutex)
  604. {
  605. Py_BEGIN_ALLOW_THREADS;
  606. Tcl_MutexLock(mutex);
  607. Tcl_ThreadQueueEvent(self->thread_id, ev, TCL_QUEUE_TAIL);
  608. Tcl_ThreadAlert(self->thread_id);
  609. Tcl_ConditionWait(cond, mutex, NULL);
  610. Tcl_MutexUnlock(mutex);
  611. Py_END_ALLOW_THREADS
  612. }
  613. #endif
  614. /** Tcl Eval **/
  615. typedef struct {
  616. PyObject_HEAD
  617. Tcl_Obj *value;
  618. PyObject *string; /* This cannot cause cycles. */
  619. } PyTclObject;
  620. static PyTypeObject PyTclObject_Type;
  621. #define PyTclObject_Check(v) ((v)->ob_type == &PyTclObject_Type)
  622. static PyObject *
  623. newPyTclObject(Tcl_Obj *arg)
  624. {
  625. PyTclObject *self;
  626. self = PyObject_New(PyTclObject, &PyTclObject_Type);
  627. if (self == NULL)
  628. return NULL;
  629. Tcl_IncrRefCount(arg);
  630. self->value = arg;
  631. self->string = NULL;
  632. return (PyObject*)self;
  633. }
  634. static void
  635. PyTclObject_dealloc(PyTclObject *self)
  636. {
  637. Tcl_DecrRefCount(self->value);
  638. Py_XDECREF(self->string);
  639. PyObject_Del(self);
  640. }
  641. static char*
  642. PyTclObject_TclString(PyObject *self)
  643. {
  644. return Tcl_GetString(((PyTclObject*)self)->value);
  645. }
  646. /* Like _str, but create Unicode if necessary. */
  647. PyDoc_STRVAR(PyTclObject_string__doc__,
  648. "the string representation of this object, either as str or bytes");
  649. static PyObject *
  650. PyTclObject_string(PyTclObject *self, void *ignored)
  651. {
  652. char *s;
  653. int len;
  654. if (!self->string) {
  655. s = Tcl_GetStringFromObj(self->value, &len);
  656. self->string = PyUnicode_FromStringAndSize(s, len);
  657. if (!self->string)
  658. return NULL;
  659. }
  660. Py_INCREF(self->string);
  661. return self->string;
  662. }
  663. static PyObject *
  664. PyTclObject_str(PyTclObject *self, void *ignored)
  665. {
  666. char *s;
  667. int len;
  668. if (self->string && PyUnicode_Check(self->string)) {
  669. Py_INCREF(self->string);
  670. return self->string;
  671. }
  672. /* XXX Could chache result if it is non-ASCII. */
  673. s = Tcl_GetStringFromObj(self->value, &len);
  674. return PyUnicode_DecodeUTF8(s, len, "strict");
  675. }
  676. static PyObject *
  677. PyTclObject_repr(PyTclObject *self)
  678. {
  679. return PyUnicode_FromFormat("<%s object at %p>",
  680. self->value->typePtr->name, self->value);
  681. }
  682. #define TEST_COND(cond) ((cond) ? Py_True : Py_False)
  683. static PyObject *
  684. PyTclObject_richcompare(PyObject *self, PyObject *other, int op)
  685. {
  686. int result;
  687. PyObject *v;
  688. /* neither argument should be NULL, unless something's gone wrong */
  689. if (self == NULL || other == NULL) {
  690. PyErr_BadInternalCall();
  691. return NULL;
  692. }
  693. /* both arguments should be instances of PyTclObject */
  694. if (!PyTclObject_Check(self) || !PyTclObject_Check(other)) {
  695. v = Py_NotImplemented;
  696. goto finished;
  697. }
  698. if (self == other)
  699. /* fast path when self and other are identical */
  700. result = 0;
  701. else
  702. result = strcmp(Tcl_GetString(((PyTclObject *)self)->value),
  703. Tcl_GetString(((PyTclObject *)other)->value));
  704. /* Convert return value to a Boolean */
  705. switch (op) {
  706. case Py_EQ:
  707. v = TEST_COND(result == 0);
  708. break;
  709. case Py_NE:
  710. v = TEST_COND(result != 0);
  711. break;
  712. case Py_LE:
  713. v = TEST_COND(result <= 0);
  714. break;
  715. case Py_GE:
  716. v = TEST_COND(result >= 0);
  717. break;
  718. case Py_LT:
  719. v = TEST_COND(result < 0);
  720. break;
  721. case Py_GT:
  722. v = TEST_COND(result > 0);
  723. break;
  724. default:
  725. PyErr_BadArgument();
  726. return NULL;
  727. }
  728. finished:
  729. Py_INCREF(v);
  730. return v;
  731. }
  732. PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type");
  733. static PyObject*
  734. get_typename(PyTclObject* obj, void* ignored)
  735. {
  736. return PyUnicode_FromString(obj->value->typePtr->name);
  737. }
  738. static PyGetSetDef PyTclObject_getsetlist[] = {
  739. {"typename", (getter)get_typename, NULL, get_typename__doc__},
  740. {"string", (getter)PyTclObject_string, NULL,
  741. PyTclObject_string__doc__},
  742. {0},
  743. };
  744. static PyTypeObject PyTclObject_Type = {
  745. PyVarObject_HEAD_INIT(NULL, 0)
  746. "_tkinter.Tcl_Obj", /*tp_name*/
  747. sizeof(PyTclObject), /*tp_basicsize*/
  748. 0, /*tp_itemsize*/
  749. /* methods */
  750. (destructor)PyTclObject_dealloc,/*tp_dealloc*/
  751. 0, /*tp_print*/
  752. 0, /*tp_getattr*/
  753. 0, /*tp_setattr*/
  754. 0, /*tp_reserved*/
  755. (reprfunc)PyTclObject_repr, /*tp_repr*/
  756. 0, /*tp_as_number*/
  757. 0, /*tp_as_sequence*/
  758. 0, /*tp_as_mapping*/
  759. 0, /*tp_hash*/
  760. 0, /*tp_call*/
  761. (reprfunc)PyTclObject_str, /*tp_str*/
  762. PyObject_GenericGetAttr, /*tp_getattro*/
  763. 0, /*tp_setattro*/
  764. 0, /*tp_as_buffer*/
  765. Py_TPFLAGS_DEFAULT, /*tp_flags*/
  766. 0, /*tp_doc*/
  767. 0, /*tp_traverse*/
  768. 0, /*tp_clear*/
  769. PyTclObject_richcompare, /*tp_richcompare*/
  770. 0, /*tp_weaklistoffset*/
  771. 0, /*tp_iter*/
  772. 0, /*tp_iternext*/
  773. 0, /*tp_methods*/
  774. 0, /*tp_members*/
  775. PyTclObject_getsetlist, /*tp_getset*/
  776. 0, /*tp_base*/
  777. 0, /*tp_dict*/
  778. 0, /*tp_descr_get*/
  779. 0, /*tp_descr_set*/
  780. 0, /*tp_dictoffset*/
  781. 0, /*tp_init*/
  782. 0, /*tp_alloc*/
  783. 0, /*tp_new*/
  784. 0, /*tp_free*/
  785. 0, /*tp_is_gc*/
  786. };
  787. static Tcl_Obj*
  788. AsObj(PyObject *value)
  789. {
  790. Tcl_Obj *result;
  791. long longVal;
  792. int overflow;
  793. if (PyBytes_Check(value))
  794. return Tcl_NewStringObj(PyBytes_AS_STRING(value),
  795. PyBytes_GET_SIZE(value));
  796. else if (PyBool_Check(value))
  797. return Tcl_NewBooleanObj(PyObject_IsTrue(value));
  798. else if (PyLong_CheckExact(value) &&
  799. ((longVal = PyLong_AsLongAndOverflow(value, &overflow)),
  800. !overflow)) {
  801. /* If there is an overflow in the long conversion,
  802. fall through to default object handling. */
  803. return Tcl_NewLongObj(longVal);
  804. }
  805. else if (PyFloat_Check(value))
  806. return Tcl_NewDoubleObj(PyFloat_AS_DOUBLE(value));
  807. else if (PyTuple_Check(value)) {
  808. Tcl_Obj **argv = (Tcl_Obj**)
  809. ckalloc(PyTuple_Size(value)*sizeof(Tcl_Obj*));
  810. int i;
  811. if(!argv)
  812. return 0;
  813. for(i=0;i<PyTuple_Size(value);i++)
  814. argv[i] = AsObj(PyTuple_GetItem(value,i));
  815. result = Tcl_NewListObj(PyTuple_Size(value), argv);
  816. ckfree(FREECAST argv);
  817. return result;
  818. }
  819. else if (PyUnicode_Check(value)) {
  820. Py_UNICODE *inbuf = PyUnicode_AS_UNICODE(value);
  821. Py_ssize_t size = PyUnicode_GET_SIZE(value);
  822. /* This #ifdef assumes that Tcl uses UCS-2.
  823. See TCL_UTF_MAX test above. */
  824. #if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX == 3
  825. Tcl_UniChar *outbuf = NULL;
  826. Py_ssize_t i;
  827. size_t allocsize = ((size_t)size) * sizeof(Tcl_UniChar);
  828. if (allocsize >= size)
  829. outbuf = (Tcl_UniChar*)ckalloc(allocsize);
  830. /* Else overflow occurred, and we take the next exit */
  831. if (!outbuf) {
  832. PyErr_NoMemory();
  833. return NULL;
  834. }
  835. for (i = 0; i < size; i++) {
  836. if (inbuf[i] >= 0x10000) {
  837. /* Tcl doesn't do UTF-16, yet. */
  838. PyErr_Format(PyExc_ValueError,
  839. "character U+%x is above the range "
  840. "(U+0000-U+FFFF) allowed by Tcl",
  841. inbuf[i]);
  842. ckfree(FREECAST outbuf);
  843. return NULL;
  844. }
  845. outbuf[i] = inbuf[i];
  846. }
  847. result = Tcl_NewUnicodeObj(outbuf, size);
  848. ckfree(FREECAST outbuf);
  849. return result;
  850. #else
  851. return Tcl_NewUnicodeObj(inbuf, size);
  852. #endif
  853. }
  854. else if(PyTclObject_Check(value)) {
  855. Tcl_Obj *v = ((PyTclObject*)value)->value;
  856. Tcl_IncrRefCount(v);
  857. return v;
  858. }
  859. else {
  860. PyObject *v = PyObject_Str(value);
  861. if (!v)
  862. return 0;
  863. result = AsObj(v);
  864. Py_DECREF(v);
  865. return result;
  866. }
  867. }
  868. static PyObject*
  869. FromObj(PyObject* tkapp, Tcl_Obj *value)
  870. {
  871. PyObject *result = NULL;
  872. TkappObject *app = (TkappObject*)tkapp;
  873. if (value->typePtr == NULL) {
  874. return PyUnicode_FromStringAndSize(value->bytes,
  875. value->length);
  876. }
  877. if (value->typePtr == app->BooleanType) {
  878. result = value->internalRep.longValue ? Py_True : Py_False;
  879. Py_INCREF(result);
  880. return result;
  881. }
  882. if (value->typePtr == app->ByteArrayType) {
  883. int size;
  884. char *data = (char*)Tcl_GetByteArrayFromObj(value, &size);
  885. return PyBytes_FromStringAndSize(data, size);
  886. }
  887. if (value->typePtr == app->DoubleType) {
  888. return PyFloat_FromDouble(value->internalRep.doubleValue);
  889. }
  890. if (value->typePtr == app->IntType) {
  891. return PyLong_FromLong(value->internalRep.longValue);
  892. }
  893. if (value->typePtr == app->ListType) {
  894. int size;
  895. int i, status;
  896. PyObject *elem;
  897. Tcl_Obj *tcl_elem;
  898. status = Tcl_ListObjLength(Tkapp_Interp(tkapp), value, &size);
  899. if (status == TCL_ERROR)
  900. return Tkinter_Error(tkapp);
  901. result = PyTuple_New(size);
  902. if (!result)
  903. return NULL;
  904. for (i = 0; i < size; i++) {
  905. status = Tcl_ListObjIndex(Tkapp_Interp(tkapp),
  906. value, i, &tcl_elem);
  907. if (status == TCL_ERROR) {
  908. Py_DECREF(result);
  909. return Tkinter_Error(tkapp);
  910. }
  911. elem = FromObj(tkapp, tcl_elem);
  912. if (!elem) {
  913. Py_DECREF(result);
  914. return NULL;
  915. }
  916. PyTuple_SetItem(result, i, elem);
  917. }
  918. return result;
  919. }
  920. if (value->typePtr == app->ProcBodyType) {
  921. /* fall through: return tcl object. */
  922. }
  923. if (value->typePtr == app->StringType) {
  924. #if defined(Py_UNICODE_WIDE) && TCL_UTF_MAX==3
  925. PyObject *result;
  926. int size;
  927. Tcl_UniChar *input;
  928. Py_UNICODE *output;
  929. size = Tcl_GetCharLength(value);
  930. result = PyUnicode_FromUnicode(NULL, size);
  931. if (!result)
  932. return NULL;
  933. input = Tcl_GetUnicode(value);
  934. output = PyUnicode_AS_UNICODE(result);
  935. while (size--)
  936. *output++ = *input++;
  937. return result;
  938. #else
  939. return PyUnicode_FromUnicode(Tcl_GetUnicode(value),
  940. Tcl_GetCharLength(value));
  941. #endif
  942. }
  943. return newPyTclObject(value);
  944. }
  945. #ifdef WITH_THREAD
  946. /* This mutex synchronizes inter-thread command calls. */
  947. TCL_DECLARE_MUTEX(call_mutex)
  948. typedef struct Tkapp_CallEvent {
  949. Tcl_Event ev; /* Must be first */
  950. TkappObject *self;
  951. PyObject *args;
  952. int flags;
  953. PyObject **res;
  954. PyObject **exc_type, **exc_value, **exc_tb;
  955. Tcl_Condition *done;
  956. } Tkapp_CallEvent;
  957. #endif
  958. void
  959. Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc)
  960. {
  961. int i;
  962. for (i = 0; i < objc; i++)
  963. Tcl_DecrRefCount(objv[i]);
  964. if (objv != objStore)
  965. ckfree(FREECAST objv);
  966. }
  967. /* Convert Python objects to Tcl objects. This must happen in the
  968. interpreter thread, which may or may not be the calling thread. */
  969. static Tcl_Obj**
  970. Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc)
  971. {
  972. Tcl_Obj **objv = objStore;
  973. int objc = 0, i;
  974. if (args == NULL)
  975. /* do nothing */;
  976. else if (!PyTuple_Check(args)) {
  977. objv[0] = AsObj(args);
  978. if (objv[0] == 0)
  979. goto finally;
  980. objc = 1;
  981. Tcl_IncrRefCount(objv[0]);
  982. }
  983. else {
  984. objc = PyTuple_Size(args);
  985. if (objc > ARGSZ) {
  986. objv = (Tcl_Obj **)ckalloc(objc * sizeof(char *));
  987. if (objv == NULL) {
  988. PyErr_NoMemory();
  989. objc = 0;
  990. goto finally;
  991. }
  992. }
  993. for (i = 0; i < objc; i++) {
  994. PyObject *v = PyTuple_GetItem(args, i);
  995. if (v == Py_None) {
  996. objc = i;
  997. break;
  998. }
  999. objv[i] = AsObj(v);
  1000. if (!objv[i]) {
  1001. /* Reset objc, so it attempts to clear
  1002. objects only up to i. */
  1003. objc = i;
  1004. goto finally;
  1005. }
  1006. Tcl_IncrRefCount(objv[i]);
  1007. }
  1008. }
  1009. *pobjc = objc;
  1010. return objv;
  1011. finally:
  1012. Tkapp_CallDeallocArgs(objv, objStore, objc);
  1013. return NULL;
  1014. }
  1015. /* Convert the results of a command call into a Python objects. */
  1016. static PyObject*
  1017. Tkapp_CallResult(TkappObject *self)
  1018. {
  1019. PyObject *res = NULL;
  1020. if(self->wantobjects) {
  1021. Tcl_Obj *value = Tcl_GetObjResult(self->interp);
  1022. /* Not sure whether the IncrRef is necessary, but something
  1023. may overwrite the interpreter result while we are
  1024. converting it. */
  1025. Tcl_IncrRefCount(value);
  1026. res = FromObj((PyObject*)self, value);
  1027. Tcl_DecrRefCount(value);
  1028. } else {
  1029. const char *s = Tcl_GetStringResult(self->interp);
  1030. const char *p = s;
  1031. res = PyUnicode_FromStringAndSize(s, (int)(p-s));
  1032. }
  1033. return res;
  1034. }
  1035. #ifdef WITH_THREAD
  1036. /* Tkapp_CallProc is the event procedure that is executed in the context of
  1037. the Tcl interpreter thread. Initially, it holds the Tcl lock, and doesn't
  1038. hold the Python lock. */
  1039. static int
  1040. Tkapp_CallProc(Tkapp_CallEvent *e, int flags)
  1041. {
  1042. Tcl_Obj *objStore[ARGSZ];
  1043. Tcl_Obj **objv;
  1044. int objc;
  1045. int i;
  1046. ENTER_PYTHON
  1047. objv = Tkapp_CallArgs(e->args, objStore, &objc);
  1048. if (!objv) {
  1049. PyErr_Fetch(e->exc_type, e->exc_value, e->exc_tb);
  1050. *(e->res) = NULL;
  1051. }
  1052. LEAVE_PYTHON
  1053. if (!objv)
  1054. goto done;
  1055. i = Tcl_EvalObjv(e->self->interp, objc, objv, e->flags);
  1056. ENTER_PYTHON
  1057. if (i == TCL_ERROR) {
  1058. *(e->res) = NULL;
  1059. *(e->exc_type) = NULL;
  1060. *(e->exc_tb) = NULL;
  1061. *(e->exc_value) = PyObject_CallFunction(
  1062. Tkinter_TclError, "s",
  1063. Tcl_GetStringResult(e->self->interp));
  1064. }
  1065. else {
  1066. *(e->res) = Tkapp_CallResult(e->self);
  1067. }
  1068. LEAVE_PYTHON
  1069. Tkapp_CallDeallocArgs(objv, objStore, objc);
  1070. done:
  1071. /* Wake up calling thread. */
  1072. Tcl_MutexLock(&call_mutex);
  1073. Tcl_ConditionNotify(e->done);
  1074. Tcl_MutexUnlock(&call_mutex);
  1075. return 1;
  1076. }
  1077. #endif
  1078. /* This is the main entry point for calling a Tcl command.
  1079. It supports three cases, with regard to threading:
  1080. 1. Tcl is not threaded: Must have the Tcl lock, then can invoke command in
  1081. the context of the calling thread.
  1082. 2. Tcl is threaded, caller of the command is in the interpreter thread:
  1083. Execute the command in the calling thread. Since the Tcl lock will
  1084. not be used, we can merge that with case 1.
  1085. 3. Tcl is threaded, caller is in a different thread: Must queue an event to
  1086. the interpreter thread. Allocation of Tcl objects needs to occur in the
  1087. interpreter thread, so we ship the PyObject* args to the target thread,
  1088. and perform processing there. */
  1089. static PyObject *
  1090. Tkapp_Call(PyObject *selfptr, PyObject *args)
  1091. {
  1092. Tcl_Obj *objStore[ARGSZ];
  1093. Tcl_Obj **objv = NULL;
  1094. int objc, i;
  1095. PyObject *res = NULL;
  1096. TkappObject *self = (TkappObject*)selfptr;
  1097. int flags = TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL;
  1098. /* If args is a single tuple, replace with contents of tuple */
  1099. if (1 == PyTuple_Size(args)){
  1100. PyObject* item = PyTuple_GetItem(args, 0);
  1101. if (PyTuple_Check(item))
  1102. args = item;
  1103. }
  1104. #ifdef WITH_THREAD
  1105. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1106. /* We cannot call the command directly. Instead, we must
  1107. marshal the parameters to the interpreter thread. */
  1108. Tkapp_CallEvent *ev;
  1109. Tcl_Condition cond = NULL;
  1110. PyObject *exc_type, *exc_value, *exc_tb;
  1111. if (!WaitForMainloop(self))
  1112. return NULL;
  1113. ev = (Tkapp_CallEvent*)ckalloc(sizeof(Tkapp_CallEvent));
  1114. ev->ev.proc = (Tcl_EventProc*)Tkapp_CallProc;
  1115. ev->self = self;
  1116. ev->args = args;
  1117. ev->res = &res;
  1118. ev->exc_type = &exc_type;
  1119. ev->exc_value = &exc_value;
  1120. ev->exc_tb = &exc_tb;
  1121. ev->done = &cond;
  1122. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, &call_mutex);
  1123. if (res == NULL) {
  1124. if (exc_type)
  1125. PyErr_Restore(exc_type, exc_value, exc_tb);
  1126. else
  1127. PyErr_SetObject(Tkinter_TclError, exc_value);
  1128. }
  1129. Tcl_ConditionFinalize(&cond);
  1130. }
  1131. else
  1132. #endif
  1133. {
  1134. objv = Tkapp_CallArgs(args, objStore, &objc);
  1135. if (!objv)
  1136. return NULL;
  1137. ENTER_TCL
  1138. i = Tcl_EvalObjv(self->interp, objc, objv, flags);
  1139. ENTER_OVERLAP
  1140. if (i == TCL_ERROR)
  1141. Tkinter_Error(selfptr);
  1142. else
  1143. res = Tkapp_CallResult(self);
  1144. LEAVE_OVERLAP_TCL
  1145. Tkapp_CallDeallocArgs(objv, objStore, objc);
  1146. }
  1147. return res;
  1148. }
  1149. static PyObject *
  1150. Tkapp_GlobalCall(PyObject *self, PyObject *args)
  1151. {
  1152. /* Could do the same here as for Tkapp_Call(), but this is not used
  1153. much, so I can't be bothered. Unfortunately Tcl doesn't export a
  1154. way for the user to do what all its Global* variants do (save and
  1155. reset the scope pointer, call the local version, restore the saved
  1156. scope pointer). */
  1157. char *cmd;
  1158. PyObject *res = NULL;
  1159. CHECK_TCL_APPARTMENT;
  1160. cmd = Merge(args);
  1161. if (cmd) {
  1162. int err;
  1163. ENTER_TCL
  1164. err = Tcl_GlobalEval(Tkapp_Interp(self), cmd);
  1165. ENTER_OVERLAP
  1166. if (err == TCL_ERROR)
  1167. res = Tkinter_Error(self);
  1168. else
  1169. res = PyUnicode_FromString(Tkapp_Result(self));
  1170. LEAVE_OVERLAP_TCL
  1171. ckfree(cmd);
  1172. }
  1173. return res;
  1174. }
  1175. static PyObject *
  1176. Tkapp_Eval(PyObject *self, PyObject *args)
  1177. {
  1178. char *script;
  1179. PyObject *res = NULL;
  1180. int err;
  1181. if (!PyArg_ParseTuple(args, "s:eval", &script))
  1182. return NULL;
  1183. CHECK_TCL_APPARTMENT;
  1184. ENTER_TCL
  1185. err = Tcl_Eval(Tkapp_Interp(self), script);
  1186. ENTER_OVERLAP
  1187. if (err == TCL_ERROR)
  1188. res = Tkinter_Error(self);
  1189. else
  1190. res = PyUnicode_FromString(Tkapp_Result(self));
  1191. LEAVE_OVERLAP_TCL
  1192. return res;
  1193. }
  1194. static PyObject *
  1195. Tkapp_GlobalEval(PyObject *self, PyObject *args)
  1196. {
  1197. char *script;
  1198. PyObject *res = NULL;
  1199. int err;
  1200. if (!PyArg_ParseTuple(args, "s:globaleval", &script))
  1201. return NULL;
  1202. CHECK_TCL_APPARTMENT;
  1203. ENTER_TCL
  1204. err = Tcl_GlobalEval(Tkapp_Interp(self), script);
  1205. ENTER_OVERLAP
  1206. if (err == TCL_ERROR)
  1207. res = Tkinter_Error(self);
  1208. else
  1209. res = PyUnicode_FromString(Tkapp_Result(self));
  1210. LEAVE_OVERLAP_TCL
  1211. return res;
  1212. }
  1213. static PyObject *
  1214. Tkapp_EvalFile(PyObject *self, PyObject *args)
  1215. {
  1216. char *fileName;
  1217. PyObject *res = NULL;
  1218. int err;
  1219. if (!PyArg_ParseTuple(args, "s:evalfile", &fileName))
  1220. return NULL;
  1221. CHECK_TCL_APPARTMENT;
  1222. ENTER_TCL
  1223. err = Tcl_EvalFile(Tkapp_Interp(self), fileName);
  1224. ENTER_OVERLAP
  1225. if (err == TCL_ERROR)
  1226. res = Tkinter_Error(self);
  1227. else
  1228. res = PyUnicode_FromString(Tkapp_Result(self));
  1229. LEAVE_OVERLAP_TCL
  1230. return res;
  1231. }
  1232. static PyObject *
  1233. Tkapp_Record(PyObject *self, PyObject *args)
  1234. {
  1235. char *script;
  1236. PyObject *res = NULL;
  1237. int err;
  1238. if (!PyArg_ParseTuple(args, "s", &script))
  1239. return NULL;
  1240. CHECK_TCL_APPARTMENT;
  1241. ENTER_TCL
  1242. err = Tcl_RecordAndEval(Tkapp_Interp(self), script, TCL_NO_EVAL);
  1243. ENTER_OVERLAP
  1244. if (err == TCL_ERROR)
  1245. res = Tkinter_Error(self);
  1246. else
  1247. res = PyUnicode_FromString(Tkapp_Result(self));
  1248. LEAVE_OVERLAP_TCL
  1249. return res;
  1250. }
  1251. static PyObject *
  1252. Tkapp_AddErrorInfo(PyObject *self, PyObject *args)
  1253. {
  1254. char *msg;
  1255. if (!PyArg_ParseTuple(args, "s:adderrorinfo", &msg))
  1256. return NULL;
  1257. CHECK_TCL_APPARTMENT;
  1258. ENTER_TCL
  1259. Tcl_AddErrorInfo(Tkapp_Interp(self), msg);
  1260. LEAVE_TCL
  1261. Py_INCREF(Py_None);
  1262. return Py_None;
  1263. }
  1264. /** Tcl Variable **/
  1265. typedef PyObject* (*EventFunc)(PyObject*, PyObject *args, int flags);
  1266. #ifdef WITH_THREAD
  1267. TCL_DECLARE_MUTEX(var_mutex)
  1268. typedef struct VarEvent {
  1269. Tcl_Event ev; /* must be first */
  1270. PyObject *self;
  1271. PyObject *args;
  1272. int flags;
  1273. EventFunc func;
  1274. PyObject **res;
  1275. PyObject **exc_type;
  1276. PyObject **exc_val;
  1277. Tcl_Condition *cond;
  1278. } VarEvent;
  1279. #endif
  1280. static int
  1281. varname_converter(PyObject *in, void *_out)
  1282. {
  1283. char **out = (char**)_out;
  1284. if (PyBytes_Check(in)) {
  1285. *out = PyBytes_AsString(in);
  1286. return 1;
  1287. }
  1288. if (PyUnicode_Check(in)) {
  1289. *out = _PyUnicode_AsString(in);
  1290. return 1;
  1291. }
  1292. if (PyTclObject_Check(in)) {
  1293. *out = PyTclObject_TclString(in);
  1294. return 1;
  1295. }
  1296. /* XXX: Should give diagnostics. */
  1297. return 0;
  1298. }
  1299. #ifdef WITH_THREAD
  1300. static void
  1301. var_perform(VarEvent *ev)
  1302. {
  1303. *(ev->res) = ev->func(ev->self, ev->args, ev->flags);
  1304. if (!*(ev->res)) {
  1305. PyObject *exc, *val, *tb;
  1306. PyErr_Fetch(&exc, &val, &tb);
  1307. PyErr_NormalizeException(&exc, &val, &tb);
  1308. *(ev->exc_type) = exc;
  1309. *(ev->exc_val) = val;
  1310. Py_DECREF(tb);
  1311. }
  1312. }
  1313. static int
  1314. var_proc(VarEvent* ev, int flags)
  1315. {
  1316. ENTER_PYTHON
  1317. var_perform(ev);
  1318. Tcl_MutexLock(&var_mutex);
  1319. Tcl_ConditionNotify(ev->cond);
  1320. Tcl_MutexUnlock(&var_mutex);
  1321. LEAVE_PYTHON
  1322. return 1;
  1323. }
  1324. #endif
  1325. static PyObject*
  1326. var_invoke(EventFunc func, PyObject *selfptr, PyObject *args, int flags)
  1327. {
  1328. #ifdef WITH_THREAD
  1329. TkappObject *self = (TkappObject*)selfptr;
  1330. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1331. TkappObject *self = (TkappObject*)selfptr;
  1332. VarEvent *ev;
  1333. PyObject *res, *exc_type, *exc_val;
  1334. Tcl_Condition cond = NULL;
  1335. /* The current thread is not the interpreter thread. Marshal
  1336. the call to the interpreter thread, then wait for
  1337. completion. */
  1338. if (!WaitForMainloop(self))
  1339. return NULL;
  1340. ev = (VarEvent*)ckalloc(sizeof(VarEvent));
  1341. ev->self = selfptr;
  1342. ev->args = args;
  1343. ev->flags = flags;
  1344. ev->func = func;
  1345. ev->res = &res;
  1346. ev->exc_type = &exc_type;
  1347. ev->exc_val = &exc_val;
  1348. ev->cond = &cond;
  1349. ev->ev.proc = (Tcl_EventProc*)var_proc;
  1350. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, &var_mutex);
  1351. Tcl_ConditionFinalize(&cond);
  1352. if (!res) {
  1353. PyErr_SetObject(exc_type, exc_val);
  1354. Py_DECREF(exc_type);
  1355. Py_DECREF(exc_val);
  1356. return NULL;
  1357. }
  1358. return res;
  1359. }
  1360. #endif
  1361. /* Tcl is not threaded, or this is the interpreter thread. */
  1362. return func(selfptr, args, flags);
  1363. }
  1364. static PyObject *
  1365. SetVar(PyObject *self, PyObject *args, int flags)
  1366. {
  1367. char *name1, *name2;
  1368. PyObject *newValue;
  1369. PyObject *res = NULL;
  1370. Tcl_Obj *newval, *ok;
  1371. if (PyArg_ParseTuple(args, "O&O:setvar",
  1372. varname_converter, &name1, &newValue)) {
  1373. /* XXX Acquire tcl lock??? */
  1374. newval = AsObj(newValue);
  1375. if (newval == NULL)
  1376. return NULL;
  1377. ENTER_TCL
  1378. ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, NULL,
  1379. newval, flags);
  1380. ENTER_OVERLAP
  1381. if (!ok)
  1382. Tkinter_Error(self);
  1383. else {
  1384. res = Py_None;
  1385. Py_INCREF(res);
  1386. }
  1387. LEAVE_OVERLAP_TCL
  1388. }
  1389. else {
  1390. PyErr_Clear();
  1391. if (PyArg_ParseTuple(args, "ssO:setvar",
  1392. &name1, &name2, &newValue)) {
  1393. /* XXX must hold tcl lock already??? */
  1394. newval = AsObj(newValue);
  1395. ENTER_TCL
  1396. ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, name2, newval, flags);
  1397. ENTER_OVERLAP
  1398. if (!ok)
  1399. Tkinter_Error(self);
  1400. else {
  1401. res = Py_None;
  1402. Py_INCREF(res);
  1403. }
  1404. LEAVE_OVERLAP_TCL
  1405. }
  1406. else {
  1407. return NULL;
  1408. }
  1409. }
  1410. return res;
  1411. }
  1412. static PyObject *
  1413. Tkapp_SetVar(PyObject *self, PyObject *args)
  1414. {
  1415. return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG);
  1416. }
  1417. static PyObject *
  1418. Tkapp_GlobalSetVar(PyObject *self, PyObject *args)
  1419. {
  1420. return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
  1421. }
  1422. static PyObject *
  1423. GetVar(PyObject *self, PyObject *args, int flags)
  1424. {
  1425. char *name1, *name2=NULL;
  1426. PyObject *res = NULL;
  1427. Tcl_Obj *tres;
  1428. if (!PyArg_ParseTuple(args, "O&|s:getvar",
  1429. varname_converter, &name1, &name2))
  1430. return NULL;
  1431. ENTER_TCL
  1432. tres = Tcl_GetVar2Ex(Tkapp_Interp(self), name1, name2, flags);
  1433. ENTER_OVERLAP
  1434. if (tres == NULL) {
  1435. PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self)));
  1436. } else {
  1437. if (((TkappObject*)self)->wantobjects) {
  1438. res = FromObj(self, tres);
  1439. }
  1440. else {
  1441. res = PyUnicode_FromString(Tcl_GetString(tres));
  1442. }
  1443. }
  1444. LEAVE_OVERLAP_TCL
  1445. return res;
  1446. }
  1447. static PyObject *
  1448. Tkapp_GetVar(PyObject *self, PyObject *args)
  1449. {
  1450. return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG);
  1451. }
  1452. static PyObject *
  1453. Tkapp_GlobalGetVar(PyObject *self, PyObject *args)
  1454. {
  1455. return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
  1456. }
  1457. static PyObject *
  1458. UnsetVar(PyObject *self, PyObject *args, int flags)
  1459. {
  1460. char *name1, *name2=NULL;
  1461. int code;
  1462. PyObject *res = NULL;
  1463. if (!PyArg_ParseTuple(args, "s|s:unsetvar", &name1, &name2))
  1464. return NULL;
  1465. ENTER_TCL
  1466. code = Tcl_UnsetVar2(Tkapp_Interp(self), name1, name2, flags);
  1467. ENTER_OVERLAP
  1468. if (code == TCL_ERROR)
  1469. res = Tkinter_Error(self);
  1470. else {
  1471. Py_INCREF(Py_None);
  1472. res = Py_None;
  1473. }
  1474. LEAVE_OVERLAP_TCL
  1475. return res;
  1476. }
  1477. static PyObject *
  1478. Tkapp_UnsetVar(PyObject *self, PyObject *args)
  1479. {
  1480. return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG);
  1481. }
  1482. static PyObject *
  1483. Tkapp_GlobalUnsetVar(PyObject *self, PyObject *args)
  1484. {
  1485. return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
  1486. }
  1487. /** Tcl to Python **/
  1488. static PyObject *
  1489. Tkapp_GetInt(PyObject *self, PyObject *args)
  1490. {
  1491. char *s;
  1492. int v;
  1493. if (PyTuple_Size(args) == 1) {
  1494. PyObject* o = PyTuple_GetItem(args, 0);
  1495. if (PyLong_Check(o)) {
  1496. Py_INCREF(o);
  1497. return o;
  1498. }
  1499. }
  1500. if (!PyArg_ParseTuple(args, "s:getint", &s))
  1501. return NULL;
  1502. if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR)
  1503. return Tkinter_Error(self);
  1504. return Py_BuildValue("i", v);
  1505. }
  1506. static PyObject *
  1507. Tkapp_GetDouble(PyObject *self, PyObject *args)
  1508. {
  1509. char *s;
  1510. double v;
  1511. if (PyTuple_Size(args) == 1) {
  1512. PyObject *o = PyTuple_GetItem(args, 0);
  1513. if (PyFloat_Check(o)) {
  1514. Py_INCREF(o);
  1515. return o;
  1516. }
  1517. }
  1518. if (!PyArg_ParseTuple(args, "s:getdouble", &s))
  1519. return NULL;
  1520. if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR)
  1521. return Tkinter_Error(self);
  1522. return Py_BuildValue("d", v);
  1523. }
  1524. static PyObject *
  1525. Tkapp_GetBoolean(PyObject *self, PyObject *args)
  1526. {
  1527. char *s;
  1528. int v;
  1529. if (PyTuple_Size(args) == 1) {
  1530. PyObject *o = PyTuple_GetItem(args, 0);
  1531. if (PyLong_Check(o)) {
  1532. Py_INCREF(o);
  1533. return o;
  1534. }
  1535. }
  1536. if (!PyArg_ParseTuple(args, "s:getboolean", &s))
  1537. return NULL;
  1538. if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR)
  1539. return Tkinter_Error(self);
  1540. return PyBool_FromLong(v);
  1541. }
  1542. static PyObject *
  1543. Tkapp_ExprString(PyObject *self, PyObject *args)
  1544. {
  1545. char *s;
  1546. PyObject *res = NULL;
  1547. int retval;
  1548. if (!PyArg_ParseTuple(args, "s:exprstring", &s))
  1549. return NULL;
  1550. CHECK_TCL_APPARTMENT;
  1551. ENTER_TCL
  1552. retval = Tcl_ExprString(Tkapp_Interp(self), s);
  1553. ENTER_OVERLAP
  1554. if (retval == TCL_ERROR)
  1555. res = Tkinter_Error(self);
  1556. else
  1557. res = Py_BuildValue("s", Tkapp_Result(self));
  1558. LEAVE_OVERLAP_TCL
  1559. return res;
  1560. }
  1561. static PyObject *
  1562. Tkapp_ExprLong(PyObject *self, PyObject *args)
  1563. {
  1564. char *s;
  1565. PyObject *res = NULL;
  1566. int retval;
  1567. long v;
  1568. if (!PyArg_ParseTuple(args, "s:exprlong", &s))
  1569. return NULL;
  1570. CHECK_TCL_APPARTMENT;
  1571. ENTER_TCL
  1572. retval = Tcl_ExprLong(Tkapp_Interp(self), s, &v);
  1573. ENTER_OVERLAP
  1574. if (retval == TCL_ERROR)
  1575. res = Tkinter_Error(self);
  1576. else
  1577. res = Py_BuildValue("l", v);
  1578. LEAVE_OVERLAP_TCL
  1579. return res;
  1580. }
  1581. static PyObject *
  1582. Tkapp_ExprDouble(PyObject *self, PyObject *args)
  1583. {
  1584. char *s;
  1585. PyObject *res = NULL;
  1586. double v;
  1587. int retval;
  1588. if (!PyArg_ParseTuple(args, "s:exprdouble", &s))
  1589. return NULL;
  1590. CHECK_TCL_APPARTMENT;
  1591. PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0)
  1592. ENTER_TCL
  1593. retval = Tcl_ExprDouble(Tkapp_Interp(self), s, &v);
  1594. ENTER_OVERLAP
  1595. PyFPE_END_PROTECT(retval)
  1596. if (retval == TCL_ERROR)
  1597. res = Tkinter_Error(self);
  1598. else
  1599. res = Py_BuildValue("d", v);
  1600. LEAVE_OVERLAP_TCL
  1601. return res;
  1602. }
  1603. static PyObject *
  1604. Tkapp_ExprBoolean(PyObject *self, PyObject *args)
  1605. {
  1606. char *s;
  1607. PyObject *res = NULL;
  1608. int retval;
  1609. int v;
  1610. if (!PyArg_ParseTuple(args, "s:exprboolean", &s))
  1611. return NULL;
  1612. CHECK_TCL_APPARTMENT;
  1613. ENTER_TCL
  1614. retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v);
  1615. ENTER_OVERLAP
  1616. if (retval == TCL_ERROR)
  1617. res = Tkinter_Error(self);
  1618. else
  1619. res = Py_BuildValue("i", v);
  1620. LEAVE_OVERLAP_TCL
  1621. return res;
  1622. }
  1623. static PyObject *
  1624. Tkapp_SplitList(PyObject *self, PyObject *args)
  1625. {
  1626. char *list;
  1627. int argc;
  1628. char **argv;
  1629. PyObject *v;
  1630. int i;
  1631. if (PyTuple_Size(args) == 1) {
  1632. v = PyTuple_GetItem(args, 0);
  1633. if (PyTuple_Check(v)) {
  1634. Py_INCREF(v);
  1635. return v;
  1636. }
  1637. }
  1638. if (!PyArg_ParseTuple(args, "et:splitlist", "utf-8", &list))
  1639. return NULL;
  1640. if (Tcl_SplitList(Tkapp_Interp(self), list,
  1641. &argc, &argv) == TCL_ERROR) {
  1642. PyMem_Free(list);
  1643. return Tkinter_Error(self);
  1644. }
  1645. if (!(v = PyTuple_New(argc)))
  1646. goto finally;
  1647. for (i = 0; i < argc; i++) {
  1648. PyObject *s = PyUnicode_FromString(argv[i]);
  1649. if (!s || PyTuple_SetItem(v, i, s)) {
  1650. Py_DECREF(v);
  1651. v = NULL;
  1652. goto finally;
  1653. }
  1654. }
  1655. finally:
  1656. ckfree(FREECAST argv);
  1657. PyMem_Free(list);
  1658. return v;
  1659. }
  1660. static PyObject *
  1661. Tkapp_Split(PyObject *self, PyObject *args)
  1662. {
  1663. PyObject *v;
  1664. char *list;
  1665. if (PyTuple_Size(args) == 1) {
  1666. PyObject* o = PyTuple_GetItem(args, 0);
  1667. if (PyTuple_Check(o)) {
  1668. o = SplitObj(o);
  1669. return o;
  1670. }
  1671. }
  1672. if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list))
  1673. return NULL;
  1674. v = Split(list);
  1675. PyMem_Free(list);
  1676. return v;
  1677. }
  1678. static PyObject *
  1679. Tkapp_Merge(PyObject *self, PyObject *args)
  1680. {
  1681. char *s = Merge(args);
  1682. PyObject *res = NULL;
  1683. if (s) {
  1684. res = PyUnicode_FromString(s);
  1685. ckfree(s);
  1686. }
  1687. return res;
  1688. }
  1689. /** Tcl Command **/
  1690. /* Client data struct */
  1691. typedef struct {
  1692. PyObject *self;
  1693. PyObject *func;
  1694. } PythonCmd_ClientData;
  1695. static int
  1696. PythonCmd_Error(Tcl_Interp *interp)
  1697. {
  1698. errorInCmd = 1;
  1699. PyErr_Fetch(&excInCmd, &valInCmd, &trbInCmd);
  1700. LEAVE_PYTHON
  1701. return TCL_ERROR;
  1702. }
  1703. /* This is the Tcl command that acts as a wrapper for Python
  1704. * function or method.
  1705. */
  1706. static int
  1707. PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
  1708. {
  1709. PythonCmd_ClientData *data = (PythonCmd_ClientData *)clientData;
  1710. PyObject *self, *func, *arg, *res;
  1711. int i, rv;
  1712. Tcl_Obj *obj_res;
  1713. ENTER_PYTHON
  1714. /* TBD: no error checking here since we know, via the
  1715. * Tkapp_CreateCommand() that the client data is a two-tuple
  1716. */
  1717. self = data->self;
  1718. func = data->func;
  1719. /* Create argument list (argv1, ..., argvN) */
  1720. if (!(arg = PyTuple_New(argc - 1)))
  1721. return PythonCmd_Error(interp);
  1722. for (i = 0; i < (argc - 1); i++) {
  1723. PyObject *s = PyUnicode_FromString(argv[i + 1]);
  1724. if (!s) {
  1725. /* Is Tk leaking 0xC080 in %A - a "modified" utf-8 null? */
  1726. if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError) &&
  1727. !strcmp(argv[i + 1], "\xC0\x80")) {
  1728. PyErr_Clear();
  1729. /* Convert to "strict" utf-8 null */
  1730. s = PyUnicode_FromString("\0");
  1731. } else {
  1732. Py_DECREF(arg);
  1733. return PythonCmd_Error(interp);
  1734. }
  1735. }
  1736. if (PyTuple_SetItem(arg, i, s)) {
  1737. Py_DECREF(arg);
  1738. return PythonCmd_Error(interp);
  1739. }
  1740. }
  1741. res = PyEval_CallObject(func, arg);
  1742. Py_DECREF(arg);
  1743. if (res == NULL)
  1744. return PythonCmd_Error(interp);
  1745. obj_res = AsObj(res);
  1746. if (obj_res == NULL) {
  1747. Py_DECREF(res);
  1748. return PythonCmd_Error(interp);
  1749. }
  1750. else {
  1751. Tcl_SetObjResult(interp, obj_res);
  1752. rv = TCL_OK;
  1753. }
  1754. Py_DECREF(res);
  1755. LEAVE_PYTHON
  1756. return rv;
  1757. }
  1758. static void
  1759. PythonCmdDelete(ClientData clientData)
  1760. {
  1761. PythonCmd_ClientData *data = (PythonCmd_ClientData *)clientData;
  1762. ENTER_PYTHON
  1763. Py_XDECREF(data->self);
  1764. Py_XDECREF(data->func);
  1765. PyMem_DEL(data);
  1766. LEAVE_PYTHON
  1767. }
  1768. #ifdef WITH_THREAD
  1769. TCL_DECLARE_MUTEX(command_mutex)
  1770. typedef struct CommandEvent{
  1771. Tcl_Event ev;
  1772. Tcl_Interp* interp;
  1773. char *name;
  1774. int create;
  1775. int *status;
  1776. ClientData *data;
  1777. Tcl_Condition *done;
  1778. } CommandEvent;
  1779. static int
  1780. Tkapp_CommandProc(CommandEvent *ev, int flags)
  1781. {
  1782. if (ev->create)
  1783. *ev->status = Tcl_CreateCommand(
  1784. ev->interp, ev->name, PythonCmd,
  1785. ev->data, PythonCmdDelete) == NULL;
  1786. else
  1787. *ev->status = Tcl_DeleteCommand(ev->interp, ev->name);
  1788. Tcl_MutexLock(&command_mutex);
  1789. Tcl_ConditionNotify(ev->done);
  1790. Tcl_MutexUnlock(&command_mutex);
  1791. return 1;
  1792. }
  1793. #endif
  1794. static PyObject *
  1795. Tkapp_CreateCommand(PyObject *selfptr, PyObject *args)
  1796. {
  1797. TkappObject *self = (TkappObject*)selfptr;
  1798. PythonCmd_ClientData *data;
  1799. char *cmdName;
  1800. PyObject *func;
  1801. int err;
  1802. if (!PyArg_ParseTuple(args, "sO:createcommand", &cmdName, &func))
  1803. return NULL;
  1804. if (!PyCallable_Check(func)) {
  1805. PyErr_SetString(PyExc_TypeError, "command not callable");
  1806. return NULL;
  1807. }
  1808. #ifdef WITH_THREAD
  1809. if (self->threaded && self->thread_id != Tcl_GetCurrentThread() &&
  1810. !WaitForMainloop(self))
  1811. return NULL;
  1812. #endif
  1813. data = PyMem_NEW(PythonCmd_ClientData, 1);
  1814. if (!data)
  1815. return PyErr_NoMemory();
  1816. Py_INCREF(self);
  1817. Py_INCREF(func);
  1818. data->self = selfptr;
  1819. data->func = func;
  1820. #ifdef WITH_THREAD
  1821. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1822. Tcl_Condition cond = NULL;
  1823. CommandEvent *ev = (CommandEvent*)ckalloc(sizeof(CommandEvent));
  1824. ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
  1825. ev->interp = self->interp;
  1826. ev->create = 1;
  1827. ev->name = cmdName;
  1828. ev->data = (ClientData)data;
  1829. ev->status = &err;
  1830. ev->done = &cond;
  1831. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, &command_mutex);
  1832. Tcl_ConditionFinalize(&cond);
  1833. }
  1834. else
  1835. #endif
  1836. {
  1837. ENTER_TCL
  1838. err = Tcl_CreateCommand(
  1839. Tkapp_Interp(self), cmdName, PythonCmd,
  1840. (ClientData)data, PythonCmdDelete) == NULL;
  1841. LEAVE_TCL
  1842. }
  1843. if (err) {
  1844. PyErr_SetString(Tkinter_TclError, "can't create Tcl command");
  1845. PyMem_DEL(data);
  1846. return NULL;
  1847. }
  1848. Py_INCREF(Py_None);
  1849. return Py_None;
  1850. }
  1851. static PyObject *
  1852. Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args)
  1853. {
  1854. TkappObject *self = (TkappObject*)selfptr;
  1855. char *cmdName;
  1856. int err;
  1857. if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName))
  1858. return NULL;
  1859. #ifdef WITH_THREAD
  1860. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1861. Tcl_Condition cond = NULL;
  1862. CommandEvent *ev;
  1863. ev = (CommandEvent*)ckalloc(sizeof(CommandEvent));
  1864. ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
  1865. ev->interp = self->interp;
  1866. ev->create = 0;
  1867. ev->name = cmdName;
  1868. ev->status = &err;
  1869. ev->done = &cond;
  1870. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond,
  1871. &command_mutex);
  1872. Tcl_ConditionFinalize(&cond);
  1873. }
  1874. else
  1875. #endif
  1876. {
  1877. ENTER_TCL
  1878. err = Tcl_DeleteCommand(self->interp, cmdName);
  1879. LEAVE_TCL
  1880. }
  1881. if (err == -1) {
  1882. PyErr_SetString(Tkinter_TclError, "can't delete Tcl command");
  1883. return NULL;
  1884. }
  1885. Py_INCREF(Py_None);
  1886. return Py_None;
  1887. }
  1888. #ifdef HAVE_CREATEFILEHANDLER
  1889. /** File Handler **/
  1890. typedef struct _fhcdata {
  1891. PyObject *func;
  1892. PyObject *file;
  1893. int id;
  1894. struct _fhcdata *next;
  1895. } FileHandler_ClientData;
  1896. static FileHandler_ClientData *HeadFHCD;
  1897. static FileHandler_ClientData *
  1898. NewFHCD(PyObject *func, PyObject *file, int id)
  1899. {
  1900. FileHandler_ClientData *p;
  1901. p = PyMem_NEW(FileHandler_ClientData, 1);
  1902. if (p != NULL) {
  1903. Py_XINCREF(func);
  1904. Py_XINCREF(file);
  1905. p->func = func;
  1906. p->file = file;
  1907. p->id = id;
  1908. p->next = HeadFHCD;
  1909. HeadFHCD = p;
  1910. }
  1911. return p;
  1912. }
  1913. static void
  1914. DeleteFHCD(int id)
  1915. {
  1916. FileHandler_ClientData *p, **pp;
  1917. pp = &HeadFHCD;
  1918. while ((p = *pp) != NULL) {
  1919. if (p->id == id) {
  1920. *pp = p->next;
  1921. Py_XDECREF(p->func);
  1922. Py_XDECREF(p->file);
  1923. PyMem_DEL(p);
  1924. }
  1925. else
  1926. pp = &p->next;
  1927. }
  1928. }
  1929. static void
  1930. FileHandler(ClientData clientData, int mask)
  1931. {
  1932. FileHandler_ClientData *data = (FileHandler_ClientData *)clientData;
  1933. PyObject *func, *file, *arg, *res;
  1934. ENTER_PYTHON
  1935. func = data->func;
  1936. file = data->file;
  1937. arg = Py_BuildValue("(Oi)", file, (long) mask);
  1938. res = PyEval_CallObject(func, arg);
  1939. Py_DECREF(arg);
  1940. if (res == NULL) {
  1941. errorInCmd = 1;
  1942. PyErr_Fetch(&excInCmd, &valInCmd, &trbInCmd);
  1943. }
  1944. Py_XDECREF(res);
  1945. LEAVE_PYTHON
  1946. }
  1947. static PyObject *
  1948. Tkapp_CreateFileHandler(PyObject *self, PyObject *args)
  1949. /* args is (file, mask, func) */
  1950. {
  1951. FileHandler_ClientData *data;
  1952. PyObject *file, *func;
  1953. int mask, tfile;
  1954. if (!PyArg_ParseTuple(args, "OiO:createfilehandler",
  1955. &file, &mask, &func))
  1956. return NULL;
  1957. CHECK_TCL_APPARTMENT;
  1958. tfile = PyObject_AsFileDescriptor(file);
  1959. if (tfile < 0)
  1960. return NULL;
  1961. if (!PyCallable_Check(func)) {
  1962. PyErr_SetString(PyExc_TypeError, "bad argument list");
  1963. return NULL;
  1964. }
  1965. data = NewFHCD(func, file, tfile);
  1966. if (data == NULL)
  1967. return NULL;
  1968. /* Ought to check for null Tcl_File object... */
  1969. ENTER_TCL
  1970. Tcl_CreateFileHandler(tfile, mask, FileHandler, (ClientData) data);
  1971. LEAVE_TCL
  1972. Py_INCREF(Py_None);
  1973. return Py_None;
  1974. }
  1975. static PyObject *
  1976. Tkapp_DeleteFileHandler(PyObject *self, PyObject *args)
  1977. {
  1978. PyObject *file;
  1979. int tfile;
  1980. if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file))
  1981. return NULL;
  1982. CHECK_TCL_APPARTMENT;
  1983. tfile = PyObject_AsFileDescriptor(file);
  1984. if (tfile < 0)
  1985. return NULL;
  1986. DeleteFHCD(tfile);
  1987. /* Ought to check for null Tcl_File object... */
  1988. ENTER_TCL
  1989. Tcl_DeleteFileHandler(tfile);
  1990. LEAVE_TCL
  1991. Py_INCREF(Py_None);
  1992. return Py_None;
  1993. }
  1994. #endif /* HAVE_CREATEFILEHANDLER */
  1995. /**** Tktt Object (timer token) ****/
  1996. static PyTypeObject Tktt_Type;
  1997. typedef struct {
  1998. PyObject_HEAD
  1999. Tcl_TimerToken token;
  2000. PyObject *func;
  2001. } TkttObject;
  2002. static PyObject *
  2003. Tktt_DeleteTimerHandler(PyObject *self, PyObject *args)
  2004. {
  2005. TkttObject *v = (TkttObject *)self;
  2006. PyObject *func = v->func;
  2007. if (!PyArg_ParseTuple(args, ":deletetimerhandler"))
  2008. return NULL;
  2009. if (v->token != NULL) {
  2010. Tcl_DeleteTimerHandler(v->token);
  2011. v->token = NULL;
  2012. }
  2013. if (func != NULL) {
  2014. v->func = NULL;
  2015. Py_DECREF(func);
  2016. Py_DECREF(v); /* See Tktt_New() */
  2017. }
  2018. Py_INCREF(Py_None);
  2019. return Py_None;
  2020. }
  2021. static PyMethodDef Tktt_methods[] =
  2022. {
  2023. {"deletetimerhandler", Tktt_DeleteTimerHandler, METH_VARARGS},
  2024. {NULL, NULL}
  2025. };
  2026. static TkttObject *
  2027. Tktt_New(PyObject *func)
  2028. {
  2029. TkttObject *v;
  2030. v = PyObject_New(TkttObject, &Tktt_Type);
  2031. if (v == NULL)
  2032. return NULL;
  2033. Py_INCREF(func);
  2034. v->token = NULL;
  2035. v->func = func;
  2036. /* Extra reference, deleted when called or when handler is deleted */
  2037. Py_INCREF(v);
  2038. return v;
  2039. }
  2040. static void
  2041. Tktt_Dealloc(PyObject *self)
  2042. {
  2043. TkttObject *v = (TkttObject *)self;
  2044. PyObject *func = v->func;
  2045. Py_XDECREF(func);
  2046. PyObject_Del(self);
  2047. }
  2048. static PyObject *
  2049. Tktt_Repr(PyObject *self)
  2050. {
  2051. TkttObject *v = (TkttObject *)self;
  2052. char buf[100];
  2053. PyOS_snprintf(buf, sizeof(buf), "<tktimertoken at %p%s>", v,
  2054. v->func == NULL ? ", handler deleted" : "");
  2055. return PyUnicode_FromString(buf);
  2056. }
  2057. static PyTypeObject Tktt_Type =
  2058. {
  2059. PyVarObject_HEAD_INIT(NULL, 0)
  2060. "tktimertoken", /*tp_name */
  2061. sizeof(TkttObject), /*tp_basicsize */
  2062. 0, /*tp_itemsize */
  2063. Tktt_Dealloc, /*tp_dealloc */
  2064. 0, /*tp_print */
  2065. 0, /*tp_getattr */
  2066. 0, /*tp_setattr */
  2067. 0, /*tp_reserved */
  2068. Tktt_Repr, /*tp_repr */
  2069. 0, /*tp_as_number */
  2070. 0, /*tp_as_sequence */
  2071. 0, /*tp_as_mapping */
  2072. 0, /*tp_hash */
  2073. 0, /*tp_call*/
  2074. 0, /*tp_str*/
  2075. 0, /*tp_getattro*/
  2076. 0, /*tp_setattro*/
  2077. 0, /*tp_as_buffer*/
  2078. Py_TPFLAGS_DEFAULT, /*tp_flags*/
  2079. 0, /*tp_doc*/
  2080. 0, /*tp_traverse*/
  2081. 0, /*tp_clear*/
  2082. 0, /*tp_richcompare*/
  2083. 0, /*tp_weaklistoffset*/
  2084. 0, /*tp_iter*/
  2085. 0, /*tp_iternext*/
  2086. Tktt_methods, /*tp_methods*/
  2087. };
  2088. /** Timer Handler **/
  2089. static void
  2090. TimerHandler(ClientData clientData)
  2091. {
  2092. TkttObject *v = (TkttObject *)clientData;
  2093. PyObject *func = v->func;
  2094. PyObject *res;
  2095. if (func == NULL)
  2096. return;
  2097. v->func = NULL;
  2098. ENTER_PYTHON
  2099. res = PyEval_CallObject(func, NULL);
  2100. Py_DECREF(func);
  2101. Py_DECREF(v); /* See Tktt_New() */
  2102. if (res == NULL) {
  2103. errorInCmd = 1;
  2104. PyErr_Fetch(&excInCmd, &valInCmd, &trbInCmd);
  2105. }
  2106. else
  2107. Py_DECREF(res);
  2108. LEAVE_PYTHON
  2109. }
  2110. static PyObject *
  2111. Tkapp_CreateTimerHandler(PyObject *self, PyObject *args)
  2112. {
  2113. int milliseconds;
  2114. PyObject *func;
  2115. TkttObject *v;
  2116. if (!PyArg_ParseTuple(args, "iO:createtimerhandler",
  2117. &milliseconds, &func))
  2118. return NULL;
  2119. if (!PyCallable_Check(func)) {
  2120. PyErr_SetString(PyExc_TypeError, "bad argument list");
  2121. return NULL;
  2122. }
  2123. CHECK_TCL_APPARTMENT;
  2124. v = Tktt_New(func);
  2125. if (v) {
  2126. v->token = Tcl_CreateTimerHandler(milliseconds, TimerHandler,
  2127. (ClientData)v);
  2128. }
  2129. return (PyObject *) v;
  2130. }
  2131. /** Event Loop **/
  2132. static PyObject *
  2133. Tkapp_MainLoop(PyObject *selfptr, PyObject *args)
  2134. {
  2135. int threshold = 0;
  2136. TkappObject *self = (TkappObject*)selfptr;
  2137. #ifdef WITH_THREAD
  2138. PyThreadState *tstate = PyThreadState_Get();
  2139. #endif
  2140. if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold))
  2141. return NULL;
  2142. CHECK_TCL_APPARTMENT;
  2143. self->dispatching = 1;
  2144. quitMainLoop = 0;
  2145. while (Tk_GetNumMainWindows() > threshold &&
  2146. !quitMainLoop &&
  2147. !errorInCmd)
  2148. {
  2149. int result;
  2150. #ifdef WITH_THREAD
  2151. if (self->threaded) {
  2152. /* Allow other Python threads to run. */
  2153. ENTER_TCL
  2154. result = Tcl_DoOneEvent(0);
  2155. LEAVE_TCL
  2156. }
  2157. else {
  2158. Py_BEGIN_ALLOW_THREADS
  2159. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1);
  2160. tcl_tstate = tstate;
  2161. result = Tcl_DoOneEvent(TCL_DONT_WAIT);
  2162. tcl_tstate = NULL;
  2163. if(tcl_lock)PyThread_release_lock(tcl_lock);
  2164. if (result == 0)
  2165. Sleep(Tkinter_busywaitinterval);
  2166. Py_END_ALLOW_THREADS
  2167. }
  2168. #else
  2169. result = Tcl_DoOneEvent(0);
  2170. #endif
  2171. if (PyErr_CheckSignals() != 0) {
  2172. self->dispatching = 0;
  2173. return NULL;
  2174. }
  2175. if (result < 0)
  2176. break;
  2177. }
  2178. self->dispatching = 0;
  2179. quitMainLoop = 0;
  2180. if (errorInCmd) {
  2181. errorInCmd = 0;
  2182. PyErr_Restore(excInCmd, valInCmd, trbInCmd);
  2183. excInCmd = valInCmd = trbInCmd = NULL;
  2184. return NULL;
  2185. }
  2186. Py_INCREF(Py_None);
  2187. return Py_None;
  2188. }
  2189. static PyObject *
  2190. Tkapp_DoOneEvent(PyObject *self, PyObject *args)
  2191. {
  2192. int flags = 0;
  2193. int rv;
  2194. if (!PyArg_ParseTuple(args, "|i:dooneevent", &flags))
  2195. return NULL;
  2196. ENTER_TCL
  2197. rv = Tcl_DoOneEvent(flags);
  2198. LEAVE_TCL
  2199. return Py_BuildValue("i", rv);
  2200. }
  2201. static PyObject *
  2202. Tkapp_Quit(PyObject *self, PyObject *args)
  2203. {
  2204. if (!PyArg_ParseTuple(args, ":quit"))
  2205. return NULL;
  2206. quitMainLoop = 1;
  2207. Py_INCREF(Py_None);
  2208. return Py_None;
  2209. }
  2210. static PyObject *
  2211. Tkapp_InterpAddr(PyObject *self, PyObject *args)
  2212. {
  2213. if (!PyArg_ParseTuple(args, ":interpaddr"))
  2214. return NULL;
  2215. return PyLong_FromLong((long)Tkapp_Interp(self));
  2216. }
  2217. static PyObject *
  2218. Tkapp_TkInit(PyObject *self, PyObject *args)
  2219. {
  2220. Tcl_Interp *interp = Tkapp_Interp(self);
  2221. const char * _tk_exists = NULL;
  2222. int err;
  2223. #ifdef TKINTER_PROTECT_LOADTK
  2224. /* Up to Tk 8.4.13, Tk_Init deadlocks on the second call when the
  2225. * first call failed.
  2226. * To avoid the deadlock, we just refuse the second call through
  2227. * a static variable.
  2228. */
  2229. if (tk_load_failed) {
  2230. PyErr_SetString(Tkinter_TclError, TKINTER_LOADTK_ERRMSG);
  2231. return NULL;
  2232. }
  2233. #endif
  2234. /* We want to guard against calling Tk_Init() multiple times */
  2235. CHECK_TCL_APPARTMENT;
  2236. ENTER_TCL
  2237. err = Tcl_Eval(Tkapp_Interp(self), "info exists tk_version");
  2238. ENTER_OVERLAP
  2239. if (err == TCL_ERROR) {
  2240. /* This sets an exception, but we cannot return right
  2241. away because we need to exit the overlap first. */
  2242. Tkinter_Error(self);
  2243. } else {
  2244. _tk_exists = Tkapp_Result(self);
  2245. }
  2246. LEAVE_OVERLAP_TCL
  2247. if (err == TCL_ERROR) {
  2248. return NULL;
  2249. }
  2250. if (_tk_exists == NULL || strcmp(_tk_exists, "1") != 0) {
  2251. if (Tk_Init(interp) == TCL_ERROR) {
  2252. PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self)));
  2253. #ifdef TKINTER_PROTECT_LOADTK
  2254. tk_load_failed = 1;
  2255. #endif
  2256. return NULL;
  2257. }
  2258. }
  2259. Py_INCREF(Py_None);
  2260. return Py_None;
  2261. }
  2262. static PyObject *
  2263. Tkapp_WantObjects(PyObject *self, PyObject *args)
  2264. {
  2265. int wantobjects = -1;
  2266. if (!PyArg_ParseTuple(args, "|i:wantobjects", &wantobjects))
  2267. return NULL;
  2268. if (wantobjects == -1)
  2269. return PyBool_FromLong(((TkappObject*)self)->wantobjects);
  2270. ((TkappObject*)self)->wantobjects = wantobjects;
  2271. Py_INCREF(Py_None);
  2272. return Py_None;
  2273. }
  2274. static PyObject *
  2275. Tkapp_WillDispatch(PyObject *self, PyObject *args)
  2276. {
  2277. ((TkappObject*)self)->dispatching = 1;
  2278. Py_INCREF(Py_None);
  2279. return Py_None;
  2280. }
  2281. /**** Tkapp Method List ****/
  2282. static PyMethodDef Tkapp_methods[] =
  2283. {
  2284. {"willdispatch", Tkapp_WillDispatch, METH_NOARGS},
  2285. {"wantobjects", Tkapp_WantObjects, METH_VARARGS},
  2286. {"call", Tkapp_Call, METH_VARARGS},
  2287. {"globalcall", Tkapp_GlobalCall, METH_VARARGS},
  2288. {"eval", Tkapp_Eval, METH_VARARGS},
  2289. {"globaleval", Tkapp_GlobalEval, METH_VARARGS},
  2290. {"evalfile", Tkapp_EvalFile, METH_VARARGS},
  2291. {"record", Tkapp_Record, METH_VARARGS},
  2292. {"adderrorinfo", Tkapp_AddErrorInfo, METH_VARARGS},
  2293. {"setvar", Tkapp_SetVar, METH_VARARGS},
  2294. {"globalsetvar", Tkapp_GlobalSetVar, METH_VARARGS},
  2295. {"getvar", Tkapp_GetVar, METH_VARARGS},
  2296. {"globalgetvar", Tkapp_GlobalGetVar, METH_VARARGS},
  2297. {"unsetvar", Tkapp_UnsetVar, METH_VARARGS},
  2298. {"globalunsetvar", Tkapp_GlobalUnsetVar, METH_VARARGS},
  2299. {"getint", Tkapp_GetInt, METH_VARARGS},
  2300. {"getdouble", Tkapp_GetDouble, METH_VARARGS},
  2301. {"getboolean", Tkapp_GetBoolean, METH_VARARGS},
  2302. {"exprstring", Tkapp_ExprString, METH_VARARGS},
  2303. {"exprlong", Tkapp_ExprLong, METH_VARARGS},
  2304. {"exprdouble", Tkapp_ExprDouble, METH_VARARGS},
  2305. {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS},
  2306. {"splitlist", Tkapp_SplitList, METH_VARARGS},
  2307. {"split", Tkapp_Split, METH_VARARGS},
  2308. {"merge", Tkapp_Merge, METH_VARARGS},
  2309. {"createcommand", Tkapp_CreateCommand, METH_VARARGS},
  2310. {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS},
  2311. #ifdef HAVE_CREATEFILEHANDLER
  2312. {"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS},
  2313. {"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS},
  2314. #endif
  2315. {"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
  2316. {"mainloop", Tkapp_MainLoop, METH_VARARGS},
  2317. {"dooneevent", Tkapp_DoOneEvent, METH_VARARGS},
  2318. {"quit", Tkapp_Quit, METH_VARARGS},
  2319. {"interpaddr", Tkapp_InterpAddr, METH_VARARGS},
  2320. {"loadtk", Tkapp_TkInit, METH_NOARGS},
  2321. {NULL, NULL}
  2322. };
  2323. /**** Tkapp Type Methods ****/
  2324. static void
  2325. Tkapp_Dealloc(PyObject *self)
  2326. {
  2327. /*CHECK_TCL_APPARTMENT;*/
  2328. ENTER_TCL
  2329. Tcl_DeleteInterp(Tkapp_Interp(self));
  2330. LEAVE_TCL
  2331. PyObject_Del(self);
  2332. DisableEventHook();
  2333. }
  2334. static PyTypeObject Tkapp_Type =
  2335. {
  2336. PyVarObject_HEAD_INIT(NULL, 0)
  2337. "tkapp", /*tp_name */
  2338. sizeof(TkappObject), /*tp_basicsize */
  2339. 0, /*tp_itemsize */
  2340. Tkapp_Dealloc, /*tp_dealloc */
  2341. 0, /*tp_print */
  2342. 0, /*tp_getattr */
  2343. 0, /*tp_setattr */
  2344. 0, /*tp_reserved */
  2345. 0, /*tp_repr */
  2346. 0, /*tp_as_number */
  2347. 0, /*tp_as_sequence */
  2348. 0, /*tp_as_mapping */
  2349. 0, /*tp_hash */
  2350. 0, /*tp_call*/
  2351. 0, /*tp_str*/
  2352. 0, /*tp_getattro*/
  2353. 0, /*tp_setattro*/
  2354. 0, /*tp_as_buffer*/
  2355. Py_TPFLAGS_DEFAULT, /*tp_flags*/
  2356. 0, /*tp_doc*/
  2357. 0, /*tp_traverse*/
  2358. 0, /*tp_clear*/
  2359. 0, /*tp_richcompare*/
  2360. 0, /*tp_weaklistoffset*/
  2361. 0, /*tp_iter*/
  2362. 0, /*tp_iternext*/
  2363. Tkapp_methods, /*tp_methods*/
  2364. };
  2365. /**** Tkinter Module ****/
  2366. typedef struct {
  2367. PyObject* tuple;
  2368. int size; /* current size */
  2369. int maxsize; /* allocated size */
  2370. } FlattenContext;
  2371. static int
  2372. _bump(FlattenContext* context, int size)
  2373. {
  2374. /* expand tuple to hold (at least) size new items.
  2375. return true if successful, false if an exception was raised */
  2376. int maxsize = context->maxsize * 2;
  2377. if (maxsize < context->size + size)
  2378. maxsize = context->size + size;
  2379. context->maxsize = maxsize;
  2380. return _PyTuple_Resize(&context->tuple, maxsize) >= 0;
  2381. }
  2382. static int
  2383. _flatten1(FlattenContext* context, PyObject* item, int depth)
  2384. {
  2385. /* add tuple or list to argument tuple (recursively) */
  2386. int i, size;
  2387. if (depth > 1000) {
  2388. PyErr_SetString(PyExc_ValueError,
  2389. "nesting too deep in _flatten");
  2390. return 0;
  2391. } else if (PyList_Check(item)) {
  2392. size = PyList_GET_SIZE(item);
  2393. /* preallocate (assume no nesting) */
  2394. if (context->size + size > context->maxsize &&
  2395. !_bump(context, size))
  2396. return 0;
  2397. /* copy items to output tuple */
  2398. for (i = 0; i < size; i++) {
  2399. PyObject *o = PyList_GET_ITEM(item, i);
  2400. if (PyList_Check(o) || PyTuple_Check(o)) {
  2401. if (!_flatten1(context, o, depth + 1))
  2402. return 0;
  2403. } else if (o != Py_None) {
  2404. if (context->size + 1 > context->maxsize &&
  2405. !_bump(context, 1))
  2406. return 0;
  2407. Py_INCREF(o);
  2408. PyTuple_SET_ITEM(context->tuple,
  2409. context->size++, o);
  2410. }
  2411. }
  2412. } else if (PyTuple_Check(item)) {
  2413. /* same, for tuples */
  2414. size = PyTuple_GET_SIZE(item);
  2415. if (context->size + size > context->maxsize &&
  2416. !_bump(context, size))
  2417. return 0;
  2418. for (i = 0; i < size; i++) {
  2419. PyObject *o = PyTuple_GET_ITEM(item, i);
  2420. if (PyList_Check(o) || PyTuple_Check(o)) {
  2421. if (!_flatten1(context, o, depth + 1))
  2422. return 0;
  2423. } else if (o != Py_None) {
  2424. if (context->size + 1 > context->maxsize &&
  2425. !_bump(context, 1))
  2426. return 0;
  2427. Py_INCREF(o);
  2428. PyTuple_SET_ITEM(context->tuple,
  2429. context->size++, o);
  2430. }
  2431. }
  2432. } else {
  2433. PyErr_SetString(PyExc_TypeError, "argument must be sequence");
  2434. return 0;
  2435. }
  2436. return 1;
  2437. }
  2438. static PyObject *
  2439. Tkinter_Flatten(PyObject* self, PyObject* args)
  2440. {
  2441. FlattenContext context;
  2442. PyObject* item;
  2443. if (!PyArg_ParseTuple(args, "O:_flatten", &item))
  2444. return NULL;
  2445. context.maxsize = PySequence_Size(item);
  2446. if (context.maxsize < 0)
  2447. return NULL;
  2448. if (context.maxsize == 0)
  2449. return PyTuple_New(0);
  2450. context.tuple = PyTuple_New(context.maxsize);
  2451. if (!context.tuple)
  2452. return NULL;
  2453. context.size = 0;
  2454. if (!_flatten1(&context, item,0))
  2455. return NULL;
  2456. if (_PyTuple_Resize(&context.tuple, context.size))
  2457. return NULL;
  2458. return context.tuple;
  2459. }
  2460. static PyObject *
  2461. Tkinter_Create(PyObject *self, PyObject *args)
  2462. {
  2463. char *screenName = NULL;
  2464. char *baseName = NULL; /* XXX this is not used anymore;
  2465. try getting rid of it. */
  2466. char *className = NULL;
  2467. int interactive = 0;
  2468. int wantobjects = 0;
  2469. int wantTk = 1; /* If false, then Tk_Init() doesn't get called */
  2470. int sync = 0; /* pass -sync to wish */
  2471. char *use = NULL; /* pass -use to wish */
  2472. className = "Tk";
  2473. if (!PyArg_ParseTuple(args, "|zssiiiiz:create",
  2474. &screenName, &baseName, &className,
  2475. &interactive, &wantobjects, &wantTk,
  2476. &sync, &use))
  2477. return NULL;
  2478. return (PyObject *) Tkapp_New(screenName, className,
  2479. interactive, wantobjects, wantTk,
  2480. sync, use);
  2481. }
  2482. static PyObject *
  2483. Tkinter_setbusywaitinterval(PyObject *self, PyObject *args)
  2484. {
  2485. int new_val;
  2486. if (!PyArg_ParseTuple(args, "i:setbusywaitinterval", &new_val))
  2487. return NULL;
  2488. if (new_val < 0) {
  2489. PyErr_SetString(PyExc_ValueError,
  2490. "busywaitinterval must be >= 0");
  2491. return NULL;
  2492. }
  2493. Tkinter_busywaitinterval = new_val;
  2494. Py_INCREF(Py_None);
  2495. return Py_None;
  2496. }
  2497. static char setbusywaitinterval_doc[] =
  2498. "setbusywaitinterval(n) -> None\n\
  2499. \n\
  2500. Set the busy-wait interval in milliseconds between successive\n\
  2501. calls to Tcl_DoOneEvent in a threaded Python interpreter.\n\
  2502. It should be set to a divisor of the maximum time between\n\
  2503. frames in an animation.";
  2504. static PyObject *
  2505. Tkinter_getbusywaitinterval(PyObject *self, PyObject *args)
  2506. {
  2507. return PyLong_FromLong(Tkinter_busywaitinterval);
  2508. }
  2509. static char getbusywaitinterval_doc[] =
  2510. "getbusywaitinterval() -> int\n\
  2511. \n\
  2512. Return the current busy-wait interval between successive\n\
  2513. calls to Tcl_DoOneEvent in a threaded Python interpreter.";
  2514. static PyMethodDef moduleMethods[] =
  2515. {
  2516. {"_flatten", Tkinter_Flatten, METH_VARARGS},
  2517. {"create", Tkinter_Create, METH_VARARGS},
  2518. {"setbusywaitinterval",Tkinter_setbusywaitinterval, METH_VARARGS,
  2519. setbusywaitinterval_doc},
  2520. {"getbusywaitinterval",(PyCFunction)Tkinter_getbusywaitinterval,
  2521. METH_NOARGS, getbusywaitinterval_doc},
  2522. {NULL, NULL}
  2523. };
  2524. #ifdef WAIT_FOR_STDIN
  2525. static int stdin_ready = 0;
  2526. #ifndef MS_WINDOWS
  2527. static void
  2528. MyFileProc(void *clientData, int mask)
  2529. {
  2530. stdin_ready = 1;
  2531. }
  2532. #endif
  2533. #ifdef WITH_THREAD
  2534. static PyThreadState *event_tstate = NULL;
  2535. #endif
  2536. static int
  2537. EventHook(void)
  2538. {
  2539. #ifndef MS_WINDOWS
  2540. int tfile;
  2541. #endif
  2542. #ifdef WITH_THREAD
  2543. PyEval_RestoreThread(event_tstate);
  2544. #endif
  2545. stdin_ready = 0;
  2546. errorInCmd = 0;
  2547. #ifndef MS_WINDOWS
  2548. tfile = fileno(stdin);
  2549. Tcl_CreateFileHandler(tfile, TCL_READABLE, MyFileProc, NULL);
  2550. #endif
  2551. while (!errorInCmd && !stdin_ready) {
  2552. int result;
  2553. #ifdef MS_WINDOWS
  2554. if (_kbhit()) {
  2555. stdin_ready = 1;
  2556. break;
  2557. }
  2558. #endif
  2559. #if defined(WITH_THREAD) || defined(MS_WINDOWS)
  2560. Py_BEGIN_ALLOW_THREADS
  2561. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1);
  2562. tcl_tstate = event_tstate;
  2563. result = Tcl_DoOneEvent(TCL_DONT_WAIT);
  2564. tcl_tstate = NULL;
  2565. if(tcl_lock)PyThread_release_lock(tcl_lock);
  2566. if (result == 0)
  2567. Sleep(Tkinter_busywaitinterval);
  2568. Py_END_ALLOW_THREADS
  2569. #else
  2570. result = Tcl_DoOneEvent(0);
  2571. #endif
  2572. if (result < 0)
  2573. break;
  2574. }
  2575. #ifndef MS_WINDOWS
  2576. Tcl_DeleteFileHandler(tfile);
  2577. #endif
  2578. if (errorInCmd) {
  2579. errorInCmd = 0;
  2580. PyErr_Restore(excInCmd, valInCmd, trbInCmd);
  2581. excInCmd = valInCmd = trbInCmd = NULL;
  2582. PyErr_Print();
  2583. }
  2584. #ifdef WITH_THREAD
  2585. PyEval_SaveThread();
  2586. #endif
  2587. return 0;
  2588. }
  2589. #endif
  2590. static void
  2591. EnableEventHook(void)
  2592. {
  2593. #ifdef WAIT_FOR_STDIN
  2594. if (PyOS_InputHook == NULL) {
  2595. #ifdef WITH_THREAD
  2596. event_tstate = PyThreadState_Get();
  2597. #endif
  2598. PyOS_InputHook = EventHook;
  2599. }
  2600. #endif
  2601. }
  2602. static void
  2603. DisableEventHook(void)
  2604. {
  2605. #ifdef WAIT_FOR_STDIN
  2606. if (Tk_GetNumMainWindows() == 0 && PyOS_InputHook == EventHook) {
  2607. PyOS_InputHook = NULL;
  2608. }
  2609. #endif
  2610. }
  2611. /* all errors will be checked in one fell swoop in init_tkinter() */
  2612. static void
  2613. ins_long(PyObject *d, char *name, long val)
  2614. {
  2615. PyObject *v = PyLong_FromLong(val);
  2616. if (v) {
  2617. PyDict_SetItemString(d, name, v);
  2618. Py_DECREF(v);
  2619. }
  2620. }
  2621. static void
  2622. ins_string(PyObject *d, char *name, char *val)
  2623. {
  2624. PyObject *v = PyUnicode_FromString(val);
  2625. if (v) {
  2626. PyDict_SetItemString(d, name, v);
  2627. Py_DECREF(v);
  2628. }
  2629. }
  2630. static struct PyModuleDef _tkintermodule = {
  2631. PyModuleDef_HEAD_INIT,
  2632. "_tkinter",
  2633. NULL,
  2634. -1,
  2635. moduleMethods,
  2636. NULL,
  2637. NULL,
  2638. NULL,
  2639. NULL
  2640. };
  2641. PyMODINIT_FUNC
  2642. PyInit__tkinter(void)
  2643. {
  2644. PyObject *m, *d, *uexe, *cexe;
  2645. if (PyType_Ready(&Tkapp_Type) < 0)
  2646. return NULL;
  2647. #ifdef WITH_THREAD
  2648. tcl_lock = PyThread_allocate_lock();
  2649. #endif
  2650. m = PyModule_Create(&_tkintermodule);
  2651. if (m == NULL)
  2652. return NULL;
  2653. d = PyModule_GetDict(m);
  2654. Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
  2655. PyDict_SetItemString(d, "TclError", Tkinter_TclError);
  2656. ins_long(d, "READABLE", TCL_READABLE);
  2657. ins_long(d, "WRITABLE", TCL_WRITABLE);
  2658. ins_long(d, "EXCEPTION", TCL_EXCEPTION);
  2659. ins_long(d, "WINDOW_EVENTS", TCL_WINDOW_EVENTS);
  2660. ins_long(d, "FILE_EVENTS", TCL_FILE_EVENTS);
  2661. ins_long(d, "TIMER_EVENTS", TCL_TIMER_EVENTS);
  2662. ins_long(d, "IDLE_EVENTS", TCL_IDLE_EVENTS);
  2663. ins_long(d, "ALL_EVENTS", TCL_ALL_EVENTS);
  2664. ins_long(d, "DONT_WAIT", TCL_DONT_WAIT);
  2665. ins_string(d, "TK_VERSION", TK_VERSION);
  2666. ins_string(d, "TCL_VERSION", TCL_VERSION);
  2667. PyDict_SetItemString(d, "TkappType", (PyObject *)&Tkapp_Type);
  2668. if (PyType_Ready(&Tktt_Type) < 0)
  2669. return NULL;
  2670. PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
  2671. Py_TYPE(&PyTclObject_Type) = &PyType_Type;
  2672. PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
  2673. #ifdef TK_AQUA
  2674. /* Tk_MacOSXSetupTkNotifier must be called before Tcl's subsystems
  2675. * start waking up. Note that Tcl_FindExecutable will do this, this
  2676. * code must be above it! The original warning from
  2677. * tkMacOSXAppInit.c is copied below.
  2678. *
  2679. * NB - You have to swap in the Tk Notifier BEFORE you start up the
  2680. * Tcl interpreter for now. It probably should work to do this
  2681. * in the other order, but for now it doesn't seem to.
  2682. *
  2683. */
  2684. Tk_MacOSXSetupTkNotifier();
  2685. #endif
  2686. /* This helps the dynamic loader; in Unicode aware Tcl versions
  2687. it also helps Tcl find its encodings. */
  2688. uexe = PyUnicode_FromWideChar(Py_GetProgramName(), -1);
  2689. if (uexe) {
  2690. cexe = PyUnicode_EncodeFSDefault(uexe);
  2691. if (cexe)
  2692. Tcl_FindExecutable(PyBytes_AsString(cexe));
  2693. Py_XDECREF(cexe);
  2694. Py_DECREF(uexe);
  2695. }
  2696. if (PyErr_Occurred()) {
  2697. Py_DECREF(m);
  2698. return NULL;
  2699. }
  2700. #if 0
  2701. /* This was not a good idea; through <Destroy> bindings,
  2702. Tcl_Finalize() may invoke Python code but at that point the
  2703. interpreter and thread state have already been destroyed! */
  2704. Py_AtExit(Tcl_Finalize);
  2705. #endif
  2706. return m;
  2707. }