Fred Drake [Wed, 12 Jul 2000 04:49:00 +0000 (04:49 +0000)]
Convert coding style to be internally consistent and similar to the
rest of the Python C code: space between "if", "for" and "(", no space
between "(", ")" and function call parameters, etc.
Fix bugs in readinst():
* There was no error reported if the .read() method returns a non-string
* If read() returned too much data, the buffer would be overflowed causing a
core dump
* Used strncpy, not memcpy, which seems incorrect if there are embedded \0s.
* The args and bytes objects were leaked
Patch #100854 from jhylton: eliminate compiler warnings in pyexpat:
The first two warnings seem harmless enough,
but the last one looks like a potential bug: an
uninitialized int is returned on error. (I also
ended up reformatting some of the code,
because it was hard to read.)
Jack Jansen [Tue, 11 Jul 2000 21:18:10 +0000 (21:18 +0000)]
- Removed guesstabsize.c, which is obsolete.
- ANSIfication step 3: enable "require prototypes" flags. Still lots of warnings, mainly on init routines and bgen stuff.
Jeremy Hylton [Tue, 11 Jul 2000 20:55:38 +0000 (20:55 +0000)]
small updates to string_join:
use PyString_AS_STRING macro on local string object
when resizing string, make sure resized string will always be big enough
split string containing error message across two lines
add test to string_tests that causes resizing
Fred Drake [Tue, 11 Jul 2000 19:43:47 +0000 (19:43 +0000)]
Moshe Zadka <mzadka@geocities.com>:
Update the "in" / "not in" description to accomodate the current use
of the __contains__() discipline. This patch also incorporates
suggestions from Marc-Andre Lemburg <mal@lemburg.com>, minor markup
revisions from Fred Drake, and some rewording of the first affected
paragraph (also from Fred).
Fred Drake [Tue, 11 Jul 2000 17:53:00 +0000 (17:53 +0000)]
Create two new exceptions: IndentationError and TabError. These are
used for indentation related errors. This patch includes Ping's
improvements for indentation-related error messages.
Fred Drake [Tue, 11 Jul 2000 16:30:30 +0000 (16:30 +0000)]
Change the table in the pyexpat.errors module to a series of datadesc
elements (since the table was pretty screwed up); this is how it is done
elsewhere in the manual.
I could use some help creating descriptions of the specific error
identifiers (input conditions that lead to each error, etc.).
Jeremy Hylton [Tue, 11 Jul 2000 15:15:31 +0000 (15:15 +0000)]
fix bug #42 reported by Andrew Dalke
The Compare close contains a close method that checks to see if there
is any unconsumed data in the Compare instance; i.e. if the canonical
output file contains more data than was produced by the current test
run. This method was never called, allowing differences to go
undetected.
Fix is to call close after the test is run (after __import__)
output/test_long and output/test_popen2 needed trivial changes
output/test_select contained lots of text, but test_select.py produced
no output
Fred Drake [Tue, 11 Jul 2000 14:37:41 +0000 (14:37 +0000)]
Neil Schemenauer <nascheme@enme.ucalgary.ca>:
Change a cast, intialize a local, and make some sprintf() format strings
type-appropriate (add the "l" to "%d").
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).