Commit graph

43198 commits

Author SHA1 Message Date
Neal Norwitz
d219e7f986 Fix a couple of typos. 2006-08-29 05:40:58 +00:00
Neal Norwitz
c082cb72a5 Fix another typo. 2006-08-29 05:40:08 +00:00
Neal Norwitz
2eca440c8d Get rid of some more cases of backquotes. parsermodule.c doesn't compile
but looks like that was a problem before this change.
2006-08-29 04:40:24 +00:00
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
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
Jack Diederich
7b60464ceb - Move functions common to all path modules into genericpath.py and have the
OS speicifc path modules import them.
- Have os2emxpath import common functions fron ntpath instead of using copies
2006-08-26 18:42:06 +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
Tim Peters
4582d7d905 A new test here relied on preserving invisible trailing
whitespace in expected output.  Stop that.
2006-08-25 22:26:21 +00:00
Tim Peters
147f9ae6db Whitespace normalization. 2006-08-25 22:05:39 +00:00
Armin Rigo
cd73a78b68 The regular expression engine in '_sre' can segfault when interpreting
bogus bytecode.  It is unclear whether this is a real bug or a "won't
fix" case like bogus_code_obj.py.
2006-08-25 12:44:28 +00:00
Thomas Heller
98619f267c Port _ctypes.pyd to win64 on AMD64. 2006-08-25 07:27:33 +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
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
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
Neal Norwitz
391e5f4c9f importing types is not necessary if we use isinstance 2006-08-25 01:52:49 +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
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
Thomas Wouters
9e398cac94 Fix SF bug #1545837: array.array borks on deepcopy.
array.__deepcopy__() needs to take an argument, even if it doesn't actually
use it. Will backport to 2.5 and 2.4 (if applicable.)
2006-08-24 18:40:20 +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
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
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
Alex Martelli
348dc88097 Reverting the patch that tried to fix the issue whereby x**2 raises
OverflowError while x*x succeeds and produces infinity; apparently
these inconsistencies cannot be fixed across ``all'' platforms and
there's a widespread feeling that therefore ``every'' platform
should keep suffering forevermore.  Ah well.
2006-08-23 22:17:59 +00:00
Jeremy Hylton
39c532c0b6 Replace dead code with an assert.
Now that COMMENT tokens are reliably followed by NL or NEWLINE,
there is never a need to add extra newlines in untokenize.
2006-08-23 21:26:46 +00:00
Jeremy Hylton
76467ba6d6 Bug fixes large and small for tokenize.
Small: Always generate a NL or NEWLINE token following
       a COMMENT token.  The old code did not generate an NL token if
       the comment was on a line by itself.

Large: The output of untokenize() will now match the
       input exactly if it is passed the full token sequence.  The
       old, crufty output is still generated if a limited input
       sequence is provided, where limited means that it does not
       include position information for tokens.

Remaining bug: There is no CONTINUATION token (\) so there is no way
for untokenize() to handle such code.

Also, expanded the number of doctests in hopes of eventually removing
the old-style tests that compare against a golden file.

Bug fix candidate for Python 2.5.1. (Sigh.)
2006-08-23 21:14:03 +00:00
Alex Martelli
20362a820b x**2 should about equal x*x (including for a float x such that the result is
inf) but didn't; added a test to test_float to verify that, and ignored the
ERANGE value for errno in the pow operation to make the new test pass (with
help from Marilyn Davis at the Google Python Sprint -- thanks!).
2006-08-23 20:42:02 +00:00
Jeremy Hylton
29bef0bbaa Baby steps towards better tests for tokenize 2006-08-23 18:37:43 +00:00
Jeremy Hylton
60e96f666c Expose column offset information in parse trees. 2006-08-22 20:46:00 +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