Neal Norwitz
38d4d4a35b
Fix memory leak found by valgrind.
2006-06-02 04:50:49 +00:00
Tim Peters
d770ebd286
Armin committed his patch while I was reviewing it (I'm sure
...
he didn't know this), so merged in some changes I made during
review. Nothing material apart from changing a new `mask` local
from int to Py_ssize_t. Mostly this is repairing comments that
were made incorrect, and adding new comments. Also a few
minor code rewrites for clarity or helpful succinctness.
2006-06-01 15:50:44 +00:00
Armin Rigo
35f6d36951
[ 1497053 ] Let dicts propagate the exceptions in user __eq__().
...
[ 1456209 ] dictresize() vulnerability ( <- backport candidate ).
2006-06-01 13:19:12 +00:00
Georg Brandl
6b50c63a23
Correctly allocate complex types with tp_alloc. (bug #1498638 )
2006-06-01 08:27:32 +00:00
Georg Brandl
85ac850834
Correctly unpickle 2.4 exceptions via __setstate__ (patch #1498571 )
2006-06-01 06:39:19 +00:00
Neal Norwitz
b16e4e7860
Remove ; at end of macro. There was a compiler recently that warned
...
about extra semi-colons. It may have been the HP C compiler.
This file will trigger a bunch of those warnings now.
2006-06-01 05:32:49 +00:00
Fredrik Lundh
9e9ef9fa5a
changed count to return 0 for slices outside the source string
2006-05-30 17:39:58 +00:00
Fredrik Lundh
93eff6fecd
changed find/rfind to return -1 for matches outside the source string
2006-05-30 17:11:48 +00:00
Tim Peters
9faa3eda6b
PyLong_FromString(): Continued fraction analysis (explained in
...
a new comment) suggests there are almost certainly large input
integers in all non-binary input bases for which one Python digit
too few is initally allocated to hold the final result. Instead
of assert-failing when that happens, allocate more space. Alas,
I estimate it would take a few days to find a specific such case,
so this isn't backed up by a new test (not to mention that such
a case may take hours to run, since conversion time is quadratic
in the number of digits, and preliminary attempts suggested that
the smallest such inputs contain at least a million digits).
2006-05-30 15:53:34 +00:00
Georg Brandl
b0432bc032
Do the check for no keyword arguments in __init__ so that
...
subclasses of Exception can be supplied keyword args
2006-05-30 08:17:00 +00:00
Georg Brandl
861089fc49
Disallow keyword args for exceptions.
2006-05-30 07:34:45 +00:00
Georg Brandl
05f97bffac
Add a test case for exception pickling. args is never NULL.
2006-05-30 07:13:29 +00:00
Georg Brandl
ddba473e26
Restore exception pickle support. #1497319 .
2006-05-30 07:04:55 +00:00
Tim Peters
33f4a6a31a
dict_print(): So that Neal & I don't spend the rest of
...
our lives taking turns rewriting code that works ;-),
get rid of casting illusions by declaring a new variable
with the obvious type.
2006-05-30 05:23:59 +00:00
Tim Peters
638144305c
dict_print(): Explicitly narrow the return value
...
from a (possibly) wider variable.
2006-05-30 05:04:59 +00:00
Neal Norwitz
5e1b45dc21
No DOWNCAST is required since sizeof(Py_ssize_t) >= sizeof(int) and Py_ReprEntr returns an int
2006-05-30 04:43:23 +00:00
Neal Norwitz
d3881b026c
Use Py_SAFE_DOWNCAST for safety. Fix format strings. Remove 2 more stray | in comment
2006-05-30 04:25:05 +00:00
Neal Norwitz
80af59cbd4
Remove stray | in comment
2006-05-30 04:19:21 +00:00
Tim Peters
9b10f7e0cb
Convert relevant dict internals to Py_ssize_t.
...
I don't have a box with nearly enough RAM, or an OS,
that could get close to tickling this, though (requires
a dict w/ at least 2**31 entries).
2006-05-30 04:16:25 +00:00
Fredrik Lundh
b51b470eb8
fixed "abc".count("", 100) == -96 error (hopefully, nobody's relying on
...
the current behaviour ;-)
2006-05-29 22:42:07 +00:00
Georg Brandl
96a8c3954c
Make use of METH_O and METH_NOARGS where possible.
...
Use Py_UnpackTuple instead of PyArg_ParseTuple where possible.
2006-05-29 21:04:52 +00:00
Georg Brandl
2cfaa34dfa
Correct some value converting strangenesses.
2006-05-29 19:39:45 +00:00
Georg Brandl
c7c51147c7
Fix refleak in socketmodule. Replace bogus Py_BuildValue calls.
...
Fix refleak in exceptions.
2006-05-29 09:46:51 +00:00
Thomas Wouters
c1282eef0c
Make last patch valid C89 so Windows compilers can deal with it.
2006-05-28 21:32:12 +00:00
Michael W. Hudson
27596279a2
use the UnicodeError traversal and clearing functions in UnicodeError
...
subclasses.
2006-05-28 21:19:03 +00:00
Georg Brandl
43ab100cdc
Fix refleaks in UnicodeError get and set methods.
2006-05-28 20:57:09 +00:00
Michael W. Hudson
96495ee6dd
Quality control, meet exceptions.c, round two.
...
Make some functions that should have been static static.
Fix a bunch of refleaks by fixing the definition of
MiddlingExtendsException.
Remove all the __new__ implementations apart from
BaseException_new. Rewrite most code that needs it to cope with
NULL fields (such code could get excercised anyway, the
__new__-removal just makes it more likely). This involved
editing the code for WindowsError, which I can't test.
This fixes all the refleaks in at least the start of a regrtest
-R :: run.
2006-05-28 17:40:29 +00:00
Michael W. Hudson
22a80e7cb0
Quality control, meet exceptions.c.
...
Fix a number of problems with the need for speed code:
One is doing this sort of thing:
Py_DECREF(self->field);
self->field = newval;
Py_INCREF(self->field);
without being very sure that self->field doesn't start with a
value that has a __del__, because that almost certainly can lead
to segfaults.
As self->args is constrained to be an exact tuple we may as well
exploit this fact consistently. This leads to quite a lot of
simplification (and, hey, probably better performance).
Add some error checking in places lacking it.
Fix some rather strange indentation in the Unicode code.
Delete some trailing whitespace.
More to come, I haven't fixed all the reference leaks yet...
2006-05-28 15:51:40 +00:00
Fredrik Lundh
80f8e80c15
needforspeed: added Py_MEMCPY macro (currently tuned for Visual C only),
...
and use it for string copy operations. this gives a 20% speedup on some
string benchmarks.
2006-05-28 12:06:46 +00:00
Richard Jones
2d555b356a
move semicolons
2006-05-27 16:15:11 +00:00
Richard Jones
c5b2a2e7b9
doc string additions and tweaks
2006-05-27 16:07:28 +00:00
Fredrik Lundh
0b7ef46950
needforspeed: stringlib refactoring: use find_slice for stringobject
2006-05-27 15:26:19 +00:00
Fredrik Lundh
60d8b18831
needforspeed: stringlib refactoring: changed find_obj to find_slice,
...
to enable use from stringobject
2006-05-27 15:20:22 +00:00
Fredrik Lundh
c2d29c5a6d
needforspeed: replace improvements, changed to Py_LOCAL_INLINE
...
where appropriate
2006-05-27 14:58:20 +00:00
Georg Brandl
94b8c122fd
Remove spurious semicolons after macro invocations.
2006-05-27 14:41:55 +00:00
Andrew Dalke
d49d5c49ba
cleanup - removed trailing whitespace
2006-05-27 14:16:40 +00:00
Richard Jones
7b9558d37d
Conversion of exceptions over from faked-up classes to new-style C types.
2006-05-27 12:29:24 +00:00
Martin v. Löwis
2e3f6b77d5
Revert bogus change committed in 46432 to this file.
2006-05-27 11:07:49 +00:00
Andrew Dalke
e0df762719
fixed typo
2006-05-27 11:04:36 +00:00
Fredrik Lundh
2d23d5bf2e
needforspeed: more stringlib refactoring
2006-05-27 10:05:10 +00:00
Martin v. Löwis
d004fc810a
Patch 1494554: Update numeric properties to Unicode 4.1.
2006-05-27 08:36:52 +00:00
Neal Norwitz
d1b6cd7bfb
Fix Coverity warnings.
...
- Check the correct variable (str_obj, not str) for NULL
- sep_len was already verified it wasn't 0
2006-05-27 05:21:30 +00:00
Andrew Dalke
7e0a62ea90
Added description of why splitlines doesn't use the prealloc strategy
2006-05-26 22:49:03 +00:00
Andrew Dalke
5132407868
Added limits to the replace code so it does not count all of the matching
...
patterns in a string, only the number needed by the max limit.
2006-05-26 20:25:22 +00:00
Georg Brandl
e4e023c4d3
Simplify calling.
2006-05-26 20:22:50 +00:00
Andrew M. Kuchling
07bbfc6a51
Comment typo
2006-05-26 19:51:10 +00:00
Fredrik Lundh
e6e43c867d
needforspeed: stringlib refactoring: use stringlib/find for string find
2006-05-26 19:48:07 +00:00
Fredrik Lundh
c816281304
needforspeed: use a macro to fix slice indexes
2006-05-26 19:33:03 +00:00
Fredrik Lundh
ce4eccb0c4
needforspeed: stringlib refactoring: use stringlib/find for unicode
...
find
2006-05-26 19:29:05 +00:00
Fredrik Lundh
58b5e84d52
needforspeed: stringlib refactoring, continued. added count and
...
find helpers; updated unicodeobject to use stringlib_count
2006-05-26 19:24:53 +00:00