Barry Warsaw
bf32583084
string_join(): Fix memory leaks discovered by Charles Waldman (and a
...
few other paths through the function that leaked).
2000-03-06 14:52:18 +00:00
Guido van Rossum
43713e5a28
Massive patch by Skip Montanaro to add ":name" to as many
...
PyArg_ParseTuple() format string arguments as possible.
2000-02-29 13:59:29 +00:00
Guido van Rossum
ee28c3a5ea
Patch by Mozhe Zadka, for __contains__ (overloading 'in'). This adds
...
an instance method instance_contains as sq_contains. It looks for
__contains__ and if not found falls back to previous behaviour.
Done.
2000-02-28 15:03:15 +00:00
Guido van Rossum
46c6b20392
Patch by Mozhe Zadka, for __contains__ (overloading 'in'). This
...
patches PySequence_Contains() to check for a valid sq_contains field.
More to follow.
2000-02-28 15:01:46 +00:00
Guido van Rossum
c00a938be8
OKOK, Greg's right, I should've used the :name option in the argument
...
format strings.
2000-02-24 21:48:29 +00:00
Guido van Rossum
4aa24f9979
Made all list methods use PyArg_ParseTuple(), for more accurate
...
diagnostics.
*** INCOMPATIBLE CHANGE: This changes append(), remove(), index(), and
*** count() to require exactly one argument -- previously, multiple
*** arguments were silently assumed to be a tuple.
2000-02-24 15:23:03 +00:00
Andrew M. Kuchling
0f223d2418
Allow using long integers as arguments to PyObject_GetItem(), _SetItem(),
...
and _DelItem().
In sequence multiplication by a long, only call PyErr_Occurred() when the
value returned is -1.
2000-02-23 22:21:50 +00:00
Fred Drake
52fccfda5b
dict_has_key(): Accept only one parameter. PR#210 reported by
...
Andreas Jung <ajung@sz-sb.de>.
2000-02-23 15:47:16 +00:00
Guido van Rossum
fb4574e320
In response to one particular complaint on edu-sig, change some error
...
messages from "OverflowError: integer pow()" to "OverflowError:
integer exponentiation". (Not that this takes care of the complaint
in general that the error messages could be greatly improved. :-)
2000-02-15 14:51:46 +00:00
Andrew M. Kuchling
1991ddc3e1
Make multiplying a sequence by a long integer (5L * 'b') legal
2000-02-14 22:22:04 +00:00
Guido van Rossum
bffd683f73
The rest of the changes by Trent Mick and Dale Nagata for warning-free
...
compilation on NT Alpha. Mostly added casts etc.
2000-01-20 22:32:56 +00:00
Guido van Rossum
687ef6e70b
On Linux, one sometimes sees spurious errors after interrupting
...
previous output. Call clearerr() to prevent past errors affecting our
ferror() test later, in PyObject_Print(). Suggested by Marc Lemburg.
2000-01-12 16:28:58 +00:00
Guido van Rossum
57072eb79f
Implement the other easy thing: repr() of a float now uses %.17g,
...
while str() uses %.12g as before.
1999-12-23 19:00:28 +00:00
Fred Drake
121ee2722e
long_format(): Now takes a third parameter, addL; iff true, a
...
trailing 'L' is appended to the representation,
otherwise not.
All existing call sites are modified to pass true for
addL.
Remove incorrect statement about external use of this
function from elsewhere; it's static!
long_str(): Handler for the tp_str slot in the type object.
Identical to long_repr(), but passes false as the addL
parameter of long_format().
1999-12-23 15:41:28 +00:00
Barry Warsaw
153a27ceb2
do_strip(): Fixed cut-and-paste error; this function should check for
...
zero arguments (found by Marc Lemburg).
1999-12-15 02:22:52 +00:00
Barry Warsaw
226ae6ca12
Mainlining the string_methods branch. See branch revision log
...
messages for specific changes.
1999-10-12 19:54:53 +00:00
Guido van Rossum
2c7b8fe618
Fix PR#66. Solution: add error checking around l_divmod() calls in
...
long_pow().
1999-10-11 22:34:41 +00:00
Guido van Rossum
42636dc64d
Fix for PR#98 (Adrian Eyre) -- in instancemethod_repr, the funcname
...
object is DECREFed too early.
1999-10-11 14:03:12 +00:00
Guido van Rossum
e13ff2e2d6
Patch by Tim Peters fixing PR#88:
...
Integer division can crash under Windows.
1999-09-27 17:12:47 +00:00
Guido van Rossum
1a23c2484e
Patch by Tim Peters fixing PR#89:
...
long(+/- infinity) returns nonsense.
1999-09-27 17:11:52 +00:00
Guido van Rossum
ff7e83d606
Patch by Mark Hammond to avoid certain header files on Windows/CE.
1999-08-27 20:39:37 +00:00
Fred Drake
4574f23115
PyBuffer_New(): Raise ValueError if size is negative (the other
...
constructors didn't miss this).
Raise MemoryError if malloc() fails, instead of just
returning NULL.
1999-08-04 13:08:19 +00:00
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