Barry Warsaw [Tue, 11 Jul 2000 04:58:12 +0000 (04:58 +0000)]
string_join(): Some cleaning up of reference counting. In the
seqlen==1 clause, before returning item, we need to DECREF seq. In
the res=PyString... failure clause, we need to goto finally to also
decref seq (and the DECREF of res in finally is changed to a
XDECREF). Also, we need to DECREF seq just before the
PyUnicode_Join() return.
Jeremy Hylton [Tue, 11 Jul 2000 03:28:17 +0000 (03:28 +0000)]
fix two refcount bugs in new string_join implementation:
1. PySequence_Fast_GET_ITEM is a macro and borrows a reference
2. The seq returned from PySequence_Fast must be decref'd
Tim Peters [Mon, 10 Jul 2000 22:41:30 +0000 (22:41 +0000)]
Now that prototypes are in scope, the compiler gives legit wngs
about int size mismatches at two calls to s_rand. Stuffed in
casts to make the code do what it did before but w/o warnings --
although unclear that's correct!
Jeremy Hylton [Mon, 10 Jul 2000 21:30:28 +0000 (21:30 +0000)]
two changes to string_join:
implementation -- use PySequence_Fast interface to iterate over elements
interface -- if instance object reports wrong length, ignore it;
previous version raised an IndexError if reported length was too high
Fredrik Lundh [Mon, 10 Jul 2000 18:27:47 +0000 (18:27 +0000)]
- changed hash calculation for unicode strings. the new
value is calculated from the character values, in a way
that makes sure an 8-bit ASCII string and a unicode string
with the same contents get the same hash value.
(as a side effect, this also works for ISO Latin 1 strings).
Eric S. Raymond [Mon, 10 Jul 2000 18:11:00 +0000 (18:11 +0000)]
Give ConfigParser the capability to set as well as read options, and to write
a representation of the configuration state in .ini format that can be read
back in by a future read() call. Thus this class is now a back end
for .ini editors as well as parsers.
This patch is complete and tested, but exposes a bug in the ConfigParser
implementation which I have not yet fixed. Because case information is
discarded during parsing, the output of write() has its case smashed.
I wrote this for a SourceForge interface script called forgetool.
Documentation for the new entry points included.
Patch from Joe Eaton <jeaton@hostway.net> (SF#100741) to fix following problem:
There is a silly bug in the fall-back dumbdbm.py database package in
the Python 1.5.2 standard distro. This bug causes any changes to an
existing item to generate a new key, even when the key already
exists. After many updates, the .dir file used by dumbdbm grows to
a huge size, and can cause filesystem problems.
Better error handling of bad entity references. Before when an & in
an attribute value was not escaped, you could get two syntax errors:
one about a missing semicolon and one about an unknown entity. Now
you get only one about a bogus ampersand.
Fredrik Lundh [Sun, 9 Jul 2000 17:41:01 +0000 (17:41 +0000)]
- added optional bufsize argument to new popen methods.
for the moment, this argument must be left out or set
to -1 (only the default bufsize is supported, that is)
Fredrik Lundh [Sun, 9 Jul 2000 17:12:58 +0000 (17:12 +0000)]
- merged setlocale and set_locale. the internal setlocale
function is overridden by a python version which accepts
*either* a string (old behaviour) or a locale tuple.
- the _locale implementation module can now implement
an optional _getdefaultlocale function. if that function
isn't available, a POSIX-based approach is used (checking
LANG and other environment variables, as usual).
Fred Drake [Sun, 9 Jul 2000 14:39:29 +0000 (14:39 +0000)]
Remove setup of HAVE_OLD_CPP; it is no longer used in the Python sources.
The actual test for it is only commented out in configure.in, so it can
be re-enabled if we ever run across the need for it again.
Fredrik Lundh [Sun, 9 Jul 2000 13:16:13 +0000 (13:16 +0000)]
- added (long) casts to a couple of Py_BuildValue calls,
just for the sake of it.
note that this only covers the unlikely case that size_t
is smaller than a long; it's probably more likely that
there are platforms out there where size_t is *larger*
than a long, and mmapmodule cannot really deal with that
today.
Tim Peters [Sun, 9 Jul 2000 08:02:21 +0000 (08:02 +0000)]
Somebody started playing with const, so of course the outcome
was cascades of warnings about mismatching const decls. Overall,
I think const creates lots of headaches and solves almost
nothing. Added enough consts to shut up the warnings, but
this did require casting away const in one spot too (another
usual outcome of starting down this path): the function
mymemreplace can't return const char*, but sometimes wants to
return its first argument as-is, which latter must be declared
const char* in order to avoid const warnings at mymemreplace's
call sites. So, in the case the function wants to return the
first arg, that arg's declared constness must be subverted.
Barry Warsaw [Sun, 9 Jul 2000 04:56:25 +0000 (04:56 +0000)]
EnvironmentError__init__(): The two case clauses were missing
`break's. This first missing break caused a memory leak when case 3
fell through case 2 in the following example:
Fredrik Lundh [Sat, 8 Jul 2000 22:48:53 +0000 (22:48 +0000)]
this one's a bit risky, but I've spent some considerable time
staring at the diffs before checking this one in. let me know
asap if it breaks things on your platform.
-- ANSI-fying
(patch #100763 by Peter Schneider-Kamp, minus the
indentation changes and minus the changes the broke
the windows build)
Fredrik Lundh [Sat, 8 Jul 2000 17:43:32 +0000 (17:43 +0000)]
- changed __repr__ to use "unicode escape" encoding for unicode
strings, instead of the default encoding.
(see "minidom" thread for discussion, and also patch #100706)