Commit Graph

1512 Commits

Author SHA1 Message Date
Guido van Rossum cc6a438d7f Trent Mick:
Fix warnings on 64-bit build build of signalmodule.c

- Though I know that SIG_DFL and SIG_IGN are just small constants,
there are cast to function pointers so the appropriate Python call is
PyLong_FromVoidPtr so that the pointer value cannot overflow on Win64
where sizeof(long) < sizeof(void*).
2000-06-28 22:26:21 +00:00
Guido van Rossum 534b7c5c96 Trent Mick:
This patch fixes cPickle.c for 64-bit platforms.

- The false assumption sizeof(long) == size(void*) exists where
PyInt_FromLong is used to represent a pointer. The safe Python call
for this is PyLong_FromVoidPtr. (On platforms where the above
assumption *is* true a PyInt is returned as before so there is no
effective change.)

- use size_t instead of int for some variables
2000-06-28 22:23:56 +00:00
Guido van Rossum fa48116993 Trent Mick: use size_t instead of int where appropriate (time_strftime()). 2000-06-28 21:33:59 +00:00
Guido van Rossum e826895d48 Trent Mick: use size_t instead of int where appropriate (set_key()). 2000-06-28 21:31:10 +00:00
Guido van Rossum 26418a90f0 Trent Mick: use size_t instead of int where appropriate (call_readline()). 2000-06-28 21:30:31 +00:00
Guido van Rossum 2650a42f0b Trent Mick: use size_t instead of int where appropriate (mpz_format()). 2000-06-28 21:29:47 +00:00
Guido van Rossum b6f657c0cc Trent Mick: use size_t instead of int where appropriate (various spots). 2000-06-28 21:29:03 +00:00
Guido van Rossum 7d0ae5e14e Trent Mick: use size_t instead of int where appropriate (in
fromfile(), to hold fread() result.)
2000-06-28 21:27:21 +00:00
Guido van Rossum 2f8a054418 Trent Mick: use size_t instead of int where appropriate (in strxfrm(),
to hold strlen() outcome).
2000-06-28 21:23:33 +00:00
Guido van Rossum 3262e16753 Trent Mick:
This patches fixes a possible overflow of the optional timeout
parameter for the select() function (selectmodule.c). This timeout is
passed in as a double and then truncated to an int. If the double is
sufficiently large you can get unexpected results as it
overflows. This patch raises an overflow if the given select timeout
overflows.

[GvR: To my embarrassment, the original code was assuming an int could
always hold a million.  Note that the overflow check doesn't test for
a very large *negative* timeout passed in -- but who in the world
would do such a thing?]
2000-06-28 21:18:13 +00:00
Guido van Rossum 40ced50cb0 Jack Jansen: Mac Carbon: don't include sys/types if we don't have it 2000-06-28 20:56:30 +00:00
Fred Drake 541dc3b7b2 Trent Mick <trentm@activestate.com>:
The cause: Relatively recent (last month) patches to getargs.c added
overflow checking to the PyArg_Parse*() integral formatters thereby
restricting 'b' to unsigned char value and 'h','i', and 'l' to signed
integral values (i.e. if the incoming value is outside of the
specified bounds you get an OverflowError, previous it silently
overflowed).

The problem: This broke the array module (as Fredrik pointed out)
because *its* formatters relied on the loose allowance of signed and
unsigned ranges being able to pass through PyArg_Parse*()'s
formatters.

The fix: This patch fixes the array module to work with the more
strict bounds checking now in PyArg_Parse*().

How: If the type signature of a formatter in the arraymodule exactly
matches one in PyArg_Parse*(), then use that directly. If there is no
equivalent type signature in PyArg_Parse*() (e.g. there is no unsigned
int formatter in PyArg_Parse*()), then use the next one up and do some
extra bounds checking in the array module.

This partially closes SourceForge patch #100506.
2000-06-28 17:49:30 +00:00
Marc-André Lemburg 2dabf69f5c Marc-Andre Lemburg <mal@lemburg.com>:
Added new ucnhash module by Bill Tutt.
2000-06-28 16:42:39 +00:00
Marc-André Lemburg b0c0ecfa26 Marc-Andre Lemburg <mal@lemburg.com>:
Added new ucnhash module.
2000-06-28 16:42:14 +00:00
Fred Drake 8cef4cf737 Thomas Wouters <thomas@xs4all.net>:
This patch adds the openpty() and forkpty() library calls to posixmodule.c,
when they are available on the target
system. (glibc-2.1-based Linux systems, FreeBSD and BSDI at least, probably
the other BSD-based systems as well.)

Lib/pty.py is also rewritten to use openpty when available, but falls
back to the old SGI method or the "manual" BSD open-a-pty
code. Openpty() is necessary to use the Unix98 ptys under Linux 2.2,
or when using non-standard tty names under (at least) BSDI, which is
why I needed it, myself ;-) forkpty() is included for symmetry.
2000-06-28 16:40:38 +00:00
Marc-André Lemburg 8fb8748a5f Marc-Andre Lemburg <mal@lemburg.com>:
New ucnhash module by Bill Tutt. This module contains the hash
table needed to map Unicode character names to Unicode ordinals
and is loaded on-the-fly by the standard unicode-escape codec.
2000-06-28 16:38:56 +00:00
Andrew M. Kuchling a1e4b05ac4 Fixes for compiling on Tru64.
Define a STRICT_SYSV_CURSES macro on SGI, Sun, and Tru64, to mark systems
that don't support some features.
2000-06-27 21:49:47 +00:00
Andrew M. Kuchling b6e468796a Fix two typos (, instead of ;) 2000-06-27 15:01:10 +00:00
Andrew M. Kuchling 8e9d23b250 Added support for mouse functions: mousemask(), mouseinterval(),
getmouse(), ungetmouse(), and window.enclose().  wmouse_trafo() seems
of marginal importance at the moment.
2000-06-27 03:10:38 +00:00
Andrew M. Kuchling beba056cd7 Added support for passing Unicode strings to Expat handlers by default.
This version still includes #ifdef hackery to compile with 1.5.2.
2000-06-27 00:33:30 +00:00
Andrew M. Kuchling f419572708 Release the global interpreter lock around the most important
functions that might block or pause
2000-06-23 01:36:21 +00:00
Andrew M. Kuchling 97311bbb0e Added .timeout() method and .typeahead() function 2000-06-21 01:41:48 +00:00
Fred Drake aef1000bff Fixed docstring typo, reported by Skip Montanaro <skip@mojam.com>. 2000-06-19 13:17:41 +00:00
Andrew M. Kuchling 288e97b7fe Patch from Michael Hudson to fix flatten recursive data structures:
[mwh21@atrus build]$ ./python
>>> import Tkinter
>>> l = []
>>> l.append(l)
>>> Tkinter._flatten(l)
Segmentation fault (core dumped)
2000-06-19 00:55:09 +00:00
Andrew M. Kuchling ea34a84e54 Patch from Lorenzo M. Catucci:
I discovered the [MREMAP_MAYMOVE] symbol is only defined when _GNU_SOURCE is
defined; therefore, here is the change: if we are compiling for linux,
define _GNU_SOURCE before including mman.h, and all is done.
2000-06-18 19:06:49 +00:00
Andrew M. Kuchling e475e70128 Patch from /F:
this patch adds a fast _flatten function to the _tkinter
module, and imports it from Tkinter.py (if available).

this speeds up canvas operations like create_line and
create_polygon.  for example, a create_line with 5000
vertices runs about 50 times faster with this patch in
place.
2000-06-18 18:45:50 +00:00
Andrew M. Kuchling 6fef30e1fa Support resizing the mapping depending on whether HAVE_MREMAP is defined
Remove two unused variables
2000-06-18 14:51:21 +00:00
Andrew M. Kuchling 70d2742fce Patch from Trent Mick:
The seek() method is broken for any 'whence' value (seek from
	start, current, orend) other than the default. I have a patch
	that fixes that as well as gets mmap'd files working on
	Linux64 and Win64.
2000-06-18 04:45:14 +00:00
Andrew M. Kuchling 9bc5f3339a Removed MS_INVALIDATE flags 2000-06-18 04:25:08 +00:00
Andrew M. Kuchling 7b9fb92932 Fix the size() method to return the size of the file on Unix, not the
size of the mapped area.  This seems to be what the Windows version does.
This change requires keeping around the fd of the mapped file.
2000-06-17 22:41:22 +00:00
Andrew M. Kuchling b7f198e01a Renamed the C extension for ncurses support from 'curses' to '_curses'.
(The SourceForge admins have been asked to rename the ,v file.)
2000-06-10 23:12:32 +00:00
Marc-André Lemburg 753131c90a Marc-Andre Lemburg <mal@lemburg.com>:
The locale module is turned on per default.
2000-06-07 09:12:54 +00:00
Andrew M. Kuchling 54c8dc2144 Patch from Trent Mick:
Fix a small bug in posixmodule.c where a char* is being
	dereferenced where it should not be.
2000-06-06 20:52:17 +00:00
Andrew M. Kuchling 841b9fbebb Use PyArg_ParseTuple and specify the method names, following a suggestion
from Greg Stein
2000-06-03 20:43:43 +00:00
Andrew M. Kuchling 961fe17b4c Add missing PyArg_NoArgs() calls to methods that didn't take arguments
(Pointed out by Moshe Zadka)
2000-06-03 19:41:42 +00:00
Jeremy Hylton b1aa19515f Fredrik Lundh: here's the 96.6% version of SRE 2000-06-01 17:39:12 +00:00
Andrew M. Kuchling 94c3452ade Fix bug reported by atkins@gweep.net; re.compile(r"[\100-\410]")
dumps core.  Solution: fix check_escape() to match its comment and
   use only the low 8 bits of the octal number.
2000-06-01 03:02:48 +00:00
Fred Drake 137507ea03 Michael Hudson <mwh21@cam.ac.uk>:
Removed PyErr_BadArgument() calls and replaced them with more useful
error messages.
2000-06-01 02:02:46 +00:00
Jeremy Hylton 847a9968e9 Patch from M.-A. Lemburg:
Python on UNIX now trusts PYTHONHOME unconditionally

Modules/getpath.c:

Landmark changed to os.py.

Setting PYTHONHOME now unconditionally sets sys.prefix
(and sys.exec_prefix). No further checks are done whether the
standard lib can be found in that location or not. This is in
sync with the PC subdir getpath implementations.

PC/getpathp.c:

Landmark changed to os.py.

PC/os2vacpp/getpathp.c:

Landmark changed to os.py.

Note: BAW's checkin on exceptions.c eliminates earlier concerns about
a bogus PYTHONHOME value leading to a core dump.  Instead it causes a
useless sys.path and prevents imports.
2000-05-26 21:49:07 +00:00
Barry Warsaw c8019add6c _exceptions.c is moved to ../Python/exceptions.c 2000-05-26 19:03:19 +00:00
Barry Warsaw b1387aa7af The _exceptions module is moved to the Python subdirectory. 2000-05-26 19:02:42 +00:00
Barry Warsaw 8415edb433 Built-in class-based standard exceptions. Written by Fredrik Lundh.
Modified, proofread, and integrated for Python 1.6 by Barry Warsaw.
2000-05-25 23:18:47 +00:00
Barry Warsaw cfa2dba720 Added the _exceptions module, implementing the built-in class-based
standard exceptions.
2000-05-25 23:10:52 +00:00
Andrew M. Kuchling 03e644b851 Changes by AMK: Use HAVE_NCURSES_H to include correct header file
Lots of typo fixes (a bit too much cut-and-paste in this module)
Aliases removed: attr_on, attr_off, attr_set
Lowercased the names COLOR_PAIR and PAIR_NUMBER
#ifdef's for compiling on Solaris added (need to understand SYSV curses
    versions better and generalize this)
Bumped version number bumped to 1.6
2000-05-23 16:24:54 +00:00
Andrew M. Kuchling 22b88ce6bf Oliver Andrich's ncurses-specific curses module, version 1.5b1 2000-05-23 16:18:03 +00:00
Fred Drake 11b093641a Donn Cave <donn@oz.net>:
BeOS (up to 5.0) lacks <netinet/tcp.h>.
2000-05-16 13:30:12 +00:00
Guido van Rossum c9a5f343bc The addition of rint() (by Peter Schneider-Kamp; I forgot to mention
that before) in the previous patch has one problem; rint() is not in
the C math library on all platforms (e.g. not for VC++).  Make it
conditional on HAVE_RINT.
2000-05-11 18:42:27 +00:00
Guido van Rossum 71260b846e Added math.rint() -- round according to current IEEE754 mode 2000-05-11 18:19:42 +00:00
Fred Drake aff601804d M.-A. Lemburg <mal@lemburg.com>:
Fixed a bug due to a /* inside /*...*/. GCC doesn't like
this and bombs.
2000-05-09 19:52:40 +00:00
Guido van Rossum ea2b7157ab New version from Jim Fulton to fix a problem that Eric Raymond ran
into.  Jim writes:

The core dump was due to a C decrement operation
in a macro invocation in load_pop.  (BAD)

I fixed this by moving the decrement outside
the macro call.

I added a comment to load_pop and load_mark
to document the fact that cPickle separates the
unpickling stack into two separate stacks, one for
objects and one for marks.

I also moved some increments out of some macro
calls (PyTuple_SET_ITEM and PyList_SET_ITEM).
This wasn't necessary, but made me feel better. :)

I tested these changes in *my* cPickle, which
doesn't have the new Unicode stuff.
2000-05-09 18:14:50 +00:00