Guido van Rossum [Thu, 28 May 1998 23:06:38 +0000 (23:06 +0000)]
Changes to make it possible to write multi-threaded programs using
Tkinter. This adds a separate lock -- read the comments. (This was
also needed for Mark Hammond's attempts to make PythonWin
Tkinter-friendly.)
The changes have affected the EventHook slightly, too; and I've done
some more cleanup of the code that deals with the different versions
of Tcl_CreateFileHandler().
Guido van Rossum [Thu, 28 May 1998 20:18:18 +0000 (20:18 +0000)]
Some systems (e.g. Linux) use enums for some symbols (like IPPROTO_IP)
so that our #ifdef test has the wrong effect. Substitute hardcoded
values for some important symbols (but not for the whole range -- some
are pretty obscure so it's not worth it).
Jack Jansen [Thu, 28 May 1998 14:22:48 +0000 (14:22 +0000)]
For ControlWindow there is a new method do_rawcontrolhit(), which gets
control before TrackControl is called. The default implementation
calls TrackControl and then do_controlhit().
For ScrolledWindow, do_rawcontrol passes a tracker function to
TrackControl if the mouse is in one of the arrows or grey areas, and
the tracker handles scrolling. For the thumb part nothing has changed.
Jack Jansen [Thu, 28 May 1998 14:20:09 +0000 (14:20 +0000)]
Allow an (optional) tracking function (or -1) to be specified to
TrackControl. TrackControl is now manually generated (too much work to
explain this to bgen).
Guido van Rossum [Tue, 26 May 1998 14:33:37 +0000 (14:33 +0000)]
Subject: Buglet in PyLong_AsLong
From: "Tim Peters" <tim_one@email.msn.com>
To: "Guido van Rossum" <guido@CNRI.Reston.VA.US>
Date: Sat, 23 May 1998 21:45:53 -0400
Guido, the overflow checking in PyLong_AsLong is off a little:
1) If the C in use sign-extends right shifts on signed longs, there's a
spurious overflow error when converting the most-negative int:
Python 1.5.1 (#0, Apr 13 1998, 20:22:04) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> x = -1L << 31
>>> x
-2147483648L
>>> int(x)
Traceback (innermost last):
File "<stdin>", line 1, in ?
OverflowError: long int too long to convert
>>>
2) If C does not sign-extend, some genuine overflows won't be caught.
The attached should repair both, and, because I installed a new disk and a C
compiler today, it's even been compiled this time <wink>.
Python 1.5.1 (#0, May 23 1998, 20:24:58) [MSC 32 bit (Intel)] on win32
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>> x = -1L << 31
>>> x
-2147483648L
>>> int(x)
-2147483648
>>> int(-x)
Traceback (innermost last):
File "<stdin>", line 1, in ?
OverflowError: long int too long to convert
>>> int(-x-1) 2147483647
>>> int(x-1)
Traceback (innermost last):
File "<stdin>", line 1, in ?
OverflowError: long int too long to convert
>>>
Guido van Rossum [Tue, 26 May 1998 13:53:23 +0000 (13:53 +0000)]
Mark Hammond writes:
Also, here is a new version of import_nt.c, which allows you to register a
Debug module in the registry. While I was there I removed some of the
ugliness - what was I thinking :-)
Guido van Rossum [Fri, 22 May 1998 18:28:17 +0000 (18:28 +0000)]
Use a different implementation of EventHook(). The new version
registers an input file handler for stdin with Tcl and handles Tcl
events until something is available on stdin; it then deletes the
handler and returns from EventHook().
This works with or without GNU readline, and doesn't busy-wait.
Guido van Rossum [Fri, 22 May 1998 18:12:59 +0000 (18:12 +0000)]
Add an alias (and preferred name) "contains" for "sequenceIncludes".
Rationalized the doc strings.
Also simplify the module initialization -- we don't need a __version__
which is set to "$Rev" :-) and we don't need a fatal error when the
initialization fails.
Guido van Rossum [Fri, 22 May 1998 15:23:36 +0000 (15:23 +0000)]
Address some gcc -Wall warnings (e.g. include <ctype.h>).
Make sure that no tp_as_numbers->nb_<whatever> function is called
without checking for a NULL pointer. Marc-Andre Lemburg will love it!
(Except that he's just rewritten all this code for a different
approach to coercions ;-( )
Guido van Rossum [Fri, 22 May 1998 00:57:31 +0000 (00:57 +0000)]
I think there was a tiny bug in new_function() -- the 'defaults'
argument was initialized to Py_None, but later checked for NULL.
Consistently use Py_None.
Guido van Rossum [Fri, 22 May 1998 00:55:34 +0000 (00:55 +0000)]
Make function objects somewhat mutable -- the members func_code,
func_defaults and func_doc (alias __doc__) may be assigned to. For
the first two, there's a type restriction to code object and tuple,
respectively.
Guido van Rossum [Fri, 22 May 1998 00:51:39 +0000 (00:51 +0000)]
A bunch of functions are now properly implemented in abstract.c, and
the code here becomes much simpler. In particular: abs(), divmod(),
pow(), int(), long(), float(), len(), tuple(), list().
Also make sure that no use of a function pointer gotten from a
tp_as_sequence or tp_as_mapping structure is made without checking it
for NULL first.
A few other cosmetic things, such as properly reindenting slice().
Guido van Rossum [Fri, 22 May 1998 00:47:05 +0000 (00:47 +0000)]
Completely reformatted, standardizing indentation as well as
programming style.
Recoded many routines to incorporate better error checking, and/or
better versions of the same function found elsewhere
(e.g. bltinmodule.c or ceval.c). In particular,
Py_Number_{Int,Long,Float}() now convert from strings, just like the
built-in functions int(), long() and float().
Sequences and mappings are now safe to have NULL function pointers
anywhere in their tp_as_sequence or tp_as_mapping fields. (A few
places in other files need to be checked in too.)
Guido van Rossum [Wed, 20 May 1998 22:25:32 +0000 (22:25 +0000)]
Trivial little change: when setting a member to an object, hold the
old value in a temporary and XDECREF it only after then new value has
been set. This prevents the (unlikely) case where the destructor of
the member uses the containing object -- it would find it in an
undefined state.
Guido van Rossum [Tue, 19 May 1998 21:15:03 +0000 (21:15 +0000)]
Protection agains non-existing subdirectories for clean and clobber
targets. On some platforms this would cause an infinite Make
recursion. Also remove "Doc" from the SUBDIRSTOO variable, since it
no longer exists in the standard distribution.
Barry Warsaw [Tue, 19 May 1998 16:06:21 +0000 (16:06 +0000)]
(py-stringlit-re): Another ME patch to recognize SQTQs and DQTQs
(single and double quoted triple quoted strings :-) with embedded
single like-quotes. Also recognizes raw prefix.
Barry Warsaw [Tue, 19 May 1998 15:54:45 +0000 (15:54 +0000)]
More ME patches:
(py-execute-import-or-reload): Cool new command that imports or
reloads the current file as a module, so as not to clutter the global
namespace. Bound to C-c C-m.
(py-execute-def-or-class): New command that sends the current def or
class to the interpreter. Bound to C-M-x.
(py-execute-string): New command that sends arbitrary string to the
interpreter. Not bound by default.
Barry Warsaw [Tue, 19 May 1998 15:31:46 +0000 (15:31 +0000)]
(beginning-of-python-def-or-class): Renamed to
py-beginning-of-def-or-class, and defaliased for backwards
compatibility. ME patch to add optional second argument, count.
(end-of-python-def-or-class): Renamed to py-end-of-def-or-class, and
defaliased for backwards compatibility. ME patch to add optional
second argument, count.
Guido van Rossum [Tue, 19 May 1998 15:09:05 +0000 (15:09 +0000)]
Fix a curious bug: statements like "import sys.time" would succeed,
because the path through the code would notice that sys.__path__ did
not exist and it would fall back to the default path (builtins +
sys.path) instead of failing). No longer.
Guido van Rossum [Mon, 18 May 1998 14:39:42 +0000 (14:39 +0000)]
Subject: bug fixes for imaplib.py
From: Piers Lauder <piers@staff.cs.usyd.edu.au>
To: Python List <python-list@cwi.nl>
Date: Mon, 18 May 1998 09:51:53 +1000
Following is a context diff for imaplib.py in the Python1.5.1 distribution.
It fixes 2 bugs. One to do with argument quoting, and the other to do with
caching of un-tagged responses. Apologies for its size.
Guido van Rossum [Sat, 16 May 1998 02:11:10 +0000 (02:11 +0000)]
Fix another oldie (item (b) only):
Date: Fri, 20 Dec 1996 14:47:50 +0100
From: Lele Gaifax <lele@nautilus.eclipse.it>
To: Python List <python-list@cwi.nl>
Subject: Typos in ref manual
Hi all,
browsing the reference manual I noticed what seem two small errors:
a) in the list of keywords (section 2.3.1) 'exec' is missing
b) in the Operator Precedence table (5.12) the comparison operators
include '=', but probably '==' was intended.
Hope this help,
lele.
Guido van Rossum [Fri, 15 May 1998 22:04:07 +0000 (22:04 +0000)]
Another veeeeeery old patch...
Date: Thu, 14 Sep 1995 12:18:20 -0400
From: Alan Morse <alan@dvcorp.com>
To: python-list@cwi.nl
Subject: getargs bug in 1.2 and 1.3 BETA
We have found a bug in the part of the getargs code that we added
and submitted, and which was incorporated into 1.1.
The parsing of "O?" format specifiers is not handled correctly;
there is no "else" for the "if" and therefore it can never fail.
What's worse, the advancing of the varargs pointer is not
handled properly, so from then on it is out of sync, wreaking
all sorts of havoc. (If it had failed properly, then the out-of-sync
varargs would not have been an issue.)
Below is the context diff for the change.
Note that I have made a few stylistic changes beyond adding the
else case, namely:
1) Making the "O" case follow the convention established by the other
format specifiers of getting all their vararg arguments before
performing the test, rather than getting some before and some after
the test passes.
2) Making the logic of the tests parallel, so the "if" part indicates
that the format is accepted and the "else" part indicates that the
format has failed. They were inconsistent with each other and with the
the other format specifiers.
Guido van Rossum [Fri, 15 May 1998 20:26:31 +0000 (20:26 +0000)]
Change the output names. Do away with the Release and Debug
subdirectories.
All final products go into the current directory (i.e., PCbuild).
Object files go into temp-release and temp-debug.
Debug versions of DLLs have _d appended to their basename, e.g. the
debug version of python15.dll is python15_d.dll, the debug version of
python.exe is python_d.exe, and the debug version of parser.pyd is
parser_d.pyd. (See corresponding patch to importdl.c.) Uniformly
changed all extension modules to use .pyd, not .dll.