Guido van Rossum [Thu, 11 Jun 1998 14:06:59 +0000 (14:06 +0000)]
Be more careful than the previous patch. The default content-type
should only be set to application/x-www-form-urlencoded when the
method is POST. E.g. for PUT, an empty default (defaulting to
text/plain later) makes more sense.
Guido van Rossum [Wed, 10 Jun 1998 21:31:01 +0000 (21:31 +0000)]
Some changes suggested/provided by Eric Raymond:
- explain seekable
- when seekable==1, test fp.tell() and set it to 0 if that fails
- support overridable method iscomment(line) to weed out comments
- check for unread() method on file object before trying to seek
And one of my own:
- Add a get() method which behaves like a dictionary's get(); this is
actually implemented by giving getheader() an optional second argument
to specify the default, and aliasing get to getheader.
Guido van Rossum [Wed, 10 Jun 1998 17:57:44 +0000 (17:57 +0000)]
Document several variables that were previously undocumented,
including the new __stdin__, __stdout__ and __stderr__.
Also moved setttrace around to its proper place in the alphabet.
Added notes about epochs, the year 2038, and a small Y2K disclaimer
(all with index entries!). Also update the list of functions that
take or yield a time represented as a 9-tuple.
Default content-type to application/x-www-form-urlencoded at the top
level of a form. This means that browsers that omit the content-type
header when sending a POST command aren't penalized so heavily.
When comparing objects of different types (which is done by comparing
the type names), make sure that numeric objects are considered smaller
than all other objects, by forcing their name to "".
When unmarshalling, add test for negative lengths on strings, tuples
and lists; if the size is negative, raise an exception. Also raise an
exception when an undefined type is found -- all this to increase the
chance that garbage input causes an exception instead of a core dump.
Guido van Rossum [Fri, 29 May 1998 17:51:31 +0000 (17:51 +0000)]
Make gauss() semi-thread-safe. It can still give duplicate results,
but it can no longer raise an exception when called by several threads
simultaneously.
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.