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.

3181 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. #if !(defined(MS_WINDOWS) || defined(__CYGWIN__))
  62. #define HAVE_CREATEFILEHANDLER
  63. #endif
  64. #ifdef HAVE_CREATEFILEHANDLER
  65. /* This bit is to ensure that TCL_UNIX_FD is defined and doesn't interfere
  66. with the proper calculation of FHANDLETYPE == TCL_UNIX_FD below. */
  67. #ifndef TCL_UNIX_FD
  68. # ifdef TCL_WIN_SOCKET
  69. # define TCL_UNIX_FD (! TCL_WIN_SOCKET)
  70. # else
  71. # define TCL_UNIX_FD 1
  72. # endif
  73. #endif
  74. /* Tcl_CreateFileHandler() changed several times; these macros deal with the
  75. messiness. In Tcl 8.0 and later, it is not available on Windows (and on
  76. Unix, only because Jack added it back); when available on Windows, it only
  77. applies to sockets. */
  78. #ifdef MS_WINDOWS
  79. #define FHANDLETYPE TCL_WIN_SOCKET
  80. #else
  81. #define FHANDLETYPE TCL_UNIX_FD
  82. #endif
  83. /* If Tcl can wait for a Unix file descriptor, define the EventHook() routine
  84. which uses this to handle Tcl events while the user is typing commands. */
  85. #if FHANDLETYPE == TCL_UNIX_FD
  86. #define WAIT_FOR_STDIN
  87. #endif
  88. #endif /* HAVE_CREATEFILEHANDLER */
  89. #ifdef MS_WINDOWS
  90. #include <conio.h>
  91. #define WAIT_FOR_STDIN
  92. #endif
  93. #ifdef WITH_THREAD
  94. /* The threading situation is complicated. Tcl is not thread-safe, except
  95. when configured with --enable-threads.
  96. So we need to use a lock around all uses of Tcl. Previously, the Python
  97. interpreter lock was used for this. However, this causes problems when
  98. other Python threads need to run while Tcl is blocked waiting for events.
  99. To solve this problem, a separate lock for Tcl is introduced. Holding it
  100. is incompatible with holding Python's interpreter lock. The following four
  101. macros manipulate both locks together.
  102. ENTER_TCL and LEAVE_TCL are brackets, just like Py_BEGIN_ALLOW_THREADS and
  103. Py_END_ALLOW_THREADS. They should be used whenever a call into Tcl is made
  104. that could call an event handler, or otherwise affect the state of a Tcl
  105. interpreter. These assume that the surrounding code has the Python
  106. interpreter lock; inside the brackets, the Python interpreter lock has been
  107. released and the lock for Tcl has been acquired.
  108. Sometimes, it is necessary to have both the Python lock and the Tcl lock.
  109. (For example, when transferring data from the Tcl interpreter result to a
  110. Python string object.) This can be done by using different macros to close
  111. the ENTER_TCL block: ENTER_OVERLAP reacquires the Python lock (and restores
  112. the thread state) but doesn't release the Tcl lock; LEAVE_OVERLAP_TCL
  113. releases the Tcl lock.
  114. By contrast, ENTER_PYTHON and LEAVE_PYTHON are used in Tcl event
  115. handlers when the handler needs to use Python. Such event handlers are
  116. entered while the lock for Tcl is held; the event handler presumably needs
  117. to use Python. ENTER_PYTHON releases the lock for Tcl and acquires
  118. the Python interpreter lock, restoring the appropriate thread state, and
  119. LEAVE_PYTHON releases the Python interpreter lock and re-acquires the lock
  120. for Tcl. It is okay for ENTER_TCL/LEAVE_TCL pairs to be contained inside
  121. the code between ENTER_PYTHON and LEAVE_PYTHON.
  122. These locks expand to several statements and brackets; they should not be
  123. used in branches of if statements and the like.
  124. If Tcl is threaded, this approach won't work anymore. The Tcl interpreter is
  125. only valid in the thread that created it, and all Tk activity must happen in this
  126. thread, also. That means that the mainloop must be invoked in the thread that
  127. created the interpreter. Invoking commands from other threads is possible;
  128. _tkinter will queue an event for the interpreter thread, which will then
  129. execute the command and pass back the result. If the main thread is not in the
  130. mainloop, and invoking commands causes an exception; if the main loop is running
  131. but not processing events, the command invocation will block.
  132. In addition, for a threaded Tcl, a single global tcl_tstate won't be sufficient
  133. anymore, since multiple Tcl interpreters may simultaneously dispatch in different
  134. threads. So we use the Tcl TLS API.
  135. */
  136. static PyThread_type_lock tcl_lock = 0;
  137. #ifdef TCL_THREADS
  138. static Tcl_ThreadDataKey state_key;
  139. typedef PyThreadState *ThreadSpecificData;
  140. #define tcl_tstate (*(PyThreadState**)Tcl_GetThreadData(&state_key, sizeof(PyThreadState*)))
  141. #else
  142. static PyThreadState *tcl_tstate = NULL;
  143. #endif
  144. #define ENTER_TCL \
  145. { PyThreadState *tstate = PyThreadState_Get(); Py_BEGIN_ALLOW_THREADS \
  146. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate;
  147. #define LEAVE_TCL \
  148. tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); Py_END_ALLOW_THREADS}
  149. #define ENTER_OVERLAP \
  150. Py_END_ALLOW_THREADS
  151. #define LEAVE_OVERLAP_TCL \
  152. tcl_tstate = NULL; if(tcl_lock)PyThread_release_lock(tcl_lock); }
  153. #define ENTER_PYTHON \
  154. { PyThreadState *tstate = tcl_tstate; tcl_tstate = NULL; \
  155. if(tcl_lock)PyThread_release_lock(tcl_lock); PyEval_RestoreThread((tstate)); }
  156. #define LEAVE_PYTHON \
  157. { PyThreadState *tstate = PyEval_SaveThread(); \
  158. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1); tcl_tstate = tstate; }
  159. #define CHECK_TCL_APPARTMENT \
  160. if (((TkappObject *)self)->threaded && \
  161. ((TkappObject *)self)->thread_id != Tcl_GetCurrentThread()) { \
  162. PyErr_SetString(PyExc_RuntimeError, "Calling Tcl from different appartment"); \
  163. return 0; \
  164. }
  165. #else
  166. #define ENTER_TCL
  167. #define LEAVE_TCL
  168. #define ENTER_OVERLAP
  169. #define LEAVE_OVERLAP_TCL
  170. #define ENTER_PYTHON
  171. #define LEAVE_PYTHON
  172. #define CHECK_TCL_APPARTMENT
  173. #endif
  174. #ifndef FREECAST
  175. #define FREECAST (char *)
  176. #endif
  177. /**** Tkapp Object Declaration ****/
  178. static PyTypeObject Tkapp_Type;
  179. typedef struct {
  180. PyObject_HEAD
  181. Tcl_Interp *interp;
  182. int wantobjects;
  183. int threaded; /* True if tcl_platform[threaded] */
  184. Tcl_ThreadId thread_id;
  185. int dispatching;
  186. /* We cannot include tclInt.h, as this is internal.
  187. So we cache interesting types here. */
  188. Tcl_ObjType *BooleanType;
  189. Tcl_ObjType *ByteArrayType;
  190. Tcl_ObjType *DoubleType;
  191. Tcl_ObjType *IntType;
  192. Tcl_ObjType *ListType;
  193. Tcl_ObjType *ProcBodyType;
  194. Tcl_ObjType *StringType;
  195. } TkappObject;
  196. #define Tkapp_Check(v) (Py_TYPE(v) == &Tkapp_Type)
  197. #define Tkapp_Interp(v) (((TkappObject *) (v))->interp)
  198. #define Tkapp_Result(v) Tcl_GetStringResult(Tkapp_Interp(v))
  199. #define DEBUG_REFCNT(v) (printf("DEBUG: id=%p, refcnt=%i\n", \
  200. (void *) v, Py_REFCNT(v)))
  201. /**** Error Handling ****/
  202. static PyObject *Tkinter_TclError;
  203. static int quitMainLoop = 0;
  204. static int errorInCmd = 0;
  205. static PyObject *excInCmd;
  206. static PyObject *valInCmd;
  207. static PyObject *trbInCmd;
  208. #ifdef TKINTER_PROTECT_LOADTK
  209. static int tk_load_failed = 0;
  210. #endif
  211. static PyObject *
  212. Tkinter_Error(PyObject *v)
  213. {
  214. PyErr_SetString(Tkinter_TclError, Tkapp_Result(v));
  215. return NULL;
  216. }
  217. /**** Utils ****/
  218. static int Tkinter_busywaitinterval = 20;
  219. #ifdef WITH_THREAD
  220. #ifndef MS_WINDOWS
  221. /* Millisecond sleep() for Unix platforms. */
  222. static void
  223. Sleep(int milli)
  224. {
  225. /* XXX Too bad if you don't have select(). */
  226. struct timeval t;
  227. t.tv_sec = milli/1000;
  228. t.tv_usec = (milli%1000) * 1000;
  229. select(0, (fd_set *)0, (fd_set *)0, (fd_set *)0, &t);
  230. }
  231. #endif /* MS_WINDOWS */
  232. /* Wait up to 1s for the mainloop to come up. */
  233. static int
  234. WaitForMainloop(TkappObject* self)
  235. {
  236. int i;
  237. for (i = 0; i < 10; i++) {
  238. if (self->dispatching)
  239. return 1;
  240. Py_BEGIN_ALLOW_THREADS
  241. Sleep(100);
  242. Py_END_ALLOW_THREADS
  243. }
  244. if (self->dispatching)
  245. return 1;
  246. PyErr_SetString(PyExc_RuntimeError, "main thread is not in main loop");
  247. return 0;
  248. }
  249. #endif /* WITH_THREAD */
  250. static char *
  251. AsString(PyObject *value, PyObject *tmp)
  252. {
  253. if (PyBytes_Check(value))
  254. return PyBytes_AsString(value);
  255. else if (PyUnicode_Check(value)) {
  256. PyObject *v = PyUnicode_AsUTF8String(value);
  257. if (v == NULL)
  258. return NULL;
  259. if (PyList_Append(tmp, v) != 0) {
  260. Py_DECREF(v);
  261. return NULL;
  262. }
  263. Py_DECREF(v);
  264. return PyBytes_AsString(v);
  265. }
  266. else {
  267. PyObject *v = PyObject_Str(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. }
  278. #define ARGSZ 64
  279. static char *
  280. Merge(PyObject *args)
  281. {
  282. PyObject *tmp = NULL;
  283. char *argvStore[ARGSZ];
  284. char **argv = NULL;
  285. int fvStore[ARGSZ];
  286. int *fv = NULL;
  287. int argc = 0, fvc = 0, i;
  288. char *res = NULL;
  289. if (!(tmp = PyList_New(0)))
  290. return NULL;
  291. argv = argvStore;
  292. fv = fvStore;
  293. if (args == NULL)
  294. argc = 0;
  295. else if (!PyTuple_Check(args)) {
  296. argc = 1;
  297. fv[0] = 0;
  298. if (!(argv[0] = AsString(args, tmp)))
  299. goto finally;
  300. }
  301. else {
  302. argc = PyTuple_Size(args);
  303. if (argc > ARGSZ) {
  304. argv = (char **)ckalloc(argc * sizeof(char *));
  305. fv = (int *)ckalloc(argc * sizeof(int));
  306. if (argv == NULL || fv == NULL) {
  307. PyErr_NoMemory();
  308. goto finally;
  309. }
  310. }
  311. for (i = 0; i < argc; i++) {
  312. PyObject *v = PyTuple_GetItem(args, i);
  313. if (PyTuple_Check(v)) {
  314. fv[i] = 1;
  315. if (!(argv[i] = Merge(v)))
  316. goto finally;
  317. fvc++;
  318. }
  319. else if (v == Py_None) {
  320. argc = i;
  321. break;
  322. }
  323. else {
  324. fv[i] = 0;
  325. if (!(argv[i] = AsString(v, tmp)))
  326. goto finally;
  327. fvc++;
  328. }
  329. }
  330. }
  331. res = Tcl_Merge(argc, argv);
  332. if (res == NULL)
  333. PyErr_SetString(Tkinter_TclError, "merge failed");
  334. finally:
  335. for (i = 0; i < fvc; i++)
  336. if (fv[i]) {
  337. ckfree(argv[i]);
  338. }
  339. if (argv != argvStore)
  340. ckfree(FREECAST argv);
  341. if (fv != fvStore)
  342. ckfree(FREECAST fv);
  343. Py_DECREF(tmp);
  344. return res;
  345. }
  346. static PyObject *
  347. Split(char *list)
  348. {
  349. int argc;
  350. char **argv;
  351. PyObject *v;
  352. if (list == NULL) {
  353. Py_INCREF(Py_None);
  354. return Py_None;
  355. }
  356. if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
  357. /* Not a list.
  358. * Could be a quoted string containing funnies, e.g. {"}.
  359. * Return the string itself.
  360. */
  361. return PyUnicode_FromString(list);
  362. }
  363. if (argc == 0)
  364. v = PyUnicode_FromString("");
  365. else if (argc == 1)
  366. v = PyUnicode_FromString(argv[0]);
  367. else if ((v = PyTuple_New(argc)) != NULL) {
  368. int i;
  369. PyObject *w;
  370. for (i = 0; i < argc; i++) {
  371. if ((w = Split(argv[i])) == NULL) {
  372. Py_DECREF(v);
  373. v = NULL;
  374. break;
  375. }
  376. PyTuple_SetItem(v, i, w);
  377. }
  378. }
  379. Tcl_Free(FREECAST argv);
  380. return v;
  381. }
  382. /* In some cases, Tcl will still return strings that are supposed to be
  383. lists. SplitObj walks through a nested tuple, finding string objects that
  384. need to be split. */
  385. static PyObject *
  386. SplitObj(PyObject *arg)
  387. {
  388. if (PyTuple_Check(arg)) {
  389. int i, size;
  390. PyObject *elem, *newelem, *result;
  391. size = PyTuple_Size(arg);
  392. result = NULL;
  393. /* Recursively invoke SplitObj for all tuple items.
  394. If this does not return a new object, no action is
  395. needed. */
  396. for(i = 0; i < size; i++) {
  397. elem = PyTuple_GetItem(arg, i);
  398. newelem = SplitObj(elem);
  399. if (!newelem) {
  400. Py_XDECREF(result);
  401. return NULL;
  402. }
  403. if (!result) {
  404. int k;
  405. if (newelem == elem) {
  406. Py_DECREF(newelem);
  407. continue;
  408. }
  409. result = PyTuple_New(size);
  410. if (!result)
  411. return NULL;
  412. for(k = 0; k < i; k++) {
  413. elem = PyTuple_GetItem(arg, k);
  414. Py_INCREF(elem);
  415. PyTuple_SetItem(result, k, elem);
  416. }
  417. }
  418. PyTuple_SetItem(result, i, newelem);
  419. }
  420. if (result)
  421. return result;
  422. /* Fall through, returning arg. */
  423. }
  424. else if (PyBytes_Check(arg)) {
  425. int argc;
  426. char **argv;
  427. char *list = PyBytes_AsString(arg);
  428. if (Tcl_SplitList((Tcl_Interp *)NULL, list, &argc, &argv) != TCL_OK) {
  429. Py_INCREF(arg);
  430. return arg;
  431. }
  432. Tcl_Free(FREECAST argv);
  433. if (argc > 1)
  434. return Split(PyBytes_AsString(arg));
  435. /* Fall through, returning arg. */
  436. }
  437. Py_INCREF(arg);
  438. return arg;
  439. }
  440. /**** Tkapp Object ****/
  441. #ifndef WITH_APPINIT
  442. int
  443. Tcl_AppInit(Tcl_Interp *interp)
  444. {
  445. const char * _tkinter_skip_tk_init;
  446. if (Tcl_Init(interp) == TCL_ERROR) {
  447. PySys_WriteStderr("Tcl_Init error: %s\n", Tcl_GetStringResult(interp));
  448. return TCL_ERROR;
  449. }
  450. _tkinter_skip_tk_init = Tcl_GetVar(interp,
  451. "_tkinter_skip_tk_init", TCL_GLOBAL_ONLY);
  452. if (_tkinter_skip_tk_init != NULL &&
  453. strcmp(_tkinter_skip_tk_init, "1") == 0) {
  454. return TCL_OK;
  455. }
  456. #ifdef TKINTER_PROTECT_LOADTK
  457. if (tk_load_failed) {
  458. PySys_WriteStderr("Tk_Init error: %s\n", TKINTER_LOADTK_ERRMSG);
  459. return TCL_ERROR;
  460. }
  461. #endif
  462. if (Tk_Init(interp) == TCL_ERROR) {
  463. #ifdef TKINTER_PROTECT_LOADTK
  464. tk_load_failed = 1;
  465. #endif
  466. PySys_WriteStderr("Tk_Init error: %s\n", Tcl_GetStringResult(interp));
  467. return TCL_ERROR;
  468. }
  469. return TCL_OK;
  470. }
  471. #endif /* !WITH_APPINIT */
  472. /* Initialize the Tk application; see the `main' function in
  473. * `tkMain.c'.
  474. */
  475. static void EnableEventHook(void); /* Forward */
  476. static void DisableEventHook(void); /* Forward */
  477. static TkappObject *
  478. Tkapp_New(char *screenName, char *className,
  479. int interactive, int wantobjects, int wantTk, int sync, char *use)
  480. {
  481. TkappObject *v;
  482. char *argv0;
  483. v = PyObject_New(TkappObject, &Tkapp_Type);
  484. if (v == NULL)
  485. return NULL;
  486. v->interp = Tcl_CreateInterp();
  487. v->wantobjects = wantobjects;
  488. v->threaded = Tcl_GetVar2Ex(v->interp, "tcl_platform", "threaded",
  489. TCL_GLOBAL_ONLY) != NULL;
  490. v->thread_id = Tcl_GetCurrentThread();
  491. v->dispatching = 0;
  492. #ifndef TCL_THREADS
  493. if (v->threaded) {
  494. PyErr_SetString(PyExc_RuntimeError, "Tcl is threaded but _tkinter is not");
  495. Py_DECREF(v);
  496. return 0;
  497. }
  498. #endif
  499. #ifdef WITH_THREAD
  500. if (v->threaded && tcl_lock) {
  501. /* If Tcl is threaded, we don't need the lock. */
  502. PyThread_free_lock(tcl_lock);
  503. tcl_lock = NULL;
  504. }
  505. #endif
  506. v->BooleanType = Tcl_GetObjType("boolean");
  507. v->ByteArrayType = Tcl_GetObjType("bytearray");
  508. v->DoubleType = Tcl_GetObjType("double");
  509. v->IntType = Tcl_GetObjType("int");
  510. v->ListType = Tcl_GetObjType("list");
  511. v->ProcBodyType = Tcl_GetObjType("procbody");
  512. v->StringType = Tcl_GetObjType("string");
  513. /* Delete the 'exit' command, which can screw things up */
  514. Tcl_DeleteCommand(v->interp, "exit");
  515. if (screenName != NULL)
  516. Tcl_SetVar2(v->interp, "env", "DISPLAY",
  517. screenName, TCL_GLOBAL_ONLY);
  518. if (interactive)
  519. Tcl_SetVar(v->interp, "tcl_interactive", "1", TCL_GLOBAL_ONLY);
  520. else
  521. Tcl_SetVar(v->interp, "tcl_interactive", "0", TCL_GLOBAL_ONLY);
  522. /* This is used to get the application class for Tk 4.1 and up */
  523. argv0 = (char*)ckalloc(strlen(className) + 1);
  524. if (!argv0) {
  525. PyErr_NoMemory();
  526. Py_DECREF(v);
  527. return NULL;
  528. }
  529. strcpy(argv0, className);
  530. if (Py_ISUPPER(Py_CHARMASK(argv0[0])))
  531. argv0[0] = Py_TOLOWER(Py_CHARMASK(argv0[0]));
  532. Tcl_SetVar(v->interp, "argv0", argv0, TCL_GLOBAL_ONLY);
  533. ckfree(argv0);
  534. if (! wantTk) {
  535. Tcl_SetVar(v->interp,
  536. "_tkinter_skip_tk_init", "1", TCL_GLOBAL_ONLY);
  537. }
  538. #ifdef TKINTER_PROTECT_LOADTK
  539. else if (tk_load_failed) {
  540. Tcl_SetVar(v->interp,
  541. "_tkinter_tk_failed", "1", TCL_GLOBAL_ONLY);
  542. }
  543. #endif
  544. /* some initial arguments need to be in argv */
  545. if (sync || use) {
  546. char *args;
  547. int len = 0;
  548. if (sync)
  549. len += sizeof "-sync";
  550. if (use)
  551. len += strlen(use) + sizeof "-use ";
  552. args = (char*)ckalloc(len);
  553. if (!args) {
  554. PyErr_NoMemory();
  555. Py_DECREF(v);
  556. return NULL;
  557. }
  558. args[0] = '\0';
  559. if (sync)
  560. strcat(args, "-sync");
  561. if (use) {
  562. if (sync)
  563. strcat(args, " ");
  564. strcat(args, "-use ");
  565. strcat(args, use);
  566. }
  567. Tcl_SetVar(v->interp, "argv", args, TCL_GLOBAL_ONLY);
  568. ckfree(args);
  569. }
  570. if (Tcl_AppInit(v->interp) != TCL_OK) {
  571. PyObject *result = Tkinter_Error((PyObject *)v);
  572. #ifdef TKINTER_PROTECT_LOADTK
  573. if (wantTk) {
  574. const char *_tkinter_tk_failed;
  575. _tkinter_tk_failed = Tcl_GetVar(v->interp,
  576. "_tkinter_tk_failed", TCL_GLOBAL_ONLY);
  577. if ( _tkinter_tk_failed != NULL &&
  578. strcmp(_tkinter_tk_failed, "1") == 0) {
  579. tk_load_failed = 1;
  580. }
  581. }
  582. #endif
  583. Py_DECREF((PyObject *)v);
  584. return (TkappObject *)result;
  585. }
  586. EnableEventHook();
  587. return v;
  588. }
  589. #ifdef WITH_THREAD
  590. static void
  591. Tkapp_ThreadSend(TkappObject *self, Tcl_Event *ev,
  592. Tcl_Condition *cond, Tcl_Mutex *mutex)
  593. {
  594. Py_BEGIN_ALLOW_THREADS;
  595. Tcl_MutexLock(mutex);
  596. Tcl_ThreadQueueEvent(self->thread_id, ev, TCL_QUEUE_TAIL);
  597. Tcl_ThreadAlert(self->thread_id);
  598. Tcl_ConditionWait(cond, mutex, NULL);
  599. Tcl_MutexUnlock(mutex);
  600. Py_END_ALLOW_THREADS
  601. }
  602. #endif
  603. /** Tcl Eval **/
  604. typedef struct {
  605. PyObject_HEAD
  606. Tcl_Obj *value;
  607. PyObject *string; /* This cannot cause cycles. */
  608. } PyTclObject;
  609. static PyTypeObject PyTclObject_Type;
  610. #define PyTclObject_Check(v) ((v)->ob_type == &PyTclObject_Type)
  611. static PyObject *
  612. newPyTclObject(Tcl_Obj *arg)
  613. {
  614. PyTclObject *self;
  615. self = PyObject_New(PyTclObject, &PyTclObject_Type);
  616. if (self == NULL)
  617. return NULL;
  618. Tcl_IncrRefCount(arg);
  619. self->value = arg;
  620. self->string = NULL;
  621. return (PyObject*)self;
  622. }
  623. static void
  624. PyTclObject_dealloc(PyTclObject *self)
  625. {
  626. Tcl_DecrRefCount(self->value);
  627. Py_XDECREF(self->string);
  628. PyObject_Del(self);
  629. }
  630. static char*
  631. PyTclObject_TclString(PyObject *self)
  632. {
  633. return Tcl_GetString(((PyTclObject*)self)->value);
  634. }
  635. /* Like _str, but create Unicode if necessary. */
  636. PyDoc_STRVAR(PyTclObject_string__doc__,
  637. "the string representation of this object, either as str or bytes");
  638. static PyObject *
  639. PyTclObject_string(PyTclObject *self, void *ignored)
  640. {
  641. char *s;
  642. int len;
  643. if (!self->string) {
  644. s = Tcl_GetStringFromObj(self->value, &len);
  645. self->string = PyUnicode_FromStringAndSize(s, len);
  646. if (!self->string)
  647. return NULL;
  648. }
  649. Py_INCREF(self->string);
  650. return self->string;
  651. }
  652. static PyObject *
  653. PyTclObject_str(PyTclObject *self, void *ignored)
  654. {
  655. char *s;
  656. int len;
  657. if (self->string && PyUnicode_Check(self->string)) {
  658. Py_INCREF(self->string);
  659. return self->string;
  660. }
  661. /* XXX Could chache result if it is non-ASCII. */
  662. s = Tcl_GetStringFromObj(self->value, &len);
  663. return PyUnicode_DecodeUTF8(s, len, "strict");
  664. }
  665. static PyObject *
  666. PyTclObject_repr(PyTclObject *self)
  667. {
  668. return PyUnicode_FromFormat("<%s object at %p>",
  669. self->value->typePtr->name, self->value);
  670. }
  671. #define TEST_COND(cond) ((cond) ? Py_True : Py_False)
  672. static PyObject *
  673. PyTclObject_richcompare(PyObject *self, PyObject *other, int op)
  674. {
  675. int result;
  676. PyObject *v;
  677. /* neither argument should be NULL, unless something's gone wrong */
  678. if (self == NULL || other == NULL) {
  679. PyErr_BadInternalCall();
  680. return NULL;
  681. }
  682. /* both arguments should be instances of PyTclObject */
  683. if (!PyTclObject_Check(self) || !PyTclObject_Check(other)) {
  684. v = Py_NotImplemented;
  685. goto finished;
  686. }
  687. if (self == other)
  688. /* fast path when self and other are identical */
  689. result = 0;
  690. else
  691. result = strcmp(Tcl_GetString(((PyTclObject *)self)->value),
  692. Tcl_GetString(((PyTclObject *)other)->value));
  693. /* Convert return value to a Boolean */
  694. switch (op) {
  695. case Py_EQ:
  696. v = TEST_COND(result == 0);
  697. break;
  698. case Py_NE:
  699. v = TEST_COND(result != 0);
  700. break;
  701. case Py_LE:
  702. v = TEST_COND(result <= 0);
  703. break;
  704. case Py_GE:
  705. v = TEST_COND(result >= 0);
  706. break;
  707. case Py_LT:
  708. v = TEST_COND(result < 0);
  709. break;
  710. case Py_GT:
  711. v = TEST_COND(result > 0);
  712. break;
  713. default:
  714. PyErr_BadArgument();
  715. return NULL;
  716. }
  717. finished:
  718. Py_INCREF(v);
  719. return v;
  720. }
  721. PyDoc_STRVAR(get_typename__doc__, "name of the Tcl type");
  722. static PyObject*
  723. get_typename(PyTclObject* obj, void* ignored)
  724. {
  725. return PyUnicode_FromString(obj->value->typePtr->name);
  726. }
  727. static PyGetSetDef PyTclObject_getsetlist[] = {
  728. {"typename", (getter)get_typename, NULL, get_typename__doc__},
  729. {"string", (getter)PyTclObject_string, NULL,
  730. PyTclObject_string__doc__},
  731. {0},
  732. };
  733. static PyTypeObject PyTclObject_Type = {
  734. PyVarObject_HEAD_INIT(NULL, 0)
  735. "_tkinter.Tcl_Obj", /*tp_name*/
  736. sizeof(PyTclObject), /*tp_basicsize*/
  737. 0, /*tp_itemsize*/
  738. /* methods */
  739. (destructor)PyTclObject_dealloc,/*tp_dealloc*/
  740. 0, /*tp_print*/
  741. 0, /*tp_getattr*/
  742. 0, /*tp_setattr*/
  743. 0, /*tp_reserved*/
  744. (reprfunc)PyTclObject_repr, /*tp_repr*/
  745. 0, /*tp_as_number*/
  746. 0, /*tp_as_sequence*/
  747. 0, /*tp_as_mapping*/
  748. 0, /*tp_hash*/
  749. 0, /*tp_call*/
  750. (reprfunc)PyTclObject_str, /*tp_str*/
  751. PyObject_GenericGetAttr, /*tp_getattro*/
  752. 0, /*tp_setattro*/
  753. 0, /*tp_as_buffer*/
  754. Py_TPFLAGS_DEFAULT, /*tp_flags*/
  755. 0, /*tp_doc*/
  756. 0, /*tp_traverse*/
  757. 0, /*tp_clear*/
  758. PyTclObject_richcompare, /*tp_richcompare*/
  759. 0, /*tp_weaklistoffset*/
  760. 0, /*tp_iter*/
  761. 0, /*tp_iternext*/
  762. 0, /*tp_methods*/
  763. 0, /*tp_members*/
  764. PyTclObject_getsetlist, /*tp_getset*/
  765. 0, /*tp_base*/
  766. 0, /*tp_dict*/
  767. 0, /*tp_descr_get*/
  768. 0, /*tp_descr_set*/
  769. 0, /*tp_dictoffset*/
  770. 0, /*tp_init*/
  771. 0, /*tp_alloc*/
  772. 0, /*tp_new*/
  773. 0, /*tp_free*/
  774. 0, /*tp_is_gc*/
  775. };
  776. static Tcl_Obj*
  777. AsObj(PyObject *value)
  778. {
  779. Tcl_Obj *result;
  780. long longVal;
  781. int overflow;
  782. if (PyBytes_Check(value))
  783. return Tcl_NewStringObj(PyBytes_AS_STRING(value),
  784. PyBytes_GET_SIZE(value));
  785. else if (PyBool_Check(value))
  786. return Tcl_NewBooleanObj(PyObject_IsTrue(value));
  787. else if (PyLong_CheckExact(value) &&
  788. ((longVal = PyLong_AsLongAndOverflow(value, &overflow)),
  789. !overflow)) {
  790. /* If there is an overflow in the long conversion,
  791. fall through to default object handling. */
  792. return Tcl_NewLongObj(longVal);
  793. }
  794. else if (PyFloat_Check(value))
  795. return Tcl_NewDoubleObj(PyFloat_AS_DOUBLE(value));
  796. else if (PyTuple_Check(value)) {
  797. Tcl_Obj **argv = (Tcl_Obj**)
  798. ckalloc(PyTuple_Size(value)*sizeof(Tcl_Obj*));
  799. int i;
  800. if(!argv)
  801. return 0;
  802. for(i=0;i<PyTuple_Size(value);i++)
  803. argv[i] = AsObj(PyTuple_GetItem(value,i));
  804. result = Tcl_NewListObj(PyTuple_Size(value), argv);
  805. ckfree(FREECAST argv);
  806. return result;
  807. }
  808. else if (PyUnicode_Check(value)) {
  809. void *inbuf;
  810. Py_ssize_t size;
  811. int kind;
  812. Tcl_UniChar *outbuf = NULL;
  813. Py_ssize_t i;
  814. size_t allocsize;
  815. if (PyUnicode_READY(value) == -1)
  816. return NULL;
  817. inbuf = PyUnicode_DATA(value);
  818. size = PyUnicode_GET_LENGTH(value);
  819. kind = PyUnicode_KIND(value);
  820. allocsize = ((size_t)size) * sizeof(Tcl_UniChar);
  821. outbuf = (Tcl_UniChar*)ckalloc(allocsize);
  822. /* Else overflow occurred, and we take the next exit */
  823. if (!outbuf) {
  824. PyErr_NoMemory();
  825. return NULL;
  826. }
  827. for (i = 0; i < size; i++) {
  828. Py_UCS4 ch = PyUnicode_READ(kind, inbuf, i);
  829. /* We cannot test for sizeof(Tcl_UniChar) directly,
  830. so we test for UTF-8 size instead. */
  831. #if TCL_UTF_MAX == 3
  832. if (ch >= 0x10000) {
  833. /* Tcl doesn't do UTF-16, yet. */
  834. PyErr_Format(PyExc_ValueError,
  835. "character U+%x is above the range "
  836. "(U+0000-U+FFFF) allowed by Tcl",
  837. ch);
  838. ckfree(FREECAST outbuf);
  839. return NULL;
  840. #endif
  841. }
  842. outbuf[i] = ch;
  843. }
  844. result = Tcl_NewUnicodeObj(outbuf, size);
  845. ckfree(FREECAST outbuf);
  846. return result;
  847. }
  848. else if(PyTclObject_Check(value)) {
  849. Tcl_Obj *v = ((PyTclObject*)value)->value;
  850. Tcl_IncrRefCount(v);
  851. return v;
  852. }
  853. else {
  854. PyObject *v = PyObject_Str(value);
  855. if (!v)
  856. return 0;
  857. result = AsObj(v);
  858. Py_DECREF(v);
  859. return result;
  860. }
  861. }
  862. static PyObject*
  863. FromObj(PyObject* tkapp, Tcl_Obj *value)
  864. {
  865. PyObject *result = NULL;
  866. TkappObject *app = (TkappObject*)tkapp;
  867. if (value->typePtr == NULL) {
  868. return PyUnicode_FromStringAndSize(value->bytes,
  869. value->length);
  870. }
  871. if (value->typePtr == app->BooleanType) {
  872. result = value->internalRep.longValue ? Py_True : Py_False;
  873. Py_INCREF(result);
  874. return result;
  875. }
  876. if (value->typePtr == app->ByteArrayType) {
  877. int size;
  878. char *data = (char*)Tcl_GetByteArrayFromObj(value, &size);
  879. return PyBytes_FromStringAndSize(data, size);
  880. }
  881. if (value->typePtr == app->DoubleType) {
  882. return PyFloat_FromDouble(value->internalRep.doubleValue);
  883. }
  884. if (value->typePtr == app->IntType) {
  885. return PyLong_FromLong(value->internalRep.longValue);
  886. }
  887. if (value->typePtr == app->ListType) {
  888. int size;
  889. int i, status;
  890. PyObject *elem;
  891. Tcl_Obj *tcl_elem;
  892. status = Tcl_ListObjLength(Tkapp_Interp(tkapp), value, &size);
  893. if (status == TCL_ERROR)
  894. return Tkinter_Error(tkapp);
  895. result = PyTuple_New(size);
  896. if (!result)
  897. return NULL;
  898. for (i = 0; i < size; i++) {
  899. status = Tcl_ListObjIndex(Tkapp_Interp(tkapp),
  900. value, i, &tcl_elem);
  901. if (status == TCL_ERROR) {
  902. Py_DECREF(result);
  903. return Tkinter_Error(tkapp);
  904. }
  905. elem = FromObj(tkapp, tcl_elem);
  906. if (!elem) {
  907. Py_DECREF(result);
  908. return NULL;
  909. }
  910. PyTuple_SetItem(result, i, elem);
  911. }
  912. return result;
  913. }
  914. if (value->typePtr == app->ProcBodyType) {
  915. /* fall through: return tcl object. */
  916. }
  917. if (value->typePtr == app->StringType) {
  918. #if TCL_UTF_MAX==3
  919. return PyUnicode_FromKindAndData(
  920. PyUnicode_2BYTE_KIND, Tcl_GetUnicode(value),
  921. Tcl_GetCharLength(value));
  922. #else
  923. return PyUnicode_FromKindAndData(
  924. PyUnicode_4BYTE_KIND, Tcl_GetUnicode(value),
  925. Tcl_GetCharLength(value));
  926. #endif
  927. }
  928. return newPyTclObject(value);
  929. }
  930. #ifdef WITH_THREAD
  931. /* This mutex synchronizes inter-thread command calls. */
  932. TCL_DECLARE_MUTEX(call_mutex)
  933. typedef struct Tkapp_CallEvent {
  934. Tcl_Event ev; /* Must be first */
  935. TkappObject *self;
  936. PyObject *args;
  937. int flags;
  938. PyObject **res;
  939. PyObject **exc_type, **exc_value, **exc_tb;
  940. Tcl_Condition *done;
  941. } Tkapp_CallEvent;
  942. #endif
  943. void
  944. Tkapp_CallDeallocArgs(Tcl_Obj** objv, Tcl_Obj** objStore, int objc)
  945. {
  946. int i;
  947. for (i = 0; i < objc; i++)
  948. Tcl_DecrRefCount(objv[i]);
  949. if (objv != objStore)
  950. ckfree(FREECAST objv);
  951. }
  952. /* Convert Python objects to Tcl objects. This must happen in the
  953. interpreter thread, which may or may not be the calling thread. */
  954. static Tcl_Obj**
  955. Tkapp_CallArgs(PyObject *args, Tcl_Obj** objStore, int *pobjc)
  956. {
  957. Tcl_Obj **objv = objStore;
  958. int objc = 0, i;
  959. if (args == NULL)
  960. /* do nothing */;
  961. else if (!PyTuple_Check(args)) {
  962. objv[0] = AsObj(args);
  963. if (objv[0] == 0)
  964. goto finally;
  965. objc = 1;
  966. Tcl_IncrRefCount(objv[0]);
  967. }
  968. else {
  969. objc = PyTuple_Size(args);
  970. if (objc > ARGSZ) {
  971. objv = (Tcl_Obj **)ckalloc(objc * sizeof(char *));
  972. if (objv == NULL) {
  973. PyErr_NoMemory();
  974. objc = 0;
  975. goto finally;
  976. }
  977. }
  978. for (i = 0; i < objc; i++) {
  979. PyObject *v = PyTuple_GetItem(args, i);
  980. if (v == Py_None) {
  981. objc = i;
  982. break;
  983. }
  984. objv[i] = AsObj(v);
  985. if (!objv[i]) {
  986. /* Reset objc, so it attempts to clear
  987. objects only up to i. */
  988. objc = i;
  989. goto finally;
  990. }
  991. Tcl_IncrRefCount(objv[i]);
  992. }
  993. }
  994. *pobjc = objc;
  995. return objv;
  996. finally:
  997. Tkapp_CallDeallocArgs(objv, objStore, objc);
  998. return NULL;
  999. }
  1000. /* Convert the results of a command call into a Python objects. */
  1001. static PyObject*
  1002. Tkapp_CallResult(TkappObject *self)
  1003. {
  1004. PyObject *res = NULL;
  1005. if(self->wantobjects) {
  1006. Tcl_Obj *value = Tcl_GetObjResult(self->interp);
  1007. /* Not sure whether the IncrRef is necessary, but something
  1008. may overwrite the interpreter result while we are
  1009. converting it. */
  1010. Tcl_IncrRefCount(value);
  1011. res = FromObj((PyObject*)self, value);
  1012. Tcl_DecrRefCount(value);
  1013. } else {
  1014. const char *s = Tcl_GetStringResult(self->interp);
  1015. const char *p = s;
  1016. res = PyUnicode_FromStringAndSize(s, (int)(p-s));
  1017. }
  1018. return res;
  1019. }
  1020. #ifdef WITH_THREAD
  1021. /* Tkapp_CallProc is the event procedure that is executed in the context of
  1022. the Tcl interpreter thread. Initially, it holds the Tcl lock, and doesn't
  1023. hold the Python lock. */
  1024. static int
  1025. Tkapp_CallProc(Tkapp_CallEvent *e, int flags)
  1026. {
  1027. Tcl_Obj *objStore[ARGSZ];
  1028. Tcl_Obj **objv;
  1029. int objc;
  1030. int i;
  1031. ENTER_PYTHON
  1032. objv = Tkapp_CallArgs(e->args, objStore, &objc);
  1033. if (!objv) {
  1034. PyErr_Fetch(e->exc_type, e->exc_value, e->exc_tb);
  1035. *(e->res) = NULL;
  1036. }
  1037. LEAVE_PYTHON
  1038. if (!objv)
  1039. goto done;
  1040. i = Tcl_EvalObjv(e->self->interp, objc, objv, e->flags);
  1041. ENTER_PYTHON
  1042. if (i == TCL_ERROR) {
  1043. *(e->res) = NULL;
  1044. *(e->exc_type) = NULL;
  1045. *(e->exc_tb) = NULL;
  1046. *(e->exc_value) = PyObject_CallFunction(
  1047. Tkinter_TclError, "s",
  1048. Tcl_GetStringResult(e->self->interp));
  1049. }
  1050. else {
  1051. *(e->res) = Tkapp_CallResult(e->self);
  1052. }
  1053. LEAVE_PYTHON
  1054. Tkapp_CallDeallocArgs(objv, objStore, objc);
  1055. done:
  1056. /* Wake up calling thread. */
  1057. Tcl_MutexLock(&call_mutex);
  1058. Tcl_ConditionNotify(e->done);
  1059. Tcl_MutexUnlock(&call_mutex);
  1060. return 1;
  1061. }
  1062. #endif
  1063. /* This is the main entry point for calling a Tcl command.
  1064. It supports three cases, with regard to threading:
  1065. 1. Tcl is not threaded: Must have the Tcl lock, then can invoke command in
  1066. the context of the calling thread.
  1067. 2. Tcl is threaded, caller of the command is in the interpreter thread:
  1068. Execute the command in the calling thread. Since the Tcl lock will
  1069. not be used, we can merge that with case 1.
  1070. 3. Tcl is threaded, caller is in a different thread: Must queue an event to
  1071. the interpreter thread. Allocation of Tcl objects needs to occur in the
  1072. interpreter thread, so we ship the PyObject* args to the target thread,
  1073. and perform processing there. */
  1074. static PyObject *
  1075. Tkapp_Call(PyObject *selfptr, PyObject *args)
  1076. {
  1077. Tcl_Obj *objStore[ARGSZ];
  1078. Tcl_Obj **objv = NULL;
  1079. int objc, i;
  1080. PyObject *res = NULL;
  1081. TkappObject *self = (TkappObject*)selfptr;
  1082. int flags = TCL_EVAL_DIRECT | TCL_EVAL_GLOBAL;
  1083. /* If args is a single tuple, replace with contents of tuple */
  1084. if (1 == PyTuple_Size(args)){
  1085. PyObject* item = PyTuple_GetItem(args, 0);
  1086. if (PyTuple_Check(item))
  1087. args = item;
  1088. }
  1089. #ifdef WITH_THREAD
  1090. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1091. /* We cannot call the command directly. Instead, we must
  1092. marshal the parameters to the interpreter thread. */
  1093. Tkapp_CallEvent *ev;
  1094. Tcl_Condition cond = NULL;
  1095. PyObject *exc_type, *exc_value, *exc_tb;
  1096. if (!WaitForMainloop(self))
  1097. return NULL;
  1098. ev = (Tkapp_CallEvent*)ckalloc(sizeof(Tkapp_CallEvent));
  1099. ev->ev.proc = (Tcl_EventProc*)Tkapp_CallProc;
  1100. ev->self = self;
  1101. ev->args = args;
  1102. ev->res = &res;
  1103. ev->exc_type = &exc_type;
  1104. ev->exc_value = &exc_value;
  1105. ev->exc_tb = &exc_tb;
  1106. ev->done = &cond;
  1107. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, &call_mutex);
  1108. if (res == NULL) {
  1109. if (exc_type)
  1110. PyErr_Restore(exc_type, exc_value, exc_tb);
  1111. else
  1112. PyErr_SetObject(Tkinter_TclError, exc_value);
  1113. }
  1114. Tcl_ConditionFinalize(&cond);
  1115. }
  1116. else
  1117. #endif
  1118. {
  1119. objv = Tkapp_CallArgs(args, objStore, &objc);
  1120. if (!objv)
  1121. return NULL;
  1122. ENTER_TCL
  1123. i = Tcl_EvalObjv(self->interp, objc, objv, flags);
  1124. ENTER_OVERLAP
  1125. if (i == TCL_ERROR)
  1126. Tkinter_Error(selfptr);
  1127. else
  1128. res = Tkapp_CallResult(self);
  1129. LEAVE_OVERLAP_TCL
  1130. Tkapp_CallDeallocArgs(objv, objStore, objc);
  1131. }
  1132. return res;
  1133. }
  1134. static PyObject *
  1135. Tkapp_GlobalCall(PyObject *self, PyObject *args)
  1136. {
  1137. /* Could do the same here as for Tkapp_Call(), but this is not used
  1138. much, so I can't be bothered. Unfortunately Tcl doesn't export a
  1139. way for the user to do what all its Global* variants do (save and
  1140. reset the scope pointer, call the local version, restore the saved
  1141. scope pointer). */
  1142. char *cmd;
  1143. PyObject *res = NULL;
  1144. if (PyErr_WarnEx(PyExc_DeprecationWarning,
  1145. "globalcall is deprecated and will be removed in 3.4",
  1146. 1) < 0)
  1147. return 0;
  1148. CHECK_TCL_APPARTMENT;
  1149. cmd = Merge(args);
  1150. if (cmd) {
  1151. int err;
  1152. ENTER_TCL
  1153. err = Tcl_GlobalEval(Tkapp_Interp(self), cmd);
  1154. ENTER_OVERLAP
  1155. if (err == TCL_ERROR)
  1156. res = Tkinter_Error(self);
  1157. else
  1158. res = PyUnicode_FromString(Tkapp_Result(self));
  1159. LEAVE_OVERLAP_TCL
  1160. ckfree(cmd);
  1161. }
  1162. return res;
  1163. }
  1164. static PyObject *
  1165. Tkapp_Eval(PyObject *self, PyObject *args)
  1166. {
  1167. char *script;
  1168. PyObject *res = NULL;
  1169. int err;
  1170. if (!PyArg_ParseTuple(args, "s:eval", &script))
  1171. return NULL;
  1172. CHECK_TCL_APPARTMENT;
  1173. ENTER_TCL
  1174. err = Tcl_Eval(Tkapp_Interp(self), script);
  1175. ENTER_OVERLAP
  1176. if (err == TCL_ERROR)
  1177. res = Tkinter_Error(self);
  1178. else
  1179. res = PyUnicode_FromString(Tkapp_Result(self));
  1180. LEAVE_OVERLAP_TCL
  1181. return res;
  1182. }
  1183. static PyObject *
  1184. Tkapp_GlobalEval(PyObject *self, PyObject *args)
  1185. {
  1186. char *script;
  1187. PyObject *res = NULL;
  1188. int err;
  1189. if (PyErr_WarnEx(PyExc_DeprecationWarning,
  1190. "globaleval is deprecated and will be removed in 3.4",
  1191. 1) < 0)
  1192. return 0;
  1193. if (!PyArg_ParseTuple(args, "s:globaleval", &script))
  1194. return NULL;
  1195. CHECK_TCL_APPARTMENT;
  1196. ENTER_TCL
  1197. err = Tcl_GlobalEval(Tkapp_Interp(self), script);
  1198. ENTER_OVERLAP
  1199. if (err == TCL_ERROR)
  1200. res = Tkinter_Error(self);
  1201. else
  1202. res = PyUnicode_FromString(Tkapp_Result(self));
  1203. LEAVE_OVERLAP_TCL
  1204. return res;
  1205. }
  1206. static PyObject *
  1207. Tkapp_EvalFile(PyObject *self, PyObject *args)
  1208. {
  1209. char *fileName;
  1210. PyObject *res = NULL;
  1211. int err;
  1212. if (!PyArg_ParseTuple(args, "s:evalfile", &fileName))
  1213. return NULL;
  1214. CHECK_TCL_APPARTMENT;
  1215. ENTER_TCL
  1216. err = Tcl_EvalFile(Tkapp_Interp(self), fileName);
  1217. ENTER_OVERLAP
  1218. if (err == TCL_ERROR)
  1219. res = Tkinter_Error(self);
  1220. else
  1221. res = PyUnicode_FromString(Tkapp_Result(self));
  1222. LEAVE_OVERLAP_TCL
  1223. return res;
  1224. }
  1225. static PyObject *
  1226. Tkapp_Record(PyObject *self, PyObject *args)
  1227. {
  1228. char *script;
  1229. PyObject *res = NULL;
  1230. int err;
  1231. if (!PyArg_ParseTuple(args, "s", &script))
  1232. return NULL;
  1233. CHECK_TCL_APPARTMENT;
  1234. ENTER_TCL
  1235. err = Tcl_RecordAndEval(Tkapp_Interp(self), script, TCL_NO_EVAL);
  1236. ENTER_OVERLAP
  1237. if (err == TCL_ERROR)
  1238. res = Tkinter_Error(self);
  1239. else
  1240. res = PyUnicode_FromString(Tkapp_Result(self));
  1241. LEAVE_OVERLAP_TCL
  1242. return res;
  1243. }
  1244. static PyObject *
  1245. Tkapp_AddErrorInfo(PyObject *self, PyObject *args)
  1246. {
  1247. char *msg;
  1248. if (!PyArg_ParseTuple(args, "s:adderrorinfo", &msg))
  1249. return NULL;
  1250. CHECK_TCL_APPARTMENT;
  1251. ENTER_TCL
  1252. Tcl_AddErrorInfo(Tkapp_Interp(self), msg);
  1253. LEAVE_TCL
  1254. Py_INCREF(Py_None);
  1255. return Py_None;
  1256. }
  1257. /** Tcl Variable **/
  1258. typedef PyObject* (*EventFunc)(PyObject*, PyObject *args, int flags);
  1259. #ifdef WITH_THREAD
  1260. TCL_DECLARE_MUTEX(var_mutex)
  1261. typedef struct VarEvent {
  1262. Tcl_Event ev; /* must be first */
  1263. PyObject *self;
  1264. PyObject *args;
  1265. int flags;
  1266. EventFunc func;
  1267. PyObject **res;
  1268. PyObject **exc_type;
  1269. PyObject **exc_val;
  1270. Tcl_Condition *cond;
  1271. } VarEvent;
  1272. #endif
  1273. static int
  1274. varname_converter(PyObject *in, void *_out)
  1275. {
  1276. char **out = (char**)_out;
  1277. if (PyBytes_Check(in)) {
  1278. *out = PyBytes_AsString(in);
  1279. return 1;
  1280. }
  1281. if (PyUnicode_Check(in)) {
  1282. *out = _PyUnicode_AsString(in);
  1283. return 1;
  1284. }
  1285. if (PyTclObject_Check(in)) {
  1286. *out = PyTclObject_TclString(in);
  1287. return 1;
  1288. }
  1289. /* XXX: Should give diagnostics. */
  1290. return 0;
  1291. }
  1292. #ifdef WITH_THREAD
  1293. static void
  1294. var_perform(VarEvent *ev)
  1295. {
  1296. *(ev->res) = ev->func(ev->self, ev->args, ev->flags);
  1297. if (!*(ev->res)) {
  1298. PyObject *exc, *val, *tb;
  1299. PyErr_Fetch(&exc, &val, &tb);
  1300. PyErr_NormalizeException(&exc, &val, &tb);
  1301. *(ev->exc_type) = exc;
  1302. *(ev->exc_val) = val;
  1303. Py_DECREF(tb);
  1304. }
  1305. }
  1306. static int
  1307. var_proc(VarEvent* ev, int flags)
  1308. {
  1309. ENTER_PYTHON
  1310. var_perform(ev);
  1311. Tcl_MutexLock(&var_mutex);
  1312. Tcl_ConditionNotify(ev->cond);
  1313. Tcl_MutexUnlock(&var_mutex);
  1314. LEAVE_PYTHON
  1315. return 1;
  1316. }
  1317. #endif
  1318. static PyObject*
  1319. var_invoke(EventFunc func, PyObject *selfptr, PyObject *args, int flags)
  1320. {
  1321. #ifdef WITH_THREAD
  1322. TkappObject *self = (TkappObject*)selfptr;
  1323. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1324. TkappObject *self = (TkappObject*)selfptr;
  1325. VarEvent *ev;
  1326. PyObject *res, *exc_type, *exc_val;
  1327. Tcl_Condition cond = NULL;
  1328. /* The current thread is not the interpreter thread. Marshal
  1329. the call to the interpreter thread, then wait for
  1330. completion. */
  1331. if (!WaitForMainloop(self))
  1332. return NULL;
  1333. ev = (VarEvent*)ckalloc(sizeof(VarEvent));
  1334. ev->self = selfptr;
  1335. ev->args = args;
  1336. ev->flags = flags;
  1337. ev->func = func;
  1338. ev->res = &res;
  1339. ev->exc_type = &exc_type;
  1340. ev->exc_val = &exc_val;
  1341. ev->cond = &cond;
  1342. ev->ev.proc = (Tcl_EventProc*)var_proc;
  1343. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, &var_mutex);
  1344. Tcl_ConditionFinalize(&cond);
  1345. if (!res) {
  1346. PyErr_SetObject(exc_type, exc_val);
  1347. Py_DECREF(exc_type);
  1348. Py_DECREF(exc_val);
  1349. return NULL;
  1350. }
  1351. return res;
  1352. }
  1353. #endif
  1354. /* Tcl is not threaded, or this is the interpreter thread. */
  1355. return func(selfptr, args, flags);
  1356. }
  1357. static PyObject *
  1358. SetVar(PyObject *self, PyObject *args, int flags)
  1359. {
  1360. char *name1, *name2;
  1361. PyObject *newValue;
  1362. PyObject *res = NULL;
  1363. Tcl_Obj *newval, *ok;
  1364. if (PyArg_ParseTuple(args, "O&O:setvar",
  1365. varname_converter, &name1, &newValue)) {
  1366. /* XXX Acquire tcl lock??? */
  1367. newval = AsObj(newValue);
  1368. if (newval == NULL)
  1369. return NULL;
  1370. ENTER_TCL
  1371. ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, NULL,
  1372. newval, flags);
  1373. ENTER_OVERLAP
  1374. if (!ok)
  1375. Tkinter_Error(self);
  1376. else {
  1377. res = Py_None;
  1378. Py_INCREF(res);
  1379. }
  1380. LEAVE_OVERLAP_TCL
  1381. }
  1382. else {
  1383. PyErr_Clear();
  1384. if (PyArg_ParseTuple(args, "ssO:setvar",
  1385. &name1, &name2, &newValue)) {
  1386. /* XXX must hold tcl lock already??? */
  1387. newval = AsObj(newValue);
  1388. ENTER_TCL
  1389. ok = Tcl_SetVar2Ex(Tkapp_Interp(self), name1, name2, newval, flags);
  1390. ENTER_OVERLAP
  1391. if (!ok)
  1392. Tkinter_Error(self);
  1393. else {
  1394. res = Py_None;
  1395. Py_INCREF(res);
  1396. }
  1397. LEAVE_OVERLAP_TCL
  1398. }
  1399. else {
  1400. return NULL;
  1401. }
  1402. }
  1403. return res;
  1404. }
  1405. static PyObject *
  1406. Tkapp_SetVar(PyObject *self, PyObject *args)
  1407. {
  1408. return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG);
  1409. }
  1410. static PyObject *
  1411. Tkapp_GlobalSetVar(PyObject *self, PyObject *args)
  1412. {
  1413. return var_invoke(SetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
  1414. }
  1415. static PyObject *
  1416. GetVar(PyObject *self, PyObject *args, int flags)
  1417. {
  1418. char *name1, *name2=NULL;
  1419. PyObject *res = NULL;
  1420. Tcl_Obj *tres;
  1421. if (!PyArg_ParseTuple(args, "O&|s:getvar",
  1422. varname_converter, &name1, &name2))
  1423. return NULL;
  1424. ENTER_TCL
  1425. tres = Tcl_GetVar2Ex(Tkapp_Interp(self), name1, name2, flags);
  1426. ENTER_OVERLAP
  1427. if (tres == NULL) {
  1428. PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self)));
  1429. } else {
  1430. if (((TkappObject*)self)->wantobjects) {
  1431. res = FromObj(self, tres);
  1432. }
  1433. else {
  1434. res = PyUnicode_FromString(Tcl_GetString(tres));
  1435. }
  1436. }
  1437. LEAVE_OVERLAP_TCL
  1438. return res;
  1439. }
  1440. static PyObject *
  1441. Tkapp_GetVar(PyObject *self, PyObject *args)
  1442. {
  1443. return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG);
  1444. }
  1445. static PyObject *
  1446. Tkapp_GlobalGetVar(PyObject *self, PyObject *args)
  1447. {
  1448. return var_invoke(GetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
  1449. }
  1450. static PyObject *
  1451. UnsetVar(PyObject *self, PyObject *args, int flags)
  1452. {
  1453. char *name1, *name2=NULL;
  1454. int code;
  1455. PyObject *res = NULL;
  1456. if (!PyArg_ParseTuple(args, "s|s:unsetvar", &name1, &name2))
  1457. return NULL;
  1458. ENTER_TCL
  1459. code = Tcl_UnsetVar2(Tkapp_Interp(self), name1, name2, flags);
  1460. ENTER_OVERLAP
  1461. if (code == TCL_ERROR)
  1462. res = Tkinter_Error(self);
  1463. else {
  1464. Py_INCREF(Py_None);
  1465. res = Py_None;
  1466. }
  1467. LEAVE_OVERLAP_TCL
  1468. return res;
  1469. }
  1470. static PyObject *
  1471. Tkapp_UnsetVar(PyObject *self, PyObject *args)
  1472. {
  1473. return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG);
  1474. }
  1475. static PyObject *
  1476. Tkapp_GlobalUnsetVar(PyObject *self, PyObject *args)
  1477. {
  1478. return var_invoke(UnsetVar, self, args, TCL_LEAVE_ERR_MSG | TCL_GLOBAL_ONLY);
  1479. }
  1480. /** Tcl to Python **/
  1481. static PyObject *
  1482. Tkapp_GetInt(PyObject *self, PyObject *args)
  1483. {
  1484. char *s;
  1485. int v;
  1486. if (PyTuple_Size(args) == 1) {
  1487. PyObject* o = PyTuple_GetItem(args, 0);
  1488. if (PyLong_Check(o)) {
  1489. Py_INCREF(o);
  1490. return o;
  1491. }
  1492. }
  1493. if (!PyArg_ParseTuple(args, "s:getint", &s))
  1494. return NULL;
  1495. if (Tcl_GetInt(Tkapp_Interp(self), s, &v) == TCL_ERROR)
  1496. return Tkinter_Error(self);
  1497. return Py_BuildValue("i", v);
  1498. }
  1499. static PyObject *
  1500. Tkapp_GetDouble(PyObject *self, PyObject *args)
  1501. {
  1502. char *s;
  1503. double v;
  1504. if (PyTuple_Size(args) == 1) {
  1505. PyObject *o = PyTuple_GetItem(args, 0);
  1506. if (PyFloat_Check(o)) {
  1507. Py_INCREF(o);
  1508. return o;
  1509. }
  1510. }
  1511. if (!PyArg_ParseTuple(args, "s:getdouble", &s))
  1512. return NULL;
  1513. if (Tcl_GetDouble(Tkapp_Interp(self), s, &v) == TCL_ERROR)
  1514. return Tkinter_Error(self);
  1515. return Py_BuildValue("d", v);
  1516. }
  1517. static PyObject *
  1518. Tkapp_GetBoolean(PyObject *self, PyObject *args)
  1519. {
  1520. char *s;
  1521. int v;
  1522. if (PyTuple_Size(args) == 1) {
  1523. PyObject *o = PyTuple_GetItem(args, 0);
  1524. if (PyLong_Check(o)) {
  1525. Py_INCREF(o);
  1526. return o;
  1527. }
  1528. }
  1529. if (!PyArg_ParseTuple(args, "s:getboolean", &s))
  1530. return NULL;
  1531. if (Tcl_GetBoolean(Tkapp_Interp(self), s, &v) == TCL_ERROR)
  1532. return Tkinter_Error(self);
  1533. return PyBool_FromLong(v);
  1534. }
  1535. static PyObject *
  1536. Tkapp_ExprString(PyObject *self, PyObject *args)
  1537. {
  1538. char *s;
  1539. PyObject *res = NULL;
  1540. int retval;
  1541. if (!PyArg_ParseTuple(args, "s:exprstring", &s))
  1542. return NULL;
  1543. CHECK_TCL_APPARTMENT;
  1544. ENTER_TCL
  1545. retval = Tcl_ExprString(Tkapp_Interp(self), s);
  1546. ENTER_OVERLAP
  1547. if (retval == TCL_ERROR)
  1548. res = Tkinter_Error(self);
  1549. else
  1550. res = Py_BuildValue("s", Tkapp_Result(self));
  1551. LEAVE_OVERLAP_TCL
  1552. return res;
  1553. }
  1554. static PyObject *
  1555. Tkapp_ExprLong(PyObject *self, PyObject *args)
  1556. {
  1557. char *s;
  1558. PyObject *res = NULL;
  1559. int retval;
  1560. long v;
  1561. if (!PyArg_ParseTuple(args, "s:exprlong", &s))
  1562. return NULL;
  1563. CHECK_TCL_APPARTMENT;
  1564. ENTER_TCL
  1565. retval = Tcl_ExprLong(Tkapp_Interp(self), s, &v);
  1566. ENTER_OVERLAP
  1567. if (retval == TCL_ERROR)
  1568. res = Tkinter_Error(self);
  1569. else
  1570. res = Py_BuildValue("l", v);
  1571. LEAVE_OVERLAP_TCL
  1572. return res;
  1573. }
  1574. static PyObject *
  1575. Tkapp_ExprDouble(PyObject *self, PyObject *args)
  1576. {
  1577. char *s;
  1578. PyObject *res = NULL;
  1579. double v;
  1580. int retval;
  1581. if (!PyArg_ParseTuple(args, "s:exprdouble", &s))
  1582. return NULL;
  1583. CHECK_TCL_APPARTMENT;
  1584. PyFPE_START_PROTECT("Tkapp_ExprDouble", return 0)
  1585. ENTER_TCL
  1586. retval = Tcl_ExprDouble(Tkapp_Interp(self), s, &v);
  1587. ENTER_OVERLAP
  1588. PyFPE_END_PROTECT(retval)
  1589. if (retval == TCL_ERROR)
  1590. res = Tkinter_Error(self);
  1591. else
  1592. res = Py_BuildValue("d", v);
  1593. LEAVE_OVERLAP_TCL
  1594. return res;
  1595. }
  1596. static PyObject *
  1597. Tkapp_ExprBoolean(PyObject *self, PyObject *args)
  1598. {
  1599. char *s;
  1600. PyObject *res = NULL;
  1601. int retval;
  1602. int v;
  1603. if (!PyArg_ParseTuple(args, "s:exprboolean", &s))
  1604. return NULL;
  1605. CHECK_TCL_APPARTMENT;
  1606. ENTER_TCL
  1607. retval = Tcl_ExprBoolean(Tkapp_Interp(self), s, &v);
  1608. ENTER_OVERLAP
  1609. if (retval == TCL_ERROR)
  1610. res = Tkinter_Error(self);
  1611. else
  1612. res = Py_BuildValue("i", v);
  1613. LEAVE_OVERLAP_TCL
  1614. return res;
  1615. }
  1616. static PyObject *
  1617. Tkapp_SplitList(PyObject *self, PyObject *args)
  1618. {
  1619. char *list;
  1620. int argc;
  1621. char **argv;
  1622. PyObject *v;
  1623. int i;
  1624. if (PyTuple_Size(args) == 1) {
  1625. v = PyTuple_GetItem(args, 0);
  1626. if (PyTuple_Check(v)) {
  1627. Py_INCREF(v);
  1628. return v;
  1629. }
  1630. }
  1631. if (!PyArg_ParseTuple(args, "et:splitlist", "utf-8", &list))
  1632. return NULL;
  1633. if (Tcl_SplitList(Tkapp_Interp(self), list,
  1634. &argc, &argv) == TCL_ERROR) {
  1635. PyMem_Free(list);
  1636. return Tkinter_Error(self);
  1637. }
  1638. if (!(v = PyTuple_New(argc)))
  1639. goto finally;
  1640. for (i = 0; i < argc; i++) {
  1641. PyObject *s = PyUnicode_FromString(argv[i]);
  1642. if (!s || PyTuple_SetItem(v, i, s)) {
  1643. Py_DECREF(v);
  1644. v = NULL;
  1645. goto finally;
  1646. }
  1647. }
  1648. finally:
  1649. ckfree(FREECAST argv);
  1650. PyMem_Free(list);
  1651. return v;
  1652. }
  1653. static PyObject *
  1654. Tkapp_Split(PyObject *self, PyObject *args)
  1655. {
  1656. PyObject *v;
  1657. char *list;
  1658. if (PyTuple_Size(args) == 1) {
  1659. PyObject* o = PyTuple_GetItem(args, 0);
  1660. if (PyTuple_Check(o)) {
  1661. o = SplitObj(o);
  1662. return o;
  1663. }
  1664. }
  1665. if (!PyArg_ParseTuple(args, "et:split", "utf-8", &list))
  1666. return NULL;
  1667. v = Split(list);
  1668. PyMem_Free(list);
  1669. return v;
  1670. }
  1671. static PyObject *
  1672. Tkapp_Merge(PyObject *self, PyObject *args)
  1673. {
  1674. char *s;
  1675. PyObject *res = NULL;
  1676. if (PyErr_WarnEx(PyExc_DeprecationWarning,
  1677. "merge is deprecated and will be removed in 3.4",
  1678. 1) < 0)
  1679. return 0;
  1680. s = Merge(args);
  1681. if (s) {
  1682. res = PyUnicode_FromString(s);
  1683. ckfree(s);
  1684. }
  1685. return res;
  1686. }
  1687. /** Tcl Command **/
  1688. /* Client data struct */
  1689. typedef struct {
  1690. PyObject *self;
  1691. PyObject *func;
  1692. } PythonCmd_ClientData;
  1693. static int
  1694. PythonCmd_Error(Tcl_Interp *interp)
  1695. {
  1696. errorInCmd = 1;
  1697. PyErr_Fetch(&excInCmd, &valInCmd, &trbInCmd);
  1698. LEAVE_PYTHON
  1699. return TCL_ERROR;
  1700. }
  1701. /* This is the Tcl command that acts as a wrapper for Python
  1702. * function or method.
  1703. */
  1704. static int
  1705. PythonCmd(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
  1706. {
  1707. PythonCmd_ClientData *data = (PythonCmd_ClientData *)clientData;
  1708. PyObject *func, *arg, *res;
  1709. int i, rv;
  1710. Tcl_Obj *obj_res;
  1711. ENTER_PYTHON
  1712. /* TBD: no error checking here since we know, via the
  1713. * Tkapp_CreateCommand() that the client data is a two-tuple
  1714. */
  1715. func = data->func;
  1716. /* Create argument list (argv1, ..., argvN) */
  1717. if (!(arg = PyTuple_New(argc - 1)))
  1718. return PythonCmd_Error(interp);
  1719. for (i = 0; i < (argc - 1); i++) {
  1720. PyObject *s = PyUnicode_FromString(argv[i + 1]);
  1721. if (!s) {
  1722. /* Is Tk leaking 0xC080 in %A - a "modified" utf-8 null? */
  1723. if (PyErr_ExceptionMatches(PyExc_UnicodeDecodeError) &&
  1724. !strcmp(argv[i + 1], "\xC0\x80")) {
  1725. PyErr_Clear();
  1726. /* Convert to "strict" utf-8 null */
  1727. s = PyUnicode_FromString("\0");
  1728. } else {
  1729. Py_DECREF(arg);
  1730. return PythonCmd_Error(interp);
  1731. }
  1732. }
  1733. if (PyTuple_SetItem(arg, i, s)) {
  1734. Py_DECREF(arg);
  1735. return PythonCmd_Error(interp);
  1736. }
  1737. }
  1738. res = PyEval_CallObject(func, arg);
  1739. Py_DECREF(arg);
  1740. if (res == NULL)
  1741. return PythonCmd_Error(interp);
  1742. obj_res = AsObj(res);
  1743. if (obj_res == NULL) {
  1744. Py_DECREF(res);
  1745. return PythonCmd_Error(interp);
  1746. }
  1747. else {
  1748. Tcl_SetObjResult(interp, obj_res);
  1749. rv = TCL_OK;
  1750. }
  1751. Py_DECREF(res);
  1752. LEAVE_PYTHON
  1753. return rv;
  1754. }
  1755. static void
  1756. PythonCmdDelete(ClientData clientData)
  1757. {
  1758. PythonCmd_ClientData *data = (PythonCmd_ClientData *)clientData;
  1759. ENTER_PYTHON
  1760. Py_XDECREF(data->self);
  1761. Py_XDECREF(data->func);
  1762. PyMem_DEL(data);
  1763. LEAVE_PYTHON
  1764. }
  1765. #ifdef WITH_THREAD
  1766. TCL_DECLARE_MUTEX(command_mutex)
  1767. typedef struct CommandEvent{
  1768. Tcl_Event ev;
  1769. Tcl_Interp* interp;
  1770. char *name;
  1771. int create;
  1772. int *status;
  1773. ClientData *data;
  1774. Tcl_Condition *done;
  1775. } CommandEvent;
  1776. static int
  1777. Tkapp_CommandProc(CommandEvent *ev, int flags)
  1778. {
  1779. if (ev->create)
  1780. *ev->status = Tcl_CreateCommand(
  1781. ev->interp, ev->name, PythonCmd,
  1782. ev->data, PythonCmdDelete) == NULL;
  1783. else
  1784. *ev->status = Tcl_DeleteCommand(ev->interp, ev->name);
  1785. Tcl_MutexLock(&command_mutex);
  1786. Tcl_ConditionNotify(ev->done);
  1787. Tcl_MutexUnlock(&command_mutex);
  1788. return 1;
  1789. }
  1790. #endif
  1791. static PyObject *
  1792. Tkapp_CreateCommand(PyObject *selfptr, PyObject *args)
  1793. {
  1794. TkappObject *self = (TkappObject*)selfptr;
  1795. PythonCmd_ClientData *data;
  1796. char *cmdName;
  1797. PyObject *func;
  1798. int err;
  1799. if (!PyArg_ParseTuple(args, "sO:createcommand", &cmdName, &func))
  1800. return NULL;
  1801. if (!PyCallable_Check(func)) {
  1802. PyErr_SetString(PyExc_TypeError, "command not callable");
  1803. return NULL;
  1804. }
  1805. #ifdef WITH_THREAD
  1806. if (self->threaded && self->thread_id != Tcl_GetCurrentThread() &&
  1807. !WaitForMainloop(self))
  1808. return NULL;
  1809. #endif
  1810. data = PyMem_NEW(PythonCmd_ClientData, 1);
  1811. if (!data)
  1812. return PyErr_NoMemory();
  1813. Py_INCREF(self);
  1814. Py_INCREF(func);
  1815. data->self = selfptr;
  1816. data->func = func;
  1817. #ifdef WITH_THREAD
  1818. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1819. Tcl_Condition cond = NULL;
  1820. CommandEvent *ev = (CommandEvent*)ckalloc(sizeof(CommandEvent));
  1821. ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
  1822. ev->interp = self->interp;
  1823. ev->create = 1;
  1824. ev->name = cmdName;
  1825. ev->data = (ClientData)data;
  1826. ev->status = &err;
  1827. ev->done = &cond;
  1828. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond, &command_mutex);
  1829. Tcl_ConditionFinalize(&cond);
  1830. }
  1831. else
  1832. #endif
  1833. {
  1834. ENTER_TCL
  1835. err = Tcl_CreateCommand(
  1836. Tkapp_Interp(self), cmdName, PythonCmd,
  1837. (ClientData)data, PythonCmdDelete) == NULL;
  1838. LEAVE_TCL
  1839. }
  1840. if (err) {
  1841. PyErr_SetString(Tkinter_TclError, "can't create Tcl command");
  1842. PyMem_DEL(data);
  1843. return NULL;
  1844. }
  1845. Py_INCREF(Py_None);
  1846. return Py_None;
  1847. }
  1848. static PyObject *
  1849. Tkapp_DeleteCommand(PyObject *selfptr, PyObject *args)
  1850. {
  1851. TkappObject *self = (TkappObject*)selfptr;
  1852. char *cmdName;
  1853. int err;
  1854. if (!PyArg_ParseTuple(args, "s:deletecommand", &cmdName))
  1855. return NULL;
  1856. #ifdef WITH_THREAD
  1857. if (self->threaded && self->thread_id != Tcl_GetCurrentThread()) {
  1858. Tcl_Condition cond = NULL;
  1859. CommandEvent *ev;
  1860. ev = (CommandEvent*)ckalloc(sizeof(CommandEvent));
  1861. ev->ev.proc = (Tcl_EventProc*)Tkapp_CommandProc;
  1862. ev->interp = self->interp;
  1863. ev->create = 0;
  1864. ev->name = cmdName;
  1865. ev->status = &err;
  1866. ev->done = &cond;
  1867. Tkapp_ThreadSend(self, (Tcl_Event*)ev, &cond,
  1868. &command_mutex);
  1869. Tcl_ConditionFinalize(&cond);
  1870. }
  1871. else
  1872. #endif
  1873. {
  1874. ENTER_TCL
  1875. err = Tcl_DeleteCommand(self->interp, cmdName);
  1876. LEAVE_TCL
  1877. }
  1878. if (err == -1) {
  1879. PyErr_SetString(Tkinter_TclError, "can't delete Tcl command");
  1880. return NULL;
  1881. }
  1882. Py_INCREF(Py_None);
  1883. return Py_None;
  1884. }
  1885. #ifdef HAVE_CREATEFILEHANDLER
  1886. /** File Handler **/
  1887. typedef struct _fhcdata {
  1888. PyObject *func;
  1889. PyObject *file;
  1890. int id;
  1891. struct _fhcdata *next;
  1892. } FileHandler_ClientData;
  1893. static FileHandler_ClientData *HeadFHCD;
  1894. static FileHandler_ClientData *
  1895. NewFHCD(PyObject *func, PyObject *file, int id)
  1896. {
  1897. FileHandler_ClientData *p;
  1898. p = PyMem_NEW(FileHandler_ClientData, 1);
  1899. if (p != NULL) {
  1900. Py_XINCREF(func);
  1901. Py_XINCREF(file);
  1902. p->func = func;
  1903. p->file = file;
  1904. p->id = id;
  1905. p->next = HeadFHCD;
  1906. HeadFHCD = p;
  1907. }
  1908. return p;
  1909. }
  1910. static void
  1911. DeleteFHCD(int id)
  1912. {
  1913. FileHandler_ClientData *p, **pp;
  1914. pp = &HeadFHCD;
  1915. while ((p = *pp) != NULL) {
  1916. if (p->id == id) {
  1917. *pp = p->next;
  1918. Py_XDECREF(p->func);
  1919. Py_XDECREF(p->file);
  1920. PyMem_DEL(p);
  1921. }
  1922. else
  1923. pp = &p->next;
  1924. }
  1925. }
  1926. static void
  1927. FileHandler(ClientData clientData, int mask)
  1928. {
  1929. FileHandler_ClientData *data = (FileHandler_ClientData *)clientData;
  1930. PyObject *func, *file, *arg, *res;
  1931. ENTER_PYTHON
  1932. func = data->func;
  1933. file = data->file;
  1934. arg = Py_BuildValue("(Oi)", file, (long) mask);
  1935. res = PyEval_CallObject(func, arg);
  1936. Py_DECREF(arg);
  1937. if (res == NULL) {
  1938. errorInCmd = 1;
  1939. PyErr_Fetch(&excInCmd, &valInCmd, &trbInCmd);
  1940. }
  1941. Py_XDECREF(res);
  1942. LEAVE_PYTHON
  1943. }
  1944. static PyObject *
  1945. Tkapp_CreateFileHandler(PyObject *self, PyObject *args)
  1946. /* args is (file, mask, func) */
  1947. {
  1948. FileHandler_ClientData *data;
  1949. PyObject *file, *func;
  1950. int mask, tfile;
  1951. if (!PyArg_ParseTuple(args, "OiO:createfilehandler",
  1952. &file, &mask, &func))
  1953. return NULL;
  1954. CHECK_TCL_APPARTMENT;
  1955. tfile = PyObject_AsFileDescriptor(file);
  1956. if (tfile < 0)
  1957. return NULL;
  1958. if (!PyCallable_Check(func)) {
  1959. PyErr_SetString(PyExc_TypeError, "bad argument list");
  1960. return NULL;
  1961. }
  1962. data = NewFHCD(func, file, tfile);
  1963. if (data == NULL)
  1964. return NULL;
  1965. /* Ought to check for null Tcl_File object... */
  1966. ENTER_TCL
  1967. Tcl_CreateFileHandler(tfile, mask, FileHandler, (ClientData) data);
  1968. LEAVE_TCL
  1969. Py_INCREF(Py_None);
  1970. return Py_None;
  1971. }
  1972. static PyObject *
  1973. Tkapp_DeleteFileHandler(PyObject *self, PyObject *args)
  1974. {
  1975. PyObject *file;
  1976. int tfile;
  1977. if (!PyArg_ParseTuple(args, "O:deletefilehandler", &file))
  1978. return NULL;
  1979. CHECK_TCL_APPARTMENT;
  1980. tfile = PyObject_AsFileDescriptor(file);
  1981. if (tfile < 0)
  1982. return NULL;
  1983. DeleteFHCD(tfile);
  1984. /* Ought to check for null Tcl_File object... */
  1985. ENTER_TCL
  1986. Tcl_DeleteFileHandler(tfile);
  1987. LEAVE_TCL
  1988. Py_INCREF(Py_None);
  1989. return Py_None;
  1990. }
  1991. #endif /* HAVE_CREATEFILEHANDLER */
  1992. /**** Tktt Object (timer token) ****/
  1993. static PyTypeObject Tktt_Type;
  1994. typedef struct {
  1995. PyObject_HEAD
  1996. Tcl_TimerToken token;
  1997. PyObject *func;
  1998. } TkttObject;
  1999. static PyObject *
  2000. Tktt_DeleteTimerHandler(PyObject *self, PyObject *args)
  2001. {
  2002. TkttObject *v = (TkttObject *)self;
  2003. PyObject *func = v->func;
  2004. if (!PyArg_ParseTuple(args, ":deletetimerhandler"))
  2005. return NULL;
  2006. if (v->token != NULL) {
  2007. Tcl_DeleteTimerHandler(v->token);
  2008. v->token = NULL;
  2009. }
  2010. if (func != NULL) {
  2011. v->func = NULL;
  2012. Py_DECREF(func);
  2013. Py_DECREF(v); /* See Tktt_New() */
  2014. }
  2015. Py_INCREF(Py_None);
  2016. return Py_None;
  2017. }
  2018. static PyMethodDef Tktt_methods[] =
  2019. {
  2020. {"deletetimerhandler", Tktt_DeleteTimerHandler, METH_VARARGS},
  2021. {NULL, NULL}
  2022. };
  2023. static TkttObject *
  2024. Tktt_New(PyObject *func)
  2025. {
  2026. TkttObject *v;
  2027. v = PyObject_New(TkttObject, &Tktt_Type);
  2028. if (v == NULL)
  2029. return NULL;
  2030. Py_INCREF(func);
  2031. v->token = NULL;
  2032. v->func = func;
  2033. /* Extra reference, deleted when called or when handler is deleted */
  2034. Py_INCREF(v);
  2035. return v;
  2036. }
  2037. static void
  2038. Tktt_Dealloc(PyObject *self)
  2039. {
  2040. TkttObject *v = (TkttObject *)self;
  2041. PyObject *func = v->func;
  2042. Py_XDECREF(func);
  2043. PyObject_Del(self);
  2044. }
  2045. static PyObject *
  2046. Tktt_Repr(PyObject *self)
  2047. {
  2048. TkttObject *v = (TkttObject *)self;
  2049. return PyUnicode_FromFormat("<tktimertoken at %p%s>",
  2050. v,
  2051. v->func == NULL ? ", handler deleted" : "");
  2052. }
  2053. static PyTypeObject Tktt_Type =
  2054. {
  2055. PyVarObject_HEAD_INIT(NULL, 0)
  2056. "tktimertoken", /*tp_name */
  2057. sizeof(TkttObject), /*tp_basicsize */
  2058. 0, /*tp_itemsize */
  2059. Tktt_Dealloc, /*tp_dealloc */
  2060. 0, /*tp_print */
  2061. 0, /*tp_getattr */
  2062. 0, /*tp_setattr */
  2063. 0, /*tp_reserved */
  2064. Tktt_Repr, /*tp_repr */
  2065. 0, /*tp_as_number */
  2066. 0, /*tp_as_sequence */
  2067. 0, /*tp_as_mapping */
  2068. 0, /*tp_hash */
  2069. 0, /*tp_call*/
  2070. 0, /*tp_str*/
  2071. 0, /*tp_getattro*/
  2072. 0, /*tp_setattro*/
  2073. 0, /*tp_as_buffer*/
  2074. Py_TPFLAGS_DEFAULT, /*tp_flags*/
  2075. 0, /*tp_doc*/
  2076. 0, /*tp_traverse*/
  2077. 0, /*tp_clear*/
  2078. 0, /*tp_richcompare*/
  2079. 0, /*tp_weaklistoffset*/
  2080. 0, /*tp_iter*/
  2081. 0, /*tp_iternext*/
  2082. Tktt_methods, /*tp_methods*/
  2083. };
  2084. /** Timer Handler **/
  2085. static void
  2086. TimerHandler(ClientData clientData)
  2087. {
  2088. TkttObject *v = (TkttObject *)clientData;
  2089. PyObject *func = v->func;
  2090. PyObject *res;
  2091. if (func == NULL)
  2092. return;
  2093. v->func = NULL;
  2094. ENTER_PYTHON
  2095. res = PyEval_CallObject(func, NULL);
  2096. Py_DECREF(func);
  2097. Py_DECREF(v); /* See Tktt_New() */
  2098. if (res == NULL) {
  2099. errorInCmd = 1;
  2100. PyErr_Fetch(&excInCmd, &valInCmd, &trbInCmd);
  2101. }
  2102. else
  2103. Py_DECREF(res);
  2104. LEAVE_PYTHON
  2105. }
  2106. static PyObject *
  2107. Tkapp_CreateTimerHandler(PyObject *self, PyObject *args)
  2108. {
  2109. int milliseconds;
  2110. PyObject *func;
  2111. TkttObject *v;
  2112. if (!PyArg_ParseTuple(args, "iO:createtimerhandler",
  2113. &milliseconds, &func))
  2114. return NULL;
  2115. if (!PyCallable_Check(func)) {
  2116. PyErr_SetString(PyExc_TypeError, "bad argument list");
  2117. return NULL;
  2118. }
  2119. CHECK_TCL_APPARTMENT;
  2120. v = Tktt_New(func);
  2121. if (v) {
  2122. v->token = Tcl_CreateTimerHandler(milliseconds, TimerHandler,
  2123. (ClientData)v);
  2124. }
  2125. return (PyObject *) v;
  2126. }
  2127. /** Event Loop **/
  2128. static PyObject *
  2129. Tkapp_MainLoop(PyObject *selfptr, PyObject *args)
  2130. {
  2131. int threshold = 0;
  2132. TkappObject *self = (TkappObject*)selfptr;
  2133. #ifdef WITH_THREAD
  2134. PyThreadState *tstate = PyThreadState_Get();
  2135. #endif
  2136. if (!PyArg_ParseTuple(args, "|i:mainloop", &threshold))
  2137. return NULL;
  2138. CHECK_TCL_APPARTMENT;
  2139. self->dispatching = 1;
  2140. quitMainLoop = 0;
  2141. while (Tk_GetNumMainWindows() > threshold &&
  2142. !quitMainLoop &&
  2143. !errorInCmd)
  2144. {
  2145. int result;
  2146. #ifdef WITH_THREAD
  2147. if (self->threaded) {
  2148. /* Allow other Python threads to run. */
  2149. ENTER_TCL
  2150. result = Tcl_DoOneEvent(0);
  2151. LEAVE_TCL
  2152. }
  2153. else {
  2154. Py_BEGIN_ALLOW_THREADS
  2155. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1);
  2156. tcl_tstate = tstate;
  2157. result = Tcl_DoOneEvent(TCL_DONT_WAIT);
  2158. tcl_tstate = NULL;
  2159. if(tcl_lock)PyThread_release_lock(tcl_lock);
  2160. if (result == 0)
  2161. Sleep(Tkinter_busywaitinterval);
  2162. Py_END_ALLOW_THREADS
  2163. }
  2164. #else
  2165. result = Tcl_DoOneEvent(0);
  2166. #endif
  2167. if (PyErr_CheckSignals() != 0) {
  2168. self->dispatching = 0;
  2169. return NULL;
  2170. }
  2171. if (result < 0)
  2172. break;
  2173. }
  2174. self->dispatching = 0;
  2175. quitMainLoop = 0;
  2176. if (errorInCmd) {
  2177. errorInCmd = 0;
  2178. PyErr_Restore(excInCmd, valInCmd, trbInCmd);
  2179. excInCmd = valInCmd = trbInCmd = NULL;
  2180. return NULL;
  2181. }
  2182. Py_INCREF(Py_None);
  2183. return Py_None;
  2184. }
  2185. static PyObject *
  2186. Tkapp_DoOneEvent(PyObject *self, PyObject *args)
  2187. {
  2188. int flags = 0;
  2189. int rv;
  2190. if (!PyArg_ParseTuple(args, "|i:dooneevent", &flags))
  2191. return NULL;
  2192. ENTER_TCL
  2193. rv = Tcl_DoOneEvent(flags);
  2194. LEAVE_TCL
  2195. return Py_BuildValue("i", rv);
  2196. }
  2197. static PyObject *
  2198. Tkapp_Quit(PyObject *self, PyObject *args)
  2199. {
  2200. if (!PyArg_ParseTuple(args, ":quit"))
  2201. return NULL;
  2202. quitMainLoop = 1;
  2203. Py_INCREF(Py_None);
  2204. return Py_None;
  2205. }
  2206. static PyObject *
  2207. Tkapp_InterpAddr(PyObject *self, PyObject *args)
  2208. {
  2209. if (!PyArg_ParseTuple(args, ":interpaddr"))
  2210. return NULL;
  2211. return PyLong_FromLong((long)Tkapp_Interp(self));
  2212. }
  2213. static PyObject *
  2214. Tkapp_TkInit(PyObject *self, PyObject *args)
  2215. {
  2216. Tcl_Interp *interp = Tkapp_Interp(self);
  2217. const char * _tk_exists = NULL;
  2218. int err;
  2219. #ifdef TKINTER_PROTECT_LOADTK
  2220. /* Up to Tk 8.4.13, Tk_Init deadlocks on the second call when the
  2221. * first call failed.
  2222. * To avoid the deadlock, we just refuse the second call through
  2223. * a static variable.
  2224. */
  2225. if (tk_load_failed) {
  2226. PyErr_SetString(Tkinter_TclError, TKINTER_LOADTK_ERRMSG);
  2227. return NULL;
  2228. }
  2229. #endif
  2230. /* We want to guard against calling Tk_Init() multiple times */
  2231. CHECK_TCL_APPARTMENT;
  2232. ENTER_TCL
  2233. err = Tcl_Eval(Tkapp_Interp(self), "info exists tk_version");
  2234. ENTER_OVERLAP
  2235. if (err == TCL_ERROR) {
  2236. /* This sets an exception, but we cannot return right
  2237. away because we need to exit the overlap first. */
  2238. Tkinter_Error(self);
  2239. } else {
  2240. _tk_exists = Tkapp_Result(self);
  2241. }
  2242. LEAVE_OVERLAP_TCL
  2243. if (err == TCL_ERROR) {
  2244. return NULL;
  2245. }
  2246. if (_tk_exists == NULL || strcmp(_tk_exists, "1") != 0) {
  2247. if (Tk_Init(interp) == TCL_ERROR) {
  2248. PyErr_SetString(Tkinter_TclError, Tcl_GetStringResult(Tkapp_Interp(self)));
  2249. #ifdef TKINTER_PROTECT_LOADTK
  2250. tk_load_failed = 1;
  2251. #endif
  2252. return NULL;
  2253. }
  2254. }
  2255. Py_INCREF(Py_None);
  2256. return Py_None;
  2257. }
  2258. static PyObject *
  2259. Tkapp_WantObjects(PyObject *self, PyObject *args)
  2260. {
  2261. int wantobjects = -1;
  2262. if (!PyArg_ParseTuple(args, "|i:wantobjects", &wantobjects))
  2263. return NULL;
  2264. if (wantobjects == -1)
  2265. return PyBool_FromLong(((TkappObject*)self)->wantobjects);
  2266. ((TkappObject*)self)->wantobjects = wantobjects;
  2267. Py_INCREF(Py_None);
  2268. return Py_None;
  2269. }
  2270. static PyObject *
  2271. Tkapp_WillDispatch(PyObject *self, PyObject *args)
  2272. {
  2273. ((TkappObject*)self)->dispatching = 1;
  2274. Py_INCREF(Py_None);
  2275. return Py_None;
  2276. }
  2277. /**** Tkapp Method List ****/
  2278. static PyMethodDef Tkapp_methods[] =
  2279. {
  2280. {"willdispatch", Tkapp_WillDispatch, METH_NOARGS},
  2281. {"wantobjects", Tkapp_WantObjects, METH_VARARGS},
  2282. {"call", Tkapp_Call, METH_VARARGS},
  2283. {"globalcall", Tkapp_GlobalCall, METH_VARARGS},
  2284. {"eval", Tkapp_Eval, METH_VARARGS},
  2285. {"globaleval", Tkapp_GlobalEval, METH_VARARGS},
  2286. {"evalfile", Tkapp_EvalFile, METH_VARARGS},
  2287. {"record", Tkapp_Record, METH_VARARGS},
  2288. {"adderrorinfo", Tkapp_AddErrorInfo, METH_VARARGS},
  2289. {"setvar", Tkapp_SetVar, METH_VARARGS},
  2290. {"globalsetvar", Tkapp_GlobalSetVar, METH_VARARGS},
  2291. {"getvar", Tkapp_GetVar, METH_VARARGS},
  2292. {"globalgetvar", Tkapp_GlobalGetVar, METH_VARARGS},
  2293. {"unsetvar", Tkapp_UnsetVar, METH_VARARGS},
  2294. {"globalunsetvar", Tkapp_GlobalUnsetVar, METH_VARARGS},
  2295. {"getint", Tkapp_GetInt, METH_VARARGS},
  2296. {"getdouble", Tkapp_GetDouble, METH_VARARGS},
  2297. {"getboolean", Tkapp_GetBoolean, METH_VARARGS},
  2298. {"exprstring", Tkapp_ExprString, METH_VARARGS},
  2299. {"exprlong", Tkapp_ExprLong, METH_VARARGS},
  2300. {"exprdouble", Tkapp_ExprDouble, METH_VARARGS},
  2301. {"exprboolean", Tkapp_ExprBoolean, METH_VARARGS},
  2302. {"splitlist", Tkapp_SplitList, METH_VARARGS},
  2303. {"split", Tkapp_Split, METH_VARARGS},
  2304. {"merge", Tkapp_Merge, METH_VARARGS},
  2305. {"createcommand", Tkapp_CreateCommand, METH_VARARGS},
  2306. {"deletecommand", Tkapp_DeleteCommand, METH_VARARGS},
  2307. #ifdef HAVE_CREATEFILEHANDLER
  2308. {"createfilehandler", Tkapp_CreateFileHandler, METH_VARARGS},
  2309. {"deletefilehandler", Tkapp_DeleteFileHandler, METH_VARARGS},
  2310. #endif
  2311. {"createtimerhandler", Tkapp_CreateTimerHandler, METH_VARARGS},
  2312. {"mainloop", Tkapp_MainLoop, METH_VARARGS},
  2313. {"dooneevent", Tkapp_DoOneEvent, METH_VARARGS},
  2314. {"quit", Tkapp_Quit, METH_VARARGS},
  2315. {"interpaddr", Tkapp_InterpAddr, METH_VARARGS},
  2316. {"loadtk", Tkapp_TkInit, METH_NOARGS},
  2317. {NULL, NULL}
  2318. };
  2319. /**** Tkapp Type Methods ****/
  2320. static void
  2321. Tkapp_Dealloc(PyObject *self)
  2322. {
  2323. /*CHECK_TCL_APPARTMENT;*/
  2324. ENTER_TCL
  2325. Tcl_DeleteInterp(Tkapp_Interp(self));
  2326. LEAVE_TCL
  2327. PyObject_Del(self);
  2328. DisableEventHook();
  2329. }
  2330. static PyTypeObject Tkapp_Type =
  2331. {
  2332. PyVarObject_HEAD_INIT(NULL, 0)
  2333. "tkapp", /*tp_name */
  2334. sizeof(TkappObject), /*tp_basicsize */
  2335. 0, /*tp_itemsize */
  2336. Tkapp_Dealloc, /*tp_dealloc */
  2337. 0, /*tp_print */
  2338. 0, /*tp_getattr */
  2339. 0, /*tp_setattr */
  2340. 0, /*tp_reserved */
  2341. 0, /*tp_repr */
  2342. 0, /*tp_as_number */
  2343. 0, /*tp_as_sequence */
  2344. 0, /*tp_as_mapping */
  2345. 0, /*tp_hash */
  2346. 0, /*tp_call*/
  2347. 0, /*tp_str*/
  2348. 0, /*tp_getattro*/
  2349. 0, /*tp_setattro*/
  2350. 0, /*tp_as_buffer*/
  2351. Py_TPFLAGS_DEFAULT, /*tp_flags*/
  2352. 0, /*tp_doc*/
  2353. 0, /*tp_traverse*/
  2354. 0, /*tp_clear*/
  2355. 0, /*tp_richcompare*/
  2356. 0, /*tp_weaklistoffset*/
  2357. 0, /*tp_iter*/
  2358. 0, /*tp_iternext*/
  2359. Tkapp_methods, /*tp_methods*/
  2360. };
  2361. /**** Tkinter Module ****/
  2362. typedef struct {
  2363. PyObject* tuple;
  2364. int size; /* current size */
  2365. int maxsize; /* allocated size */
  2366. } FlattenContext;
  2367. static int
  2368. _bump(FlattenContext* context, int size)
  2369. {
  2370. /* expand tuple to hold (at least) size new items.
  2371. return true if successful, false if an exception was raised */
  2372. int maxsize = context->maxsize * 2;
  2373. if (maxsize < context->size + size)
  2374. maxsize = context->size + size;
  2375. context->maxsize = maxsize;
  2376. return _PyTuple_Resize(&context->tuple, maxsize) >= 0;
  2377. }
  2378. static int
  2379. _flatten1(FlattenContext* context, PyObject* item, int depth)
  2380. {
  2381. /* add tuple or list to argument tuple (recursively) */
  2382. int i, size;
  2383. if (depth > 1000) {
  2384. PyErr_SetString(PyExc_ValueError,
  2385. "nesting too deep in _flatten");
  2386. return 0;
  2387. } else if (PyList_Check(item)) {
  2388. size = PyList_GET_SIZE(item);
  2389. /* preallocate (assume no nesting) */
  2390. if (context->size + size > context->maxsize &&
  2391. !_bump(context, size))
  2392. return 0;
  2393. /* copy items to output tuple */
  2394. for (i = 0; i < size; i++) {
  2395. PyObject *o = PyList_GET_ITEM(item, i);
  2396. if (PyList_Check(o) || PyTuple_Check(o)) {
  2397. if (!_flatten1(context, o, depth + 1))
  2398. return 0;
  2399. } else if (o != Py_None) {
  2400. if (context->size + 1 > context->maxsize &&
  2401. !_bump(context, 1))
  2402. return 0;
  2403. Py_INCREF(o);
  2404. PyTuple_SET_ITEM(context->tuple,
  2405. context->size++, o);
  2406. }
  2407. }
  2408. } else if (PyTuple_Check(item)) {
  2409. /* same, for tuples */
  2410. size = PyTuple_GET_SIZE(item);
  2411. if (context->size + size > context->maxsize &&
  2412. !_bump(context, size))
  2413. return 0;
  2414. for (i = 0; i < size; i++) {
  2415. PyObject *o = PyTuple_GET_ITEM(item, i);
  2416. if (PyList_Check(o) || PyTuple_Check(o)) {
  2417. if (!_flatten1(context, o, depth + 1))
  2418. return 0;
  2419. } else if (o != Py_None) {
  2420. if (context->size + 1 > context->maxsize &&
  2421. !_bump(context, 1))
  2422. return 0;
  2423. Py_INCREF(o);
  2424. PyTuple_SET_ITEM(context->tuple,
  2425. context->size++, o);
  2426. }
  2427. }
  2428. } else {
  2429. PyErr_SetString(PyExc_TypeError, "argument must be sequence");
  2430. return 0;
  2431. }
  2432. return 1;
  2433. }
  2434. static PyObject *
  2435. Tkinter_Flatten(PyObject* self, PyObject* args)
  2436. {
  2437. FlattenContext context;
  2438. PyObject* item;
  2439. if (!PyArg_ParseTuple(args, "O:_flatten", &item))
  2440. return NULL;
  2441. context.maxsize = PySequence_Size(item);
  2442. if (context.maxsize < 0)
  2443. return NULL;
  2444. if (context.maxsize == 0)
  2445. return PyTuple_New(0);
  2446. context.tuple = PyTuple_New(context.maxsize);
  2447. if (!context.tuple)
  2448. return NULL;
  2449. context.size = 0;
  2450. if (!_flatten1(&context, item,0))
  2451. return NULL;
  2452. if (_PyTuple_Resize(&context.tuple, context.size))
  2453. return NULL;
  2454. return context.tuple;
  2455. }
  2456. static PyObject *
  2457. Tkinter_Create(PyObject *self, PyObject *args)
  2458. {
  2459. char *screenName = NULL;
  2460. char *baseName = NULL; /* XXX this is not used anymore;
  2461. try getting rid of it. */
  2462. char *className = NULL;
  2463. int interactive = 0;
  2464. int wantobjects = 0;
  2465. int wantTk = 1; /* If false, then Tk_Init() doesn't get called */
  2466. int sync = 0; /* pass -sync to wish */
  2467. char *use = NULL; /* pass -use to wish */
  2468. className = "Tk";
  2469. if (!PyArg_ParseTuple(args, "|zssiiiiz:create",
  2470. &screenName, &baseName, &className,
  2471. &interactive, &wantobjects, &wantTk,
  2472. &sync, &use))
  2473. return NULL;
  2474. return (PyObject *) Tkapp_New(screenName, className,
  2475. interactive, wantobjects, wantTk,
  2476. sync, use);
  2477. }
  2478. static PyObject *
  2479. Tkinter_setbusywaitinterval(PyObject *self, PyObject *args)
  2480. {
  2481. int new_val;
  2482. if (!PyArg_ParseTuple(args, "i:setbusywaitinterval", &new_val))
  2483. return NULL;
  2484. if (new_val < 0) {
  2485. PyErr_SetString(PyExc_ValueError,
  2486. "busywaitinterval must be >= 0");
  2487. return NULL;
  2488. }
  2489. Tkinter_busywaitinterval = new_val;
  2490. Py_INCREF(Py_None);
  2491. return Py_None;
  2492. }
  2493. static char setbusywaitinterval_doc[] =
  2494. "setbusywaitinterval(n) -> None\n\
  2495. \n\
  2496. Set the busy-wait interval in milliseconds between successive\n\
  2497. calls to Tcl_DoOneEvent in a threaded Python interpreter.\n\
  2498. It should be set to a divisor of the maximum time between\n\
  2499. frames in an animation.";
  2500. static PyObject *
  2501. Tkinter_getbusywaitinterval(PyObject *self, PyObject *args)
  2502. {
  2503. return PyLong_FromLong(Tkinter_busywaitinterval);
  2504. }
  2505. static char getbusywaitinterval_doc[] =
  2506. "getbusywaitinterval() -> int\n\
  2507. \n\
  2508. Return the current busy-wait interval between successive\n\
  2509. calls to Tcl_DoOneEvent in a threaded Python interpreter.";
  2510. static PyMethodDef moduleMethods[] =
  2511. {
  2512. {"_flatten", Tkinter_Flatten, METH_VARARGS},
  2513. {"create", Tkinter_Create, METH_VARARGS},
  2514. {"setbusywaitinterval",Tkinter_setbusywaitinterval, METH_VARARGS,
  2515. setbusywaitinterval_doc},
  2516. {"getbusywaitinterval",(PyCFunction)Tkinter_getbusywaitinterval,
  2517. METH_NOARGS, getbusywaitinterval_doc},
  2518. {NULL, NULL}
  2519. };
  2520. #ifdef WAIT_FOR_STDIN
  2521. static int stdin_ready = 0;
  2522. #ifndef MS_WINDOWS
  2523. static void
  2524. MyFileProc(void *clientData, int mask)
  2525. {
  2526. stdin_ready = 1;
  2527. }
  2528. #endif
  2529. #ifdef WITH_THREAD
  2530. static PyThreadState *event_tstate = NULL;
  2531. #endif
  2532. static int
  2533. EventHook(void)
  2534. {
  2535. #ifndef MS_WINDOWS
  2536. int tfile;
  2537. #endif
  2538. #ifdef WITH_THREAD
  2539. PyEval_RestoreThread(event_tstate);
  2540. #endif
  2541. stdin_ready = 0;
  2542. errorInCmd = 0;
  2543. #ifndef MS_WINDOWS
  2544. tfile = fileno(stdin);
  2545. Tcl_CreateFileHandler(tfile, TCL_READABLE, MyFileProc, NULL);
  2546. #endif
  2547. while (!errorInCmd && !stdin_ready) {
  2548. int result;
  2549. #ifdef MS_WINDOWS
  2550. if (_kbhit()) {
  2551. stdin_ready = 1;
  2552. break;
  2553. }
  2554. #endif
  2555. #if defined(WITH_THREAD) || defined(MS_WINDOWS)
  2556. Py_BEGIN_ALLOW_THREADS
  2557. if(tcl_lock)PyThread_acquire_lock(tcl_lock, 1);
  2558. tcl_tstate = event_tstate;
  2559. result = Tcl_DoOneEvent(TCL_DONT_WAIT);
  2560. tcl_tstate = NULL;
  2561. if(tcl_lock)PyThread_release_lock(tcl_lock);
  2562. if (result == 0)
  2563. Sleep(Tkinter_busywaitinterval);
  2564. Py_END_ALLOW_THREADS
  2565. #else
  2566. result = Tcl_DoOneEvent(0);
  2567. #endif
  2568. if (result < 0)
  2569. break;
  2570. }
  2571. #ifndef MS_WINDOWS
  2572. Tcl_DeleteFileHandler(tfile);
  2573. #endif
  2574. if (errorInCmd) {
  2575. errorInCmd = 0;
  2576. PyErr_Restore(excInCmd, valInCmd, trbInCmd);
  2577. excInCmd = valInCmd = trbInCmd = NULL;
  2578. PyErr_Print();
  2579. }
  2580. #ifdef WITH_THREAD
  2581. PyEval_SaveThread();
  2582. #endif
  2583. return 0;
  2584. }
  2585. #endif
  2586. static void
  2587. EnableEventHook(void)
  2588. {
  2589. #ifdef WAIT_FOR_STDIN
  2590. if (PyOS_InputHook == NULL) {
  2591. #ifdef WITH_THREAD
  2592. event_tstate = PyThreadState_Get();
  2593. #endif
  2594. PyOS_InputHook = EventHook;
  2595. }
  2596. #endif
  2597. }
  2598. static void
  2599. DisableEventHook(void)
  2600. {
  2601. #ifdef WAIT_FOR_STDIN
  2602. if (Tk_GetNumMainWindows() == 0 && PyOS_InputHook == EventHook) {
  2603. PyOS_InputHook = NULL;
  2604. }
  2605. #endif
  2606. }
  2607. /* all errors will be checked in one fell swoop in init_tkinter() */
  2608. static void
  2609. ins_long(PyObject *d, char *name, long val)
  2610. {
  2611. PyObject *v = PyLong_FromLong(val);
  2612. if (v) {
  2613. PyDict_SetItemString(d, name, v);
  2614. Py_DECREF(v);
  2615. }
  2616. }
  2617. static void
  2618. ins_string(PyObject *d, char *name, char *val)
  2619. {
  2620. PyObject *v = PyUnicode_FromString(val);
  2621. if (v) {
  2622. PyDict_SetItemString(d, name, v);
  2623. Py_DECREF(v);
  2624. }
  2625. }
  2626. static struct PyModuleDef _tkintermodule = {
  2627. PyModuleDef_HEAD_INIT,
  2628. "_tkinter",
  2629. NULL,
  2630. -1,
  2631. moduleMethods,
  2632. NULL,
  2633. NULL,
  2634. NULL,
  2635. NULL
  2636. };
  2637. PyMODINIT_FUNC
  2638. PyInit__tkinter(void)
  2639. {
  2640. PyObject *m, *d, *uexe, *cexe;
  2641. if (PyType_Ready(&Tkapp_Type) < 0)
  2642. return NULL;
  2643. #ifdef WITH_THREAD
  2644. tcl_lock = PyThread_allocate_lock();
  2645. #endif
  2646. m = PyModule_Create(&_tkintermodule);
  2647. if (m == NULL)
  2648. return NULL;
  2649. d = PyModule_GetDict(m);
  2650. Tkinter_TclError = PyErr_NewException("_tkinter.TclError", NULL, NULL);
  2651. PyDict_SetItemString(d, "TclError", Tkinter_TclError);
  2652. ins_long(d, "READABLE", TCL_READABLE);
  2653. ins_long(d, "WRITABLE", TCL_WRITABLE);
  2654. ins_long(d, "EXCEPTION", TCL_EXCEPTION);
  2655. ins_long(d, "WINDOW_EVENTS", TCL_WINDOW_EVENTS);
  2656. ins_long(d, "FILE_EVENTS", TCL_FILE_EVENTS);
  2657. ins_long(d, "TIMER_EVENTS", TCL_TIMER_EVENTS);
  2658. ins_long(d, "IDLE_EVENTS", TCL_IDLE_EVENTS);
  2659. ins_long(d, "ALL_EVENTS", TCL_ALL_EVENTS);
  2660. ins_long(d, "DONT_WAIT", TCL_DONT_WAIT);
  2661. ins_string(d, "TK_VERSION", TK_VERSION);
  2662. ins_string(d, "TCL_VERSION", TCL_VERSION);
  2663. PyDict_SetItemString(d, "TkappType", (PyObject *)&Tkapp_Type);
  2664. if (PyType_Ready(&Tktt_Type) < 0)
  2665. return NULL;
  2666. PyDict_SetItemString(d, "TkttType", (PyObject *)&Tktt_Type);
  2667. Py_TYPE(&PyTclObject_Type) = &PyType_Type;
  2668. PyDict_SetItemString(d, "Tcl_Obj", (PyObject *)&PyTclObject_Type);
  2669. #ifdef TK_AQUA
  2670. /* Tk_MacOSXSetupTkNotifier must be called before Tcl's subsystems
  2671. * start waking up. Note that Tcl_FindExecutable will do this, this
  2672. * code must be above it! The original warning from
  2673. * tkMacOSXAppInit.c is copied below.
  2674. *
  2675. * NB - You have to swap in the Tk Notifier BEFORE you start up the
  2676. * Tcl interpreter for now. It probably should work to do this
  2677. * in the other order, but for now it doesn't seem to.
  2678. *
  2679. */
  2680. Tk_MacOSXSetupTkNotifier();
  2681. #endif
  2682. /* This helps the dynamic loader; in Unicode aware Tcl versions
  2683. it also helps Tcl find its encodings. */
  2684. uexe = PyUnicode_FromWideChar(Py_GetProgramName(), -1);
  2685. if (uexe) {
  2686. cexe = PyUnicode_EncodeFSDefault(uexe);
  2687. if (cexe)
  2688. Tcl_FindExecutable(PyBytes_AsString(cexe));
  2689. Py_XDECREF(cexe);
  2690. Py_DECREF(uexe);
  2691. }
  2692. if (PyErr_Occurred()) {
  2693. Py_DECREF(m);
  2694. return NULL;
  2695. }
  2696. #if 0
  2697. /* This was not a good idea; through <Destroy> bindings,
  2698. Tcl_Finalize() may invoke Python code but at that point the
  2699. interpreter and thread state have already been destroyed! */
  2700. Py_AtExit(Tcl_Finalize);
  2701. #endif
  2702. return m;
  2703. }