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.

3156 lines
80 KiB

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