Commit Graph

8551 Commits

Author SHA1 Message Date
Guido van Rossum 3c8c5981b1 Sorry, the initializer for ob_type must really be NULL,
else the damn thing won't compile on Windows :-(
1998-05-29 02:58:20 +00:00
Guido van Rossum d3ab101fac Quick fix -- define SIZEOF_LONG and SIZEOF_INT. 1998-05-29 02:53:29 +00:00
Guido van Rossum 3600beefea Moved from PC 1998-05-29 02:32:57 +00:00
Guido van Rossum cd3462f1f7 Moving to PCbuild 1998-05-29 02:32:34 +00:00
Guido van Rossum 2a5119b680 On Windows, need #include <windows.h>; and it's MS_WINDOWS, not MS_WIN32. 1998-05-29 01:28:40 +00:00
Guido van Rossum e4e021bf21 Release the interpreter lock for calls that may block: _locking(),
_getch(), _getche().

Fix bogus error return when open_osfhandle() doesn't have the right
argument list.
1998-05-29 01:27:07 +00:00
Guido van Rossum 00d93066b0 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().
1998-05-28 23:06:38 +00:00
Guido van Rossum 7e7912f2ca Protect all uses of the random generator with a lock.
Particles break out of their loop when the main loop exits.
1998-05-28 23:02:33 +00:00
Guido van Rossum 3d3a52aa3a An example of a multi-threaded Tkinter program. 1998-05-28 22:52:01 +00:00
Guido van Rossum 1ad00717fb Patch by Lars Marius Garshol:
- Handle <? processing instructions >.

- Allow . and - in entity names.

Also fixed an oversight in the previous fix (in one place, [ \t\r\n]
was used instead of string.whitespace).
1998-05-28 22:48:53 +00:00
Guido van Rossum ae621ff7b7 Guard against changes in the list size during a compare or sort. 1998-05-28 20:18:46 +00:00
Guido van Rossum 578de30fd7 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).
1998-05-28 20:18:18 +00:00
Guido van Rossum 617c1b0116 Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred(). 1998-05-28 19:50:02 +00:00
Guido van Rossum 08570decb7 Uses PyErr_ExceptionMatches() instead of comparing PyErr_Occurred(). 1998-05-28 19:24:35 +00:00
Jack Jansen 41e825a8f4 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.
1998-05-28 14:22:48 +00:00
Jack Jansen 848250c15b 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).
1998-05-28 14:20:09 +00:00
Fred Drake d3dbb38e98 get_long(): Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred(...). 1998-05-28 04:35:49 +00:00
Fred Drake bebc97fcd7 t_bootstrap(): Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred(...). 1998-05-28 04:35:12 +00:00
Fred Drake 764b984db5 Use PyErr_ExceptionMatches(...) instead of PyErr_Occurred() == ... in two
places.
1998-05-28 04:33:37 +00:00
Jeremy Hylton 2b9d029308 add handler for JPython's org.python.core.PyStringMap object, which
walks and quacks like a dictionary.
1998-05-27 22:38:22 +00:00
Guido van Rossum f638d1c9dd Fix some comments; move 'import random' to top. 1998-05-26 21:43:44 +00:00
Guido van Rossum 90ce848848 On SGI, we need to define _SGI_MP_SOURCE before including errno.h when
we are threading, otherwise accessing errno doesn't work right.
1998-05-26 18:38:07 +00:00
Guido van Rossum 9be628338d Tim's quicksort on May 25. 1998-05-26 15:06:32 +00:00
Guido van Rossum 16653cb273 Add Tim's worst case scenario.
Revert to using whrandom so it will work with older versions of Python.
1998-05-26 15:05:12 +00:00
Guido van Rossum 7462942b69 Added some tests to make sure that long->int conversions near
sys.maxint and near -sys.maxint-1 work correctly.
1998-05-26 14:51:55 +00:00
Guido van Rossum f753181272 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
>>>

end-casing-ly y'rs  - tim
1998-05-26 14:33:37 +00:00
Guido van Rossum 2028dd0423 Replaced the VC++ 5.x instructions with a pointer to ../PCbuild. 1998-05-26 14:20:15 +00:00
Guido van Rossum 9c1bc5b1f6 Moved VC++ 5.x files to ../PCbuild. 1998-05-26 14:17:18 +00:00
Guido van Rossum 15b239f785 Moved VC++ 5.x stuff here. 1998-05-26 14:16:23 +00:00
Guido van Rossum 1c096b7289 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 :-)
1998-05-26 13:53:23 +00:00
Guido van Rossum 0f1e1fc3fa Don't die if win32api doesn't exist. 1998-05-26 02:51:40 +00:00
Guido van Rossum 55b40b06d2 Fix a dumb typo in the revparse() regular exception: {1-4} should be {1,4}.
Now you can click on revisions and diffs again!
1998-05-22 19:43:21 +00:00
Guido van Rossum a58e9edbef Document missing functions: xor, not, truth, countOf, indexOf, and
(new!) contains.
1998-05-22 18:48:37 +00:00
Guido van Rossum 7bf15648a4 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.

It still doesn't work for Mac or Windows :-(
1998-05-22 18:28:17 +00:00
Fred Drake 6a50ba82ce Minor grammatical correction: "This module perform ..." --> "This module
performs ...".
1998-05-22 18:19:19 +00:00
Fred Drake 5b34ec1b14 Fixed spelling in comment: "RFC", not "RFX". 1998-05-22 18:18:08 +00:00
Guido van Rossum 832f6d2890 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.
1998-05-22 18:12:59 +00:00
Guido van Rossum e9387ea773 introduce a new platform-specific variable: os.linesep is the
platform's line separator.  \n on Unix, \r\n on DOS, OS/2 and Windows,
\r on Macs.
1998-05-22 15:26:04 +00:00
Guido van Rossum fa0b6ab01a 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 ;-( )
1998-05-22 15:23:36 +00:00
Guido van Rossum 26fd98201f Change the last 4-space indent into a 1-tab indent. 1998-05-22 15:05:36 +00:00
Guido van Rossum 7ef2a1de9b Shouldn't use newdir.dir(), which no longer exists! 1998-05-22 14:11:57 +00:00
Guido van Rossum b88679b2a4 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.
1998-05-22 00:57:31 +00:00
Guido van Rossum c8498dc604 Add PyErr_PrintEx and PySequence_Contains. 1998-05-22 00:56:20 +00:00
Guido van Rossum 0dabacee16 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.
1998-05-22 00:55:34 +00:00
Guido van Rossum b1ed9c5295 PySequence_In() -> PySequence_Contains(). 1998-05-22 00:54:16 +00:00
Guido van Rossum 7df115de65 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.
1998-05-22 00:53:47 +00:00
Guido van Rossum 1c4f458099 In PyObject_IsTrue(), don't call function pointers that are NULL
(nb_nonzero, mp_length, sq_length).
1998-05-22 00:53:24 +00:00
Guido van Rossum 7e33c6e896 Moved cmp_member() to abstract.c, as PySequence_Contains() [with
swapped arguments].

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.
1998-05-22 00:52:29 +00:00
Guido van Rossum 09df08a105 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().
1998-05-22 00:51:39 +00:00
Guido van Rossum 44e4d5a6fd Renamed PySequence_In() to PySequence_Contains(). 1998-05-22 00:47:25 +00:00