Guido van Rossum
0eb55ac912
Mark Favas was quick to note that the last checkin divides by zero
...
when n == 0... So divide by a->ob_size instead which was already
tested for 0.
1999-07-13 05:41:12 +00:00
Guido van Rossum
5bc51f2f27
Appropriate overflow checks so that things like sys.maxint*(1,) can't
...
dump core.
1999-07-12 23:06:58 +00:00
Guido van Rossum
fa71701d46
When deallocating a list, DECREF the items from the end back to the start.
1999-06-09 15:19:34 +00:00
Guido van Rossum
98c9eba945
Fix bug discovered by John W. Shipman -- when the width of a format
...
specifier came from an int expression instead of a constant in the
format, a negative width was truncated to zero instead of taken to
mean the same as that negative constant plugged into the format. E.g.
"(%*s)" % (-5, "foo") yielded "(foo)" while "(%-5s)" yields "(foo )".
Now both yield the latter -- like sprintf() in C.
1999-06-07 15:12:32 +00:00
Guido van Rossum
9263e78ff2
Tim Peters writes:
...
1. Fixes float divmod so that the quotient it returns is always an integral
value.
2. Fixes float % and float divmod so that the remainder always gets the
right sign (the current code uses a "are the signs different?" test that
doesn't work half the time <wink> when the product of the divisor and the
remainder underflows to 0).
1999-05-06 14:26:34 +00:00
Guido van Rossum
9bcd1d7931
Improve text of some error messages, as suggested by Sean Reifschneider.
1999-04-19 17:44:39 +00:00
Guido van Rossum
ff1ccbfc21
casts for picky compilers.
1999-04-10 15:48:23 +00:00
Guido van Rossum
2bc137909d
Vladimir Marangozov contributed updated comments.
1999-03-24 19:06:42 +00:00
Guido van Rossum
cd037e7bed
Folded long lines.
1999-03-24 19:05:31 +00:00
Guido van Rossum
d7b5fb858c
Fix a problem with Vladimir's PyFloat_Fini code: clear the free list; if
...
a block cannot be freed, add its free items back to the free list.
This is necessary to avoid leaking when Python is reinitialized later.
1999-03-19 20:59:40 +00:00
Guido van Rossum
51288bce48
Fix a problem with Vladimir's PyInt_Fini code: clear the free list; if
...
a block cannot be freed, add its free items back to the free list, and
add its valid ints back to the small_ints array if they are in range.
This is necessary to avoid leaking when Python is reinitialized later.
1999-03-19 20:30:39 +00:00
Guido van Rossum
49ded3ec00
Added check for negative offset for PyBuffer_FromObject and check for
...
negative size for PyBuffer_FromMemory. Greg Stein.
1999-03-19 19:04:25 +00:00
Guido van Rossum
3fce883922
Vladimir has restructured his code somewhat so that the blocks are now
...
represented by an explicit structure. (There are still too many casts
in the code, but that may be unavoidable.)
Also added code so that with -vv it is very chatty about what it does.
1999-03-12 19:43:17 +00:00
Guido van Rossum
f61bbc8182
OK, try again. Vladimir gave me a fix for the alignment bus error,
...
so here's his patch again. This time it works (at least on Solaris,
Linux and Irix).
1999-03-12 00:12:21 +00:00
Guido van Rossum
a060fb2598
Alas, Vladimir's patch caused a bus error (probably double
...
alignment?), and I didn't test it. Withdrawing it for now.
1999-03-11 01:47:00 +00:00
Guido van Rossum
881928f7ab
Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
...
floats on finalization.
1999-03-10 22:55:47 +00:00
Guido van Rossum
da084edd38
Patch by Vladimir Marangoz to allow freeing of the allocated blocks of
...
integers on finalization.
1999-03-10 22:55:24 +00:00
Guido van Rossum
98cc19fac6
Patch by Chris Petrilli to display the origin of a module in its
...
repr() -- either "(builtin)" or "from '<filename>'".
1999-02-15 14:47:16 +00:00
Guido van Rossum
00d225ea6d
Correct typo (Py_MethodDef doesn't exist). Reported by Uwe Zessin.
1999-01-29 14:39:12 +00:00
Barry Warsaw
b5cebfe164
PyLong_FromString(): Nailed a small memory leak. In the str==start
...
test, we forgot that z is still pointing to a real live object.
DECREF() it before returning.
1999-01-27 17:48:27 +00:00
Guido van Rossum
3bbef60990
Ai! complex_nonzero() has && which should be ||, else decidedly
...
non-zero things like 5j and complex(1,0) are considered to be
zero/false. Tim Peters.
1999-01-25 19:42:19 +00:00
Guido van Rossum
3aa23fdd47
Jim Ahlstrom patch: cutoff should be a long for machines with 16-bit
...
ints. (In theory, other variables should be widened to long as well,
but this won't ever be needed, since the len of a list is still an
int.)
1999-01-14 19:01:53 +00:00
Guido van Rossum
3c25904a98
Jim Ahlstrom patch: BIGCHUNK is too large for 16-bit int.
1999-01-14 19:00:14 +00:00
Guido van Rossum
031d0e5feb
Patch by Charles Waldman -- remove unneeded and even harmful test for
...
float to the negative power (which is already and better done in
floatobject.c.)
1999-01-10 16:56:58 +00:00
Guido van Rossum
5dadf7e976
Use 'xrange', not 'range', in error messages. Reported by Nathan Sullivan.
1999-01-09 21:40:35 +00:00
Guido van Rossum
41498435ba
Need to include <sys/types.h> for off_t.
1999-01-07 22:09:51 +00:00
Guido van Rossum
3c9fe0cce3
Changes for long file support by Steve Clift.
...
(This also redoes my previous patch, but better.)
1999-01-06 18:51:17 +00:00
Guido van Rossum
cdd9ae00ba
Changes for long file support by Steve Clift.
...
(Really: moved a bunch of defs to longobject.h.)
1999-01-06 18:50:37 +00:00
Guido van Rossum
88303194a5
Fix two places (seek and truncate) where a cascade of PyArg_Parse
...
calls was used instead of a single PyArg_ParseTuple call with an
optional argument.
1999-01-04 17:22:18 +00:00
Guido van Rossum
cada2938f7
As noted by Per Cederqvist, new_buffersize() sometimes returns the
...
buffer increment, and sometimes the new buffer size. Make it do what
its name says, and fix the one place where this matters to the caller.
Also add a comment explaining why we call lseek() and then ftell().
1998-12-11 20:44:56 +00:00
Guido van Rossum
68055ce6fe
When tracing references, reset the type and size of tuples allocated
...
from the fast free list -- the type (at least) is reset by
_Py_Dealloc().
1998-12-11 14:56:38 +00:00
Guido van Rossum
f5046d1aea
Remove prototype for PyOS_strtol -- Chris Herborth.
1998-12-10 16:54:48 +00:00
Guido van Rossum
13fdf5e917
When comparing bound methods, use identity test on the objects,
...
not equality test.
1998-12-04 18:52:55 +00:00
Guido van Rossum
f05fc716d1
Remove dead code discovered by Vladimir Marangozov.
1998-11-16 22:46:30 +00:00
Guido van Rossum
017f7780a8
Make tuples less hungry -- an extra item was allocated but never used.
...
Tip by Vladimir Marangozov.
1998-11-16 18:56:03 +00:00
Guido van Rossum
f61618c98e
A Py_DECREF(f) is missing in PyFrame_New for the error case when
...
the `builtins' initialization fails. Vladimir Marangozov.
1998-10-19 14:20:20 +00:00
Guido van Rossum
2f3667a7b9
Replace fprintf(stderr, ...) with PySys_WriteStderr(...).
1998-10-12 18:23:55 +00:00
Barry Warsaw
dedf6d6804
listextend(): New method which implements L.extend(L2).
1998-10-09 16:37:25 +00:00
Guido van Rossum
3886026bed
Remove unreachable code. (Sjoerd)
1998-10-09 13:27:19 +00:00
Guido van Rossum
1db7070217
Greg Stein: Implement the new bf_getcharbuffer function, indicating
...
that (as far as the data type is concerned!) this is character data.
1998-10-08 02:18:52 +00:00
Guido van Rossum
7148ca9d14
Make gcc -Wall happy.
1998-10-07 16:22:12 +00:00
Guido van Rossum
06c18088d6
Add Greg Stein's buffer object API.
1998-10-07 14:41:13 +00:00
Guido van Rossum
2e19bd7cc7
Add Greg Stein's buffer object API.
1998-10-07 14:36:10 +00:00
Guido van Rossum
2ccaf6f2f9
Remove a redundant check from list_slice() and list_ass_slice().
...
Noted by Greg Stein.
1998-10-07 13:24:13 +00:00
Guido van Rossum
c1c7b1a699
Slight rearrangement of code in lookdict() by Vladimir Marangozov, to
...
make a common case slightly faster.
1998-10-06 16:01:14 +00:00
Guido van Rossum
9d904b9389
Believe it or not, Solaris 2.6 strtod() can move the end pointer
...
*beyond* the null byte at the end of the input string, when the input
is inf(inity). Discovered by Greg Ward.
1998-10-01 20:35:46 +00:00
Guido van Rossum
07d780089d
Typo reported by Greg Stein: "modifiable" is the correct spelling.
1998-10-01 15:59:48 +00:00
Guido van Rossum
67906af811
In PyFrame_New(), don't set extras to something derived from code
...
before code has been checked for validity. Discovered by Vladimir
Marangozov.
1998-09-25 14:11:46 +00:00
Guido van Rossum
78694d970f
Patches from Greg Stein to support 'P' format in struct module's
...
native format, as void* (translated to Python int or long).
Also adds PyLong_FromVoidPtr and PyLong_AsVoidPtr to longobject.c.
1998-09-18 14:14:13 +00:00
Guido van Rossum
065ce5a4b7
Undo victim of careless global substitute ("long long_hash" was
...
changed to "LONG_LONG_hash" in the list of forward decls). Discovered
by Jason Harper.
1998-09-13 15:37:20 +00:00