Commit Graph

33823 Commits

Author SHA1 Message Date
Georg Brandl
c4996ba794 Fix str() and repr() of empty sets. 2006-08-28 19:37:11 +00:00
Georg Brandl
b3fa66fe30 Small fix for compiler module ./. set literals. 2006-08-28 17:19:22 +00:00
Georg Brandl
17ab9a02b5 Fix set literals not being visited in symtable creation. 2006-08-28 16:38:22 +00:00
Guido van Rossum
86e58e239e SF patch 1547796 by Georg Brandl -- set literals. 2006-08-28 15:27:34 +00:00
Brett Cannon
ecfd0b2f3b Vestige of code from removing backticks.
Closes patch #1500623.  Thanks, Collin Winter.
2006-08-27 01:03:34 +00:00
Guido van Rossum
0919a1a07b Part of SF patch #1513870 (the still relevant part) -- add reduce() to
functools, and adjust docs etc.
2006-08-26 20:49:04 +00:00
Guido van Rossum
6a2a2a0832 Inspired by SF patch #860326, make the exception formatting by
traceback.py be closer to the built-in formatting.
A few unittests had to be fixed, too.
2006-08-26 20:37:44 +00:00
Guido van Rossum
59baa759e4 The daily ritual: fix C89 violations. 2006-08-26 02:54:40 +00:00
Guido van Rossum
f35ad33064 Don't use a fixed temporary name (gdbm).
Don't use our own temp name creation (dbm).
Should be backported to 2.5.
2006-08-25 23:40:32 +00:00
Guido van Rossum
b65fb33b02 SF patch 1546297 (with some tweaks):
Create a real zip iterator object; not using itertools.izip
(Brian Holmes).
2006-08-25 23:26:40 +00:00
Brett Cannon
e2e23ef97d Remove the UNARY_CONVERT opcode (was used for backticks). Also bumped up the
import MAGIC number.
2006-08-25 05:05:30 +00:00
Brett Cannon
5f5cfd121d Remove more '<>' usage.
``python -m compileall -f`` is really handy for finding Python files that use
invalid syntax.
2006-08-25 04:36:39 +00:00
Brett Cannon
cf588f6448 Remove support for backticks from the grammar and compiler.
Still need to remove traces of the UNARY_CONVERT opcode.
2006-08-25 04:28:18 +00:00
Brett Cannon
8b6de130c6 UNARY_CONVERT can no longer be generated, so remove a test for the peepholer
optimization for it.
2006-08-25 04:24:12 +00:00
Brett Cannon
8933cb477f Change test of assignment of backticked expression to be an "invalid syntax"
SyntaxError.

This is probably not the proper solution to this failing test, but removing the
test itself causes 19 other tests to fail for some odd reason because doctest
doesn't expect a complete traceback (or something; rather odd problem for just
removing a single test).
2006-08-25 04:12:10 +00:00
Brett Cannon
b3de3baf19 Check in new output for test_tokenize. 2006-08-25 04:07:01 +00:00
Brett Cannon
f0365511a5 Switch to using %r in the format string. 2006-08-25 04:06:31 +00:00
Brett Cannon
e427a1ca3a Don't test AST for backticks. 2006-08-25 03:15:03 +00:00
Brett Cannon
7ed3fcf26f The backtick removal crusade continues ... 2006-08-25 03:01:11 +00:00
Brett Cannon
0b70cca9f8 Remove usage of backticks. 2006-08-25 02:59:59 +00:00
Brett Cannon
db60d6e2aa Remove more '<>' usage. 2006-08-25 02:57:28 +00:00
Brett Cannon
553a0296e9 Back out rev. 51583 as this file is auto-generated. Obviously the program that
auto-generates this file will need to get fixed.
2006-08-25 01:16:12 +00:00
Brett Cannon
7c90aed39d For some reason Vim was just not wanting to tell me there was more instances of
'<>'.
2006-08-25 01:08:24 +00:00
Brett Cannon
0fc9139193 Even more removals of '<>'; I can hear Barry shedding a manly tear ... 2006-08-25 01:06:13 +00:00
Brett Cannon
f76c3daafe Remove a use of 'as' as a parameter. 2006-08-25 01:02:03 +00:00
Brett Cannon
9ca0eca995 Remove some uses of '<>'. 2006-08-25 01:00:47 +00:00
Brett Cannon
0e1cff56b4 Get rid of all two uses of backticks (bad Jeremy!). 2006-08-24 23:44:42 +00:00
Guido van Rossum
f1624cd2d6 Fix a bunch of compiler warnings. In at least one case these were serious bugs! 2006-08-24 23:43:52 +00:00
Guido van Rossum
dc5f6b232b Got test_mutants.py working. One set of changes was straightforward:
use __eq__ instead of __cmp__.  The other change is unexplained:
with a random hash code as before, it would run forever; with a constant
hash code, it fails quickly.

This found a refcount bug in dict_equal() -- I wonder if that bug is
also present in 2.5...
2006-08-24 21:29:26 +00:00
Guido van Rossum
801f0d78b5 Make built-in zip() equal to itertools.izip().
I mea, *really* equal -- for now, the implementation just imports
itertools. :-)
The only other changes necessary were various unit tests that were
assuming zip() returns a real list.  No "real" code made this assumption.
2006-08-24 19:48:10 +00:00
Guido van Rossum
d38abe9484 Get rid of empty file. 2006-08-24 19:12:58 +00:00
Guido van Rossum
e4ef3a6e6c Fix the bsddb3 unit tests.
This essentially meant fixing one case where a list of custom objects
was being sorted, and fixing one genuine bug where a method call was
missing parentheses.
2006-08-24 18:19:44 +00:00
Guido van Rossum
19960597ad Fix the datetime comparison conundrum.
The special-casing of other objects with a timetuple attribute is gone.
Let's hope Tim agrees.
2006-08-24 17:29:38 +00:00
Guido van Rossum
b6bb0c79d9 Implement == and != comparisons for code objects by value.
This makes test_codeop and test_marshal pass.
2006-08-24 04:12:18 +00:00
Guido van Rossum
8f78fe9a10 Fix fallout from Anna's file -> open changes. 2006-08-24 04:03:53 +00:00
Guido van Rossum
b053cd8f40 Killed the <> operator. You must now use !=.
Opportunistically also fixed one or two places where '<> None' should be
'is not None' and where 'type(x) <> y' should be 'not isinstance(x, y)'.
2006-08-24 03:53:23 +00:00
Alex Martelli
01c77c6628 Anna Ravenscroft identified many occurrences of "file" used to open a file
in the stdlib and changed each of them to use "open" instead.  At this
time there are no other known occurrences that can be safely changed (in
Lib and all subdirectories thereof).
2006-08-24 02:58:11 +00:00
Guido van Rossum
b5d47efe92 Fix another comparison between None and 0. 2006-08-24 02:27:45 +00:00
Guido van Rossum
93a669260d Make it compile with C89. 2006-08-24 02:10:21 +00:00
Guido van Rossum
47b9ff6ba1 Restructure comparison dramatically. There is no longer a default
*ordering* between objects; there is only a default equality test
(defined by an object being equal to itself only).  Read the comment
in object.c.  The current implementation never uses a three-way
comparison to compute a rich comparison, but it does use a rich
comparison to compute a three-way comparison.  I'm not quite done
ripping out all the calls to PyObject_Compare/Cmp, or replacing
tp_compare implementations with tp_richcompare implementations;
but much of that has happened (to make most unit tests pass).

The following tests still fail, because I need help deciding
or understanding:

test_codeop -- depends on comparing code objects
test_datetime -- need Tim Peters' opinion
test_marshal -- depends on comparing code objects
test_mutants -- need help understanding it

The problem with test_codeop and test_marshal is this: these tests
compare two different code objects and expect them to be equal.
Is that still a feature we'd like to support?  I've temporarily
removed the comparison and hash code from code objects, so they
use the default (equality by pointer only) comparison.

For the other two tests, run them to see for yourself.
(There may be more failing test with "-u all".)

A general problem with getting lots of these tests to pass is
the reality that for object types that have a natural total ordering,
implementing __cmp__ is much more convenient than implementing
__eq__, __ne__, __lt__, and so on.  Should we go back to allowing
__cmp__ to provide a total ordering?  Should we provide some other
way to implement rich comparison with a single method override?
Alex proposed a __key__() method; I've considered a __richcmp__()
method.  Or perhaps __cmp__() just shouldn't be killed off...
2006-08-24 00:41:19 +00:00
Thomas Wouters
9a6e62b947 Fix buglet in slice assignment of bytesobjects: assigning to b[3:0] ('stop'
being before 'start') would actually assign to b[0:0] (or whatever 'stop'
was)
2006-08-23 23:20:29 +00:00
Jeremy Hylton
fbfe093607 Check for exceptions set by PyDict_GetItem(). 2006-08-23 18:13:39 +00:00
Guido van Rossum
811c4e0b7c Remove has_key() references from idlelib. IDLE still doesn't run due
to relative import issues.  Any volunteers?
2006-08-22 15:45:46 +00:00
Thomas Wouters
d204a715f4 Make bytesobject raise ValueError instead of TypeError again (thanks, Nick) 2006-08-22 13:41:17 +00:00
Guido van Rossum
89da5d7c3d Kill reduce(). A coproduction of John Reese, Jacques Frechet, and Alex M. 2006-08-22 00:21:25 +00:00
Alex Martelli
6cefeb0e81 Jacques Frechet's and John Reese's simplification of ElementTree: give up
attempts at backwards compatibility which can't work anyway on Py3k (and aren't
needed for Python 2.5 and later).
2006-08-21 23:45:19 +00:00
Thomas Wouters
0008602188 remove debugging turd. 2006-08-21 23:40:16 +00:00
Guido van Rossum
389381564c Change the way __hash__ is inherited; when __eq__ or __cmp__ is overridden
but __hash__ is not, set __hash__ explicitly to None (and tp_hash to NULL).
All unit tests pass now!
2006-08-21 23:36:26 +00:00
Thomas Wouters
5431ee4a49 test_gc is no longer broken 2006-08-21 22:25:22 +00:00
Thomas Wouters
3dfc3c14a2 Fix test_gc failure by fixing the bug test_gc found: __del__ methods were no
longer preventing classes from being cleaned up by the cycle-gc, after Guido
removed references to PyInstance_*.
2006-08-21 22:15:41 +00:00