Improve error message for augmented assignments to genexps or listcomps.
Rather than introduce new logic, took the approach of making the message
itself more general.
Tim Peters [Tue, 28 Sep 2004 16:12:50 +0000 (16:12 +0000)]
A number of list examples used 66.6, but I doubt there's any box on which
repr(66.6) == "66.6", so doubt that the claimed output has ever been seen.
Changed it to 66.25 everywhere, and manually verified that the new claimed
output is correct.
Edward Loper [Tue, 28 Sep 2004 05:50:57 +0000 (05:50 +0000)]
Reverted the addition of a NORMALIZE_NUMBERS option, per Tim Peter's
request. Tim says that "correct 'fuzzy' comparison of floats cannot
be automated." (The motivation behind adding the new option
was verifying interactive examples in Python's latex documentation;
several such examples use numbers that don't print consistently on
different platforms.)
Edward Loper [Tue, 28 Sep 2004 04:29:57 +0000 (04:29 +0000)]
Added a new NORMALIZE_NUMBERS option, which causes number literals in
the expected output to match corresponding number literals in the
actual output if their values are equal (to ten digits of precision).
Checkin Tim's fix to an error discussed on python-dev.
Also, add a testcase.
Formerly, the list_extend() code used several local variables to remember
its state across iterations. Since an iteration could call arbitrary
Python code, it was possible for the list state to be changed. The new
code uses dynamic structure references instead of C locals. So, they
are always up-to-date.
After list_resize() is called, its size has been updated but the new
cells are filled with NULLs. These needed to be filled before arbitrary
iteration code was called; otherwise, that code could attempt to modify
a list that was in a semi-invalid state. The solution was to change
the ob->size field back to a value reflecting the actual number of valid
cells.
Tim Peters [Sun, 26 Sep 2004 01:24:23 +0000 (01:24 +0000)]
Removed two undocumented unittest support classes, and one undocumented
unittest support function, from the public interface. If they're not
documented, they shouldn't be public.
Tim Peters [Sat, 25 Sep 2004 00:49:53 +0000 (00:49 +0000)]
Beef up the section on testfile(), giving a complete example in
reStructuredText format. Remove words describing the return value of
testmod() and testfile() in the intro sections, since it's never
useful in such simple cases.
Neil Schemenauer [Fri, 24 Sep 2004 19:17:26 +0000 (19:17 +0000)]
Ensure negative offsets cannot be passed to buffer(). When composing
buffers, compute the new buffer size based on the old buffer size.
Fixes SF bug #1034242.
Tim Peters [Thu, 23 Sep 2004 19:22:41 +0000 (19:22 +0000)]
float_richcompare(): Use the new Py_IS_NAN macro to ensure that, on
platforms where that macro works, NaN compared to an int or long works
the same as NaN compared to a finite float.
Tim Peters [Thu, 23 Sep 2004 19:11:32 +0000 (19:11 +0000)]
Introduced a Py_IS_NAN macro, which probably works on the major platforms
today. pyconfig.h can override it if not, and can also override
Py_IS_INFINITY now. Py_IS_NAN and Py_IS_INFINITY are overridden now
for Microsoft compilers, using efficient MS-specific spellings.
Tim Peters [Thu, 23 Sep 2004 08:06:40 +0000 (08:06 +0000)]
SF bug #513866: Float/long comparison anomaly.
When an integer is compared to a float now, the int isn't coerced to float.
This avoids spurious overflow exceptions and insane results. This should
compute correct results, without raising spurious exceptions, in all cases
now -- although I expect that what happens when an int/long is compared to
a NaN is still a platform accident.
Note that we had potential problems here even with "short" ints, on boxes
where sizeof(long)==8. There's #ifdef'ed code here to handle that, but
I can't test it as intended. I tested it by changing the #ifdef to
trigger on my 32-bit box instead.
I suppose this is a bugfix candidate, but I won't backport it. It's
long-winded (for speed) and messy (because the problem is messy). Note
that this also depends on a previous 2.4 patch that introduced
_Py_SwappedOp[] as an extern.
Tim Peters [Thu, 23 Sep 2004 02:39:37 +0000 (02:39 +0000)]
A static swapped_op[] array was defined in 3 different C files, & I think
I need to define it again. Bite the bullet and define it once as an
extern, _Py_SwappedOp[].
Edward Loper [Tue, 21 Sep 2004 03:00:51 +0000 (03:00 +0000)]
- Updated docs to reflect changes in 2.4.
- Reorganized the documentation
- Shifted focus a little more towards "literate testing"
- Documented new functions and classes:
- testfile()
- Example, DocTest
- DocTestParser, DocTestFinder, DocTestRunner, OutputChecker
- DocFileSuite
- DebugRunner, DocTestFailure, UnexpectedException
- register_optionflag()
Sort classes by fully qualified name. In the common case where you are
displaying a set of classes from one module it doesn't matter, but if you
are displaying a large class tree from multiple modules it improves the
display to sort by module.name.