Greg Ward [Thu, 29 Jun 2000 02:16:24 +0000 (02:16 +0000)]
Fixed so 'get_source_files()' calls 'check_extension_list()' -- that way,
we can run "sdist" on a distribution with old-style extension structures
even if we haven't built it yet. Bug spotted by Harry Gebel.
Greg Ward [Thu, 29 Jun 2000 02:06:29 +0000 (02:06 +0000)]
Fixed 'findall()' so it only returns regular files -- no directories.
Changed 'prune_file_list()' so it also prunes out RCS and CVS directories.
Added 'is_regex' parameter to 'select_pattern()', 'exclude_pattern()',
and 'translate_pattern()', so that you don't have to be constrained
by the simple shell-glob-like pattern language, and can escape into
full-blown regexes when needed. Currently this is only available
in code -- it's not exposed in the manifest template mini-language.
Added 'prune' option (controlled by --prune and --no-prune) to determine
whether we call 'prune_file_list()' or not -- it's true by default.
Fixed 'negative_opt' -- it was misnamed and not being seen by dist.py.
Added --no-defaults to the option table, so it's seen by FancyGetopt.
Guido van Rossum [Wed, 28 Jun 2000 23:53:56 +0000 (23:53 +0000)]
Vladimir Marangozov:
This patch fixes a problem on AIX with the signed int case code in
getargs.c, after Trent Mick's intervention about MIN/MAX overflow
checks. The AIX compiler/optimizer generates bogus code with the
default flags "-g -O" causing test_builtin to fail: int("10", 16) <>
16L. Swapping the two checks in the signed int code makes the problem
go away.
Also, make the error messages fit in 80 char lines in the
source.
Guido van Rossum [Wed, 28 Jun 2000 23:46:07 +0000 (23:46 +0000)]
Vladimir Marangozov:
Avoid calling the dealloc function, previously triggered with
DECREF(inst). This caused a segfault in PyDict_GetItem, called with a
NULL dict, whenever inst->in_dict fails under low-memory conditions.
Guido van Rossum [Wed, 28 Jun 2000 23:24:19 +0000 (23:24 +0000)]
Urmpf. Quality control on this patch lapsed a bit. :-(
The depth field was never decremented inside w_object(), and it was
never initialized in PyMarshal_WriteObjectToFile().
This caused imports from .pyc files to fil mysteriously when the .pyc
file was written by the broken code -- w_object() would bail out
early, but PyMarshal_WriteObjectToFile() doesn't check the error or
return an error code, and apparently the marshalling code doesn't call
PyErr_Check() either. (That's a separate patch if I feel like it.)
Guido van Rossum [Wed, 28 Jun 2000 22:47:22 +0000 (22:47 +0000)]
Peter Schneider-Kamp:
Problem:
A Python program can be completed and reformatted using
Tools/scripts/pindent.py. Unfortunately there is no option for removal
of the generated "# end"-tags. Although a few Python commands or a
"grep -v '# end '" can do wonders here, there are two drawbacks:
- not everyone has grep/time to write a Python script
- it is not checked whether the "# end"-tags were used validly
Solution:
add extra option "-e" (eliminate) to pindent.py
Guido van Rossum [Wed, 28 Jun 2000 22:26:21 +0000 (22:26 +0000)]
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*).
Guido van Rossum [Wed, 28 Jun 2000 22:23:56 +0000 (22:23 +0000)]
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.)
Guido van Rossum [Wed, 28 Jun 2000 21:18:13 +0000 (21:18 +0000)]
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?]
Guido van Rossum [Wed, 28 Jun 2000 21:12:25 +0000 (21:12 +0000)]
Trent Mick:
Various small fixes to the builtin module to ensure no buffer
overflows.
- chunk #1:
Proper casting to ensure no truncation, and hence no surprises, in the
comparison.
- chunk #2:
The id() function guarantees a unique return value for different
objects. It does this by returning the pointer to the object. By
returning a PyInt, on Win64 (sizeof(long) < sizeof(void*)) the pointer
is truncated and the guarantee may be proven false. The appropriate
return function is PyLong_FromVoidPtr, this returns a PyLong if that
is necessary to return the pointer without truncation.
[GvR: note that this means that id() can now return a long on Win32
platforms. This *might* break some code...]
- chunk #3:
Ensure no overflow in raw_input(). Granted the user would have to pass
in >2GB of data but it *is* a possible buffer overflow condition.
Fred Drake [Wed, 28 Jun 2000 20:15:47 +0000 (20:15 +0000)]
Revise the description of when functions retrieved from class instances
are and are not turned into bound methods; some confusion was noted by
Andrew Dalke.
In particular, it has to be noted that functions located on the class
instance are not turned into any sort of method, only those which are
found via the underlying class.
Fred Drake [Wed, 28 Jun 2000 18:47:56 +0000 (18:47 +0000)]
Michael Hudson <mwh21@cam.ac.uk>:
As I really do not have anything better to do at the moment, I have written
a patch to Python/marshal.c that prevents Python dumping core when trying
to marshal stack bustingly deep (or recursive) data structure.
It just throws an exception; even slightly clever handling of recursive
data is what pickle is for...
[Fred Drake:] Moved magic constant 5000 to a #define.
Fred Drake [Wed, 28 Jun 2000 17:50:51 +0000 (17:50 +0000)]
Trent Mick <trentm@activestate.com>:
Testing: test_array.py was also extended to check that one can set the
full range of values for each of the integral signed and unsigned
array types.
Fred Drake [Wed, 28 Jun 2000 17:49:30 +0000 (17:49 +0000)]
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.
Marc-Andre Lemburg <mal@lemburg.com>:
Perfect hash table generator. Outputs a Python extension module
which provides access to the hash table (which is stored in static
C data) using custom code.
This module can currently only generates code for the ucnhash
module, but can easily be adapted to produce perfect hash tables
for other tasks where fast lookup in large tables is needed.
Marc-Andre Lemburg <mal@lemburg.com>:
Patch to the standard unicode-escape codec which dynamically
loads the Unicode name to ordinal mapping from the module
ucnhash.
Fred Drake [Wed, 28 Jun 2000 16:40:38 +0000 (16:40 +0000)]
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.
Marc-Andre Lemburg <mal@lemburg.com>:
MSVC project file for the new module ucnhash. This may have to
be added to pcbuild.dsw with an dependancy on python16.
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.
Fred Drake [Wed, 28 Jun 2000 15:07:31 +0000 (15:07 +0000)]
Added the atexit module and documentation from Skip Montanaro
<skip@mojam.com>. Revisions to the markup to make it pass LaTeX, added
an index entry and a reference from the sys.exitfunc documentation.
Greg Ward [Wed, 28 Jun 2000 01:29:09 +0000 (01:29 +0000)]
Lyle Johnson: added 'build_temp' parameter to 'link_shared_{lib,object}()'
methods (but not 'link_executable()', hmmm). Currently only used by
BCPPCompiler; it's a dummy parameter for UnixCCompiler and MSVCCompiler.
Also added 'bcpp' to compiler table used by 'new_compiler()'.
Greg Ward [Wed, 28 Jun 2000 01:20:35 +0000 (01:20 +0000)]
Lyle Johnson's interface to Borland C++, with a few editorial comments by me.
Two major points:
* lots of overlap with MSVCCompiler; the common code really should be
factored out into a base class, say WindowsCCompiler
* it doesn't work: weird problem spawning the linker (see comment for
details)
Added support for mouse functions: mousemask(), mouseinterval(),
getmouse(), ungetmouse(), and window.enclose(). wmouse_trafo() seems
of marginal importance at the moment.
Greg Ward [Tue, 27 Jun 2000 01:59:06 +0000 (01:59 +0000)]
Fixed LDSHARED for AIX, based on a patch by Rene Liebscher.
Ditched my old code that fixed relative paths in the Makefile -- didn't work,
doomed to failure, etc.
Greg Ward [Tue, 27 Jun 2000 01:37:10 +0000 (01:37 +0000)]
Thomas Heller: added --swig-cpp option and fixed silly typos in SWIG support.
Also supposedly made some change to where .lib files wind up under MSVC++,
but I don't understand how to code is doing what Thomas says it's
doing.
Greg Ward [Tue, 27 Jun 2000 01:21:22 +0000 (01:21 +0000)]
Added 'include_dirs' parameters all over the place.
Added 'check_lib()', which provides a subset of the functionality of
'check_func()' with a simpler interface and implementation.