| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
| |
this patch introduces PySequence_Fast and PySequence_Fast_GET_ITEM,
and modifies the list.extend method to accept any kind of sequence.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
his copy of test_contains.py seems to be broken -- the lines he
deleted were already absent). Checkin messages:
New Unicode support for int(), float(), complex() and long().
- new APIs PyInt_FromUnicode() and PyLong_FromUnicode()
- added support for Unicode to PyFloat_FromString()
- new encoding API PyUnicode_EncodeDecimal() which converts
Unicode to a decimal char* string (used in the above new
APIs)
- shortcuts for calls like int(<int object>) and float(<float obj>)
- tests for all of the above
Unicode compares and contains checks:
- comparing Unicode and non-string types now works; TypeErrors
are masked, all other errors such as ValueError during
Unicode coercion are passed through (note that PyUnicode_Compare
does not implement the masking -- PyObject_Compare does this)
- contains now works for non-string types too; TypeErrors are
masked and 0 returned; all other errors are passed through
Better testing support for the standard codecs.
Misc minor enhancements, such as an alias dbcs for the mbcs codec.
Changes:
- PyLong_FromString() now applies the same error checks as
does PyInt_FromString(): trailing garbage is reported
as error and not longer silently ignored. The only characters
which may be trailing the digits are 'L' and 'l' -- these
are still silently ignored.
- string.ato?() now directly interface to int(), long() and
float(). The error strings are now a little different, but
the type still remains the same. These functions are now
ready to get declared obsolete ;-)
- PyNumber_Int() now also does a check for embedded NULL chars
in the input string; PyNumber_Long() already did this (and
still does)
Followed by:
Looks like I've gone a step too far there... (and test_contains.py
seem to have a bug too).
I've changed back to reporting all errors in PyUnicode_Contains()
and added a few more test cases to test_contains.py (plus corrected
the join() NameError).
|
| |
|
|
|
|
|
| |
PySequence_Contains() now that string objects have this code in their
tp_contains.
|
|
|
|
|
| |
patches PySequence_Contains() to check for a valid sq_contains field.
More to follow.
|
|
|
|
|
|
| |
and _DelItem().
In sequence multiplication by a long, only call PyErr_Occurred() when the
value returned is -1.
|
| |
|
|
|
|
| |
messages for specific changes.
|
|
|
|
|
| |
float to the negative power (which is already and better done in
floatobject.c.)
|
| |
|
|
|
|
|
| |
*beyond* the null byte at the end of the input string, when the input
is inf(inity). Discovered by Greg Ward.
|
|
|
|
|
|
|
| |
Previously, this said "unsubscriptable object"; in 1.5.1, the reverse
problem existed, where None[''] would complain about a non-integer
index. This fix does the right thing in all cases (for get, set and
del item).
|
|
|
|
|
| |
literals. (The previous version of this code would not show the
offending input, even though there was code that attempted this.)
|
|
|
|
|
|
| |
faster (using PyList_GetSlice()). Also added a test for a NULL
argument, as with PySequence_Tuple(). (Hmm... Better names for these
two would be PyList_FromSequence() and PyTuple_FromSequence(). Oh well.)
|
|
|
|
|
|
|
|
|
| |
"indefinite length" sequences. These should still have a length, but
the length is only used as a hint -- the actual length of the sequence
is determined by the item that raises IndexError, which may be either
smaller or larger than what len() returns. (This is a novelty; map(),
filter() and reduce() only allow the actual length to be larger than
what len() returns, not shorter. I'll fix that shortly.)
|
|
|
|
|
|
| |
conversions. Formerly, for example, int('-') would return 0 instead
of raising ValueError, and int(' 0') would raise ValueError
(complaining about a null byte!) instead of 0...
|
| |
|
| |
|
|
|
|
|
|
|
| |
Make sure that no tp_as_numbers->nb_<whatever> function is called
without checking for a NULL pointer. Marc-Andre Lemburg will love it!
(Except that he's just rewritten all this code for a different
approach to coercions ;-( )
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
programming style.
Recoded many routines to incorporate better error checking, and/or
better versions of the same function found elsewhere
(e.g. bltinmodule.c or ceval.c). In particular,
Py_Number_{Int,Long,Float}() now convert from strings, just like the
built-in functions int(), long() and float().
Sequences and mappings are now safe to have NULL function pointers
anywhere in their tp_as_sequence or tp_as_mapping fields. (A few
places in other files need to be checked in too.)
Renamed PySequence_In() to PySequence_Contains().
|
| |
|
|
|
|
| |
in methodobject.h) to 'func'. /bin/cc on SunOS 4.x didn't grok this.
|
|
|
|
| |
This broke cPickle.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
sequence, otherwise
operator.indexOf([4, 3, 2, 1], 9) would raise a SystemError!
Note: it might be wise to double check all these functions. I haven't
done that yet.
|
|
|
|
|
| |
Correct typo in error msg (expec[t]ed).
Make gcc -Wall happy.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|