and a couple of functions that were missed in the previous batches. Not
terribly tested, but very carefully scrutinized, three times.
All these were found by the little findkrc.py that I posted to python-dev,
which means there might be more lurking. Cases such as this:
long
func(a, b)
long a;
long b; /* flagword */
{
and other cases where the last ; in the argument list isn't followed by a
newline and an opening curly bracket. Regexps to catch all are welcome, of
course ;)
comments, docstrings or error messages. I fixed two minor things in
test_winreg.py ("didn't" -> "Didn't" and "Didnt" -> "Didn't").
There is a minor style issue involved: Guido seems to have preferred English
grammar (behaviour, honour) in a couple places. This patch changes that to
American, which is the more prominent style in the source. I prefer English
myself, so if English is preferred, I'd be happy to supply a patch myself ;)
For more comments, read the patches@python.org archives.
For documentation read the comments in mymalloc.h and objimpl.h.
(This is not exactly what Vladimir posted to the patches list; I've
made a few changes, and Vladimir sent me a fix in private email for a
problem that only occurs in debug mode. I'm also holding back on his
change to main.c, which seems unnecessary to me.)
Attached you find an update of the Unicode implementation.
The patch is against the current CVS version. I would appreciate
if someone with CVS checkin permissions could check the changes
in.
The patch contains all bugs and patches sent this week and also
fixes a leak in the codecs code and a bug in the free list code
for Unicode objects (which only shows up when compiling Python
with Py_DEBUG; thanks to MarkH for spotting this one).
converted was a "digit" -- use isalnum(). This test is there only to
guard against "+" or "-" being interpreted as a valid int literal.
Reported by Takahiro Nakayama.
type for all functions. However many function call PyArg_Parse() and
need a 0. This is so that when they didn't change anything, the can
do Py_INCREF(args); return args. Reverted this back. For atof(),
there's no reason not to use PyArg_ParseTuple(), so I changed the code
(atoi and atol already used that).
maxsplit which is implemented in string.py but wasn't here. The
reference manual doesn't define what happens when maxsplit is negative
or larger than the number of occurrences, but in either case, I
implemented this as all get replaced. Default value is zero which
replaces all occurrences.
- 'delete' is a C++ keyword; use 'del_table' instead
- apply Py_CHARMASK() to del_table[i] before using it as an index
*** this fixes a bug that was just reported on the list ***
- if the translation didn't make any changes, INCREF and return
the original string
- when del_table is empty or omitted, don't copy the translation
table to a table of ints (should be a bit faster)
Rewrote maketrans() to avoid copying the table (2-3% faster).
performance hit. Urg. Reverted.
strop_joinfields(): re-instate optimizations for lists and tuples, but
support arbitrary other kinds of sequences as well.
- split_whitespace(): slightly better memory ref handling when errors
occur.
- strop_joinfields(): First argument can now be any sequence-protocol
conformant object.
- strop_find(), strop_rfind(): Use PyArg_ParseTuple for optional
arguments
- strop_lower(), strop_upper(): Factor logic into a common function
do_casechange().
- strop_atoi(), strop_atol(): Use PyArg_ParseTuple.
- strop_maketrans(): arguments used to be optional, although the
documentation doesn't reflect this. Make the source conform to the
docs. Arguments are required, but two empty strings will return the
identity translation table.
- General pass fixing up formatting, and checking for return values.
Extended split() (and hence splitfields(), which is the same function)
to support an optional third parameter giving the maximum number of
delimiters to parse.