Commit Graph

4430 Commits

Author SHA1 Message Date
Fred Drake 97656a1c82 Simple conversion to PyUnit. 2001-05-18 21:45:35 +00:00
Fred Drake 5b811bee5d Simple conversion to PyUnit. 2001-05-18 21:38:52 +00:00
Fred Drake bd3090d4d6 Added test suite for the new HTMLParser module, originally from the
TAL/PageTemplate package for Zope.  This only needed a little boilerplate
change; the tests themselves are unchanged.
2001-05-18 15:32:59 +00:00
Guido van Rossum 8846d7178b A much improved HTML parser -- a replacement for sgmllib. The API is
derived from but not quite compatible with that of sgmllib, so it's a
new file.  I suppose it needs documentation, and htmllib needs to be
changed to use this instead of sgmllib, and sgmllib needs to be
declared obsolete.  But that can all be done later.

This code was first published as part of TAL (part of Zope Page
Templates), but that was strongly based on sgmllib anyway.  Authors
are Fred drake and Guido van Rossum.
2001-05-18 14:50:52 +00:00
Guido van Rossum 99f9baa331 Fixed botched indent in _init_mac() code. (It may never be executed,
but it still can't have any syntax errors.  Went a little too fast
there, Jack? :-)
2001-05-17 15:03:14 +00:00
Jack Jansen dd13a20490 Made distutils understand the MacPython Carbon runtime model. Distutils will build for the runtime model you are currently using for the interpreter. 2001-05-17 12:52:01 +00:00
Marc-André Lemburg 716cf91839 Moved the encoding map building logic from the individual mapping
codec files to codecs.py and added logic so that multi mappings
in the decoding maps now result in mappings to None (undefined mapping)
in the encoding maps.
2001-05-16 09:41:45 +00:00
Tim Peters 30324a7363 Just changed "x,y" to "x, y" everywhere (i.e., inserted horizontal space
after commas that didn't have any).
2001-05-15 17:19:16 +00:00
Guido van Rossum acfdf156aa Add quoted-printable codec 2001-05-15 15:34:07 +00:00
Fred Drake da05e977f3 abspath(): Fix inconsistent indentation. 2001-05-15 15:23:01 +00:00
Marc-André Lemburg 2d9204199f This patch changes the way the string .encode() method works slightly
and introduces a new method .decode().

The major change is that strg.encode() will no longer try to convert
Unicode returns from the codec into a string, but instead pass along
the Unicode object as-is. The same is now true for all other codec
return types. The underlying C APIs were changed accordingly.

Note that even though this does have the potential of breaking
existing code, the chances are low since conversion from Unicode
previously took place using the default encoding which is normally
set to ASCII rendering this auto-conversion mechanism useless for
most Unicode encodings.

The good news is that you can now use .encode() and .decode() with
much greater ease and that the door was opened for better accessibility
of the builtin codecs.

As demonstration of the new feature, the patch includes a few new
codecs which allow string to string encoding and decoding (rot13,
hex, zip, uu, base64).

Written by Marc-Andre Lemburg. Copyright assigned to the PSF.
2001-05-15 12:00:02 +00:00
Guido van Rossum 2e0a654f6e Add warnings to the strop module, for to those functions that really
*are* obsolete; three variables and the maketrans() function are not
(yet) obsolete.

Add a compensating warnings.filterwarnings() call to test_strop.py.

Add this to the NEWS.
2001-05-15 02:14:44 +00:00
Fred Drake 992d387540 Convert a couple of comments to docstrings -- PyUnit can use these when
the regression test is run in verbose mode.
2001-05-14 19:15:23 +00:00
Tim Peters 95b3f78622 pprint's workhorse _safe_repr() function took time quadratic in the # of
elements when crunching a list, dict or tuple.  Now takes linear time
instead -- huge speedup for even moderately large containers, and the
code is notably simpler too.
Added some basic "is the output correct?" tests to test_pprint.
2001-05-14 18:39:41 +00:00
Fred Drake 43913dd27c Convert the pprint test to use PyUnit. 2001-05-14 17:41:20 +00:00
Tim Peters a814db579d SF bug[ #423781: pprint.isrecursive() broken. 2001-05-14 07:05:58 +00:00
Tim Peters a0599575aa A disgusting "fix" for the test___all__ failure under Windows. 2001-05-13 09:01:06 +00:00
Mark Hammond ef8b654bbe Add support for Windows using "mbcs" as the default Unicode encoding when dealing with the file system. As discussed on python-dev and in patch 410465. 2001-05-13 08:04:26 +00:00
Tim Peters 2f228e75e4 Get rid of the superstitious "~" in dict hashing's "i = (~hash) & mask".
The comment following used to say:
	/* We use ~hash instead of hash, as degenerate hash functions, such
	   as for ints <sigh>, can have lots of leading zeros. It's not
	   really a performance risk, but better safe than sorry.
	   12-Dec-00 tim:  so ~hash produces lots of leading ones instead --
	   what's the gain? */
That is, there was never a good reason for doing it.  And to the contrary,
as explained on Python-Dev last December, it tended to make the *sum*
(i + incr) & mask (which is the first table index examined in case of
collison) the same "too often" across distinct hashes.

Changing to the simpler "i = hash & mask" reduced the number of string-dict
collisions (== # number of times we go around the lookup for-loop) from about
6 million to 5 million during a full run of the test suite (these are
approximate because the test suite does some random stuff from run to run).
The number of collisions in non-string dicts also decreased, but not as
dramatically.

Note that this may, for a given dict, change the order (wrt previous
releases) of entries exposed by .keys(), .values() and .items().  A number
of std tests suffered bogus failures as a result.  For dicts keyed by
small ints, or (less so) by characters, the order is much more likely to be
in increasing order of key now; e.g.,

>>> d = {}
>>> for i in range(10):
...    d[i] = i
...
>>> d
{0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
>>>

Unfortunately. people may latch on to that in small examples and draw a
bogus conclusion.

test_support.py
    Moved test_extcall's sortdict() into test_support, made it stronger,
    and imported sortdict into other std tests that needed it.
test_unicode.py
    Excluced cp875 from the "roundtrip over range(128)" test, because
    cp875 doesn't have a well-defined inverse for unicode("?", "cp875").
    See Python-Dev for excruciating details.
Cookie.py
    Chaged various output functions to sort dicts before building
    strings from them.
test_extcall
    Fiddled the expected-result file.  This remains sensitive to native
    dict ordering, because, e.g., if there are multiple errors in a
    keyword-arg dict (and test_extcall sets up many cases like that), the
    specific error Python complains about first depends on native dict
    ordering.
2001-05-13 00:19:31 +00:00
Fred Drake 7e473800c3 Fix one bare except: clause. 2001-05-11 19:52:57 +00:00
Fred Drake 6f6a14f888 Remove a bare try/except completely -- it just did not make sense!
Add a comment elsewhere making clear an assumption in the code.
2001-05-11 19:25:08 +00:00
Fred Drake e8187615e2 When guarding an import, only catch ImportError. 2001-05-11 19:21:41 +00:00
Fred Drake 31e18291c5 Clean up a bare except where we only expect to catch pcre.error. 2001-05-11 19:20:17 +00:00
Fred Drake 652553192e Clean up bare except where only IOError makes sense. 2001-05-11 19:15:28 +00:00
Fred Drake 553f68114f Clean up bare except: when determining whether a file is seekable. 2001-05-11 19:14:51 +00:00
Fred Drake 776d39e2c7 Opening a file for reading can raise IOError, so only catch that. 2001-05-11 18:47:54 +00:00
Fred Drake 1b7e079528 int() of a string is only expected to through ValueError, so do not use
a bare except clause.
2001-05-11 18:45:52 +00:00
Fred Drake 9f9b593f8d <socket>.getsockopt() and <socket>.setsockopt() can only raise socket.error,
so only catch that specific exception.
2001-05-11 18:28:54 +00:00
Fred Drake c79f3d0d42 Catch only the relevant exceptions instead of using a bare except clause. 2001-05-11 18:27:00 +00:00
Fred Drake 6278799f8e unlink() would normally be found in the "os" module, so use it from there.
Remove unused import of "sys".

If the file TESTFN exists before we start, try to remove it.

Add spaces around the = in some assignments.
2001-05-11 14:29:21 +00:00
Tim Peters 4c02fecf9c Make test_mutants stronger by also adding random keys during comparisons.
A Mystery:  test_mutants ran amazingly slowly even before dictobject.c
"got fixed".  I don't have a clue as to why.  dict comparison was and
remains linear-time in the size of the dicts, and test_mutants only tries
100 dict pairs, of size averaging just 50.  So "it should" run in less than
an eyeblink; but it takes at least a second on this 800MHz box.
2001-05-10 20:18:30 +00:00
Tim Peters fd69208b78 Change test_mmap.py to use test_support.TESTFN instead of hardcoded "foo",
and wrap the body in try/finally to ensure TESTFN gets cleaned up no
matter what.
2001-05-10 20:03:04 +00:00
Tim Peters 8c3e91efaf Repair typos in comments. 2001-05-10 19:40:30 +00:00
Fred Drake e61967f537 Change some text just a little to avoid font-lock hell. 2001-05-10 18:41:02 +00:00
Fred Drake aaa48ff5c9 Extend the weakref test suite to cover the complete mapping interface for
both weakref.Weak*Dictionary classes.

This closes SF bug #416480.
2001-05-10 17:16:38 +00:00
Fred Drake 48a1638d78 Do no regenerate modules that should no longer be here. 2001-05-10 15:52:47 +00:00
Fred Drake a94414a287 Remove all remaining uses of the FCNTL module from the standard library. 2001-05-10 15:33:31 +00:00
Tim Peters 95bf9390a4 SF bug #422121 Insecurities in dict comparison.
Fixed a half dozen ways in which general dict comparison could crash
Python (even cause Win98SE to reboot) in the presence of kay and/or
value comparison routines that mutate the dict during dict comparison.
Bugfix candidate.
2001-05-10 08:32:44 +00:00
Fred Drake 66aaaae54c Update to reflect deprecation of the FCNTL module: The fcntl module does
*not* define O_RDWR; get that from the os module.
2001-05-10 05:17:02 +00:00
Steve Purcell 4bc808533f patch 418489 from Andrew Dalke for string format bug 2001-05-10 01:28:40 +00:00
Tim Peters 1ee77d9b71 Guido has Spoken. Restore strop.replace()'s treatment of a 0 count as
meaning infinity -- but at least warn about it in the code!  I pissed
away a couple hours on this today, and don't wish the same on the next
in line.
Bugfix candidate.
2001-05-10 01:23:39 +00:00
Tim Peters da45d55a6e The strop module and test_strop.py believe replace() with a 0 count
means "replace everything".  But the string module, string.replace()
amd test_string.py believe a 0 count means "replace nothing".
"Nothing" wins, strop loses.
Bugfix candidate.
2001-05-10 00:59:45 +00:00
Tim Peters 1a7b3eee94 SF bug #422088: [OSF1 alpha] string.replace().
Platform blew up on "123".replace("123", "").  Michael Hudson pinned the
blame on platform malloc(0) returning NULL.
This is a candidate for all bugfix releases.
2001-05-09 23:00:26 +00:00
Fred Drake 48871f2a6e Remove the old platform-specific FCNTL.py modules; these are no longer
needed now that fcntl exports the constants.
2001-05-09 21:15:06 +00:00
Fred Drake 76d6139961 Add a new FCNTL.py backward compatibility module that issues a deprecation
warning.  This is similar to the TERMIOS backward compatbility module.
2001-05-09 21:13:23 +00:00
Fred Drake bc7809b529 Update the tests for the fcntl module to check passing in file objects,
and using the constants defined there instead of FCNTL.
2001-05-09 21:11:59 +00:00
Jeremy Hylton e3e61049a5 Trivial tests of urllib2 for recent SF bug 2001-05-09 15:50:25 +00:00
Jeremy Hylton 78cae61ad4 Raise useful exception when called with URL for which request type
cannot be determined.

Pseudo-fix for SF bug #420724
2001-05-09 15:49:24 +00:00
Tim Peters 72f98e9b83 SF bug #422177: Results from .pyc differs from .py
Store floats and doubles to full precision in marshal.
Test that floats read from .pyc/.pyo closely match those read from .py.
Declare PyFloat_AsString() in floatobject header file.
Add new PyFloat_AsReprString() API function.
Document the functions declared in floatobject.h.
2001-05-08 15:19:57 +00:00
Tim Peters e63415ead8 SF patch #421922: Implement rich comparison for dicts.
d1 == d2 and d1 != d2 now work even if the keys and values in d1 and d2
don't support comparisons other than ==, and testing dicts for equality
is faster now (especially when inequality obtains).
2001-05-08 04:38:29 +00:00
Jeremy Hylton 4c889011db SF patch 419176 from MvL; fixed bug 418977
Two errors in dict_to_map() helper used by PyFrame_LocalsToFast().
2001-05-08 04:08:59 +00:00
Tim Peters 7ae2229afb This is a test showing SF bug 422177. It won't trigger until I check in
another change (to test_import.py, which simply imports the new file).  I'm
checking this piece in now, though, to make it easier to distribute a patch
for x-platform checking.
2001-05-08 03:58:01 +00:00
Tim Peters 8572b4fedf Generalize zip() to work with iterators.
NEEDS DOC CHANGES.
More AttributeErrors transmuted into TypeErrors, in test_b2.py, and,
again, this strikes me as a good thing.
This checkin completes the iterator generalization work that obviously
needed to be done.  Can anyone think of others that should be changed?
2001-05-06 01:05:02 +00:00
Tim Peters ef0c42d4e5 Get rid of silly 5am "del" stmts. 2001-05-05 21:36:52 +00:00
Tim Peters cb8d368b82 Reimplement PySequence_Contains() and instance_contains(), so they work
safely together and don't duplicate logic (the common logic was factored
out into new private API function _PySequence_IterContains()).
Visible change:
    some_complex_number  in  some_instance
no longer blows up if some_instance has __getitem__ but neither
__contains__ nor __iter__.  test_iter changed to ensure that remains true.
2001-05-05 21:05:01 +00:00
Tim Peters 75f8e35ef4 Generalize PySequence_Count() (operator.countOf) to work with iterators. 2001-05-05 11:33:43 +00:00
Tim Peters de9725f135 Make 'x in y' and 'x not in y' (PySequence_Contains) play nice w/ iterators.
NEEDS DOC CHANGES
A few more AttributeErrors turned into TypeErrors, but in test_contains
this time.
The full story for instance objects is pretty much unexplainable, because
instance_contains() tries its own flavor of iteration-based containment
testing first, and PySequence_Contains doesn't get a chance at it unless
instance_contains() blows up.  A consequence is that
    some_complex_number in some_instance
dies with a TypeError unless some_instance.__class__ defines __iter__ but
does not define __getitem__.
2001-05-05 10:06:17 +00:00
Tim Peters 2cfe368283 Make unicode.join() work nice with iterators. This also required a change
to string.join(), so that when the latter figures out in midstream that
it really needs unicode.join() instead, unicode.join() can actually get
all the sequence elements (i.e., there's no guarantee that the sequence
passed to string.join() can be iterated over *again* by unicode.join(),
so string.join() must not pass on the original sequence object anymore).
2001-05-05 05:36:48 +00:00
Tim Peters 6912d4ddf0 Generalize tuple() to work nicely with iterators.
NEEDS DOC CHANGES.
This one surprised me!  While I expected tuple() to be a no-brainer, turns
out it's actually dripping with consequences:
1. It will *allow* the popular PySequence_Fast() to work with any iterable
   object (code for that not yet checked in, but should be trivial).
2. It caused two std tests to fail.  This because some places used
   PyTuple_Sequence() (the C spelling of tuple()) as an indirect way to test
   whether something *is* a sequence.  But tuple() code only looked for the
   existence of sq->item to determine that, and e.g. an instance passed
   that test whether or not it supported the other operations tuple()
   needed (e.g., __len__).  So some things the tests *expected* to fail
   with an AttributeError now fail with a TypeError instead.  This looks
   like an improvement to me; e.g., test_coercion used to produce 559
   TypeErrors and 2 AttributeErrors, and now they're all TypeErrors.  The
   error details are more informative too, because the places calling this
   were *looking* for TypeErrors in order to replace the generic tuple()
   "not a sequence" msg with their own more specific text, and
   AttributeErrors snuck by that.
2001-05-05 03:56:37 +00:00
Tim Peters 15d81efb8a Generalize reduce() to work with iterators.
NEEDS DOC CHANGES.
2001-05-04 04:39:21 +00:00
Tim Peters 8bc10b0c57 Purge redundant cut&paste line. 2001-05-03 23:58:47 +00:00
Tim Peters 4e9afdca39 Generalize map() to work with iterators.
NEEDS DOC CHANGES.
Possibly contentious:  The first time s.next() yields StopIteration (for
a given map argument s) is the last time map() *tries* s.next().  That
is, if other sequence args are longer, s will never again contribute
anything but None values to the result, even if trying s.next() again
could yield another result.  This is the same behavior map() used to have
wrt IndexError, so it's the only way to be wholly backward-compatible.
I'm not a fan of letting StopIteration mean "try again later" anyway.
2001-05-03 23:54:49 +00:00
Tim Peters efdae3939a Remove redundant copy+paste code. 2001-05-03 07:09:25 +00:00
Tim Peters c307453162 Generalize max(seq) and min(seq) to work with iterators.
NEEDS DOC CHANGES.
2001-05-03 07:00:32 +00:00
Fred Drake c7745d4b54 InteractiveInterpreter.showsyntaxerror():
When replacing the exception object, be sure we stuff the new value
    in sys.last_value (which we already did for the original value).
2001-05-03 04:58:49 +00:00
Fred Drake a7cc69e02e Added support for .__contains__(), .__iter__(), .iterkeys(). 2001-05-03 04:55:47 +00:00
Fred Drake bedebbdfb1 Added support for .iteritems(), .iterkeys(), .itervalues(). 2001-05-03 04:54:41 +00:00
Fred Drake 72987a4b96 Make the Mailbox objects support iteration -- they already had the
appropriate next() method, and this is what people really want to do with
these objects in practice.
2001-05-02 20:20:53 +00:00
Marc-André Lemburg 542fe56cb9 Fix for bug #417030: "print '%*s' fails for unicode string" 2001-05-02 14:21:53 +00:00
Tim Peters 0e57abf0cd Generalize filter(f, seq) to work with iterators. This also generalizes
filter() to no longer insist that len(seq) be defined.
NEEDS DOC CHANGES.
2001-05-02 07:39:38 +00:00
Tim Peters 8ae2df483c Whitespace normalization. 2001-05-02 05:54:44 +00:00
Fred Drake 0e540c391f Added tests for Weak*Dictionary iterator support.
Refactored some object initialization to be more reusable.
2001-05-02 05:44:22 +00:00
Fred Drake 101209d44c Added iterator support to the Weak*Dictionary classes. 2001-05-02 05:43:09 +00:00
Tim Peters f553f89d45 Generalize list(seq) to work with iterators. This also generalizes list()
to no longer insist that len(seq) be defined.
NEEDS DOC CHANGES.
This is meant to be a model for how other functions of this ilk (max,
filter, etc) can be generalized similarly.  Feel encouraged to grab your
favorite and convert it!
Note some cute consequences:
    list(file) == file.readlines() == list(file.xreadlines())
    list(dict) == dict.keys()
    list(dict.iteritems()) = dict.items()
    list(xrange(i, j, k)) == range(i, j, k)
2001-05-01 20:45:31 +00:00
Jeremy Hylton ddc4fd03b1 Fix 2.1 nested scopes crash reported by Evan Simpson
The new test case demonstrates the bug.  Be more careful in
symtable_resolve_free() to add a var to cells or frees only if it
won't be added under some other rule.

XXX Add new assertion that will catch this bug.
2001-04-27 02:29:40 +00:00
Eric S. Raymond 53b809d673 Added more help, and recovery from misspelled sort key arguments. 2001-04-26 07:32:38 +00:00
Fred Drake 8f42e2b1fa Update test to accomodate the change to the namespace_separator parameter
of ParserCreate().

Added assignment tests for the ordered_attributes and specified_attributes
values, similar to the checks for the returns_unicode attribute.
2001-04-25 16:03:54 +00:00
Tim Peters c09cee4d92 SF bug 418615: regular expression bug in pipes.py.
Obviously bad regexps, spotted by Jeffery Collins.

HELP!  I can't run this on Windows, and the module test() function
probably doesn't work on anyone's box.  Could a Unixoid please write
an at least minimal working test and add it to the std test suite?
2001-04-25 03:43:14 +00:00
Andrew M. Kuchling b3ca303a4e Fix typo in docstring 2001-04-23 17:13:03 +00:00
Andrew M. Kuchling c42402fa19 Bump version # for final release 2001-04-23 16:01:06 +00:00
Guido van Rossum 8b48cf9016 Add test suite for iterators. 2001-04-21 13:33:54 +00:00
Tim Peters a3f98d6bac Give UserDict new __contains__ and __iter__ methods. 2001-04-21 09:13:15 +00:00
Guido van Rossum 59d1d2b434 Iterators phase 1. This comprises:
new slot tp_iter in type object, plus new flag Py_TPFLAGS_HAVE_ITER
new C API PyObject_GetIter(), calls tp_iter
new builtin iter(), with two forms: iter(obj), and iter(function, sentinel)
new internal object types iterobject and calliterobject
new exception StopIteration
new opcodes for "for" loops, GET_ITER and FOR_ITER (also supported by dis.py)
new magic number for .pyc files
new special method for instances: __iter__() returns an iterator
iteration over dictionaries: "for x in dict" iterates over the keys
iteration over files: "for x in file" iterates over lines

TODO:

documentation
test suite
decide whether to use a different way to spell iter(function, sentinal)
decide whether "for key in dict" is a good idea
use iterators in map/filter/reduce, min/max, and elsewhere (in/not in?)
speed tuning (make next() a slot tp_next???)
2001-04-20 19:13:02 +00:00
Jeremy Hylton 12e73bb2f0 dispatcher.__repr__() was unprepared to handle the address for a Unix
domain socket.  Fix that and make the error message for failures a
little more helpful by including the class name.
2001-04-20 19:04:55 +00:00
Guido van Rossum 0dbb4fba4c Implement, test and document "key in dict" and "key not in dict".
I know some people don't like this -- if it's really controversial,
I'll take it out again.  (If it's only Alex Martelli who doesn't like
it, that doesn't count as "real controversial" though. :-)

That's why this is a separate checkin from the iterators stuff I'm
about to check in next.
2001-04-20 16:50:40 +00:00
Fred Drake bd7f818c50 Weak*Dictionary: Added docstrings to the classes.
Weak*Dictionary.update():  No longer create a temporary list to hold the
    things that will be stuffed into the underlying dictionary.  This had
    been done so that if any of the objects used as the weakly-held value
    was not weakly-referencable, no updates would take place (TypeError
    would be raised).  With this change, TypeError will still be raised
    but a partial update could occur.  This is more like other .update()
    implementations.

Thoughout, use of the name "ref" as a local variable has been removed.  The
original use of the name occurred when the function to create a weak
reference was called "new"; the overloaded use of the name could be
confusing for someone reading the code.  "ref" used as a variable name
has been replaced with "wr" (for 'weak reference').
2001-04-19 16:26:06 +00:00
Jeremy Hylton 12b6457e24 Fix compileall.py so that it fails on SyntaxErrors
The changes cause compilation failures in any file in the Python
installation lib directory to cause the install to fail.  It looks
like compileall.py intended to behave this way, but a change to
py_compile.py and a separate bug defeated it.

Fixes SF bug #412436

This change affects the test suite, which contains several files that
contain intentional errors.  The solution is to extend compileall.py
with the ability to skip compilation of selected files.

NB compileall.py is changed so that compile_dir() returns success only
if all recursive calls to compile_dir() also check success.
2001-04-18 01:20:21 +00:00
Jeremy Hylton 3090694068 Fix compileall.py so that it fails on SyntaxErrors
The changes cause compilation failures in any file in the Python
installation lib directory to cause the install to fail.  It looks
like compileall.py intended to behave this way, but a change to
py_compile.py and a separate bug defeated it.

Fixes SF bug #412436

This change affects the test suite, which contains several files that
contain intentional errors.  The solution is to extend compileall.py
with the ability to skip compilation of selected files.

In the test suite, rename nocaret.py and test_future[3..7].py to start
with badsyntax_nocaret.py and badsyntax_future[3..7].py.  Update the
makefile to skip compilation of these files.  Update the tests to use
the name names for imports.

NB compileall.py is changed so that compile_dir() returns success only
if all recursive calls to compile_dir() also check success.
2001-04-18 01:19:28 +00:00
Eric S. Raymond bc41957d2b Unused variable (caught by PyChecker) removed. 2001-04-17 17:20:19 +00:00
Jeremy Hylton 5030cf1c2d Fix three PyChecker-detected gotchas.
Import OPT_ symbols from _symtable.
Define has_exec() and has_import_star().
2001-04-16 18:43:18 +00:00
Guido van Rossum a490d5856d In walk(), don't die when os.lstat() raises os.error, e.g. because a
file was deleted by a previous call to the visitor function.

This used to be the behavior in 1.5.2 and before, but a patch to avoid
making two stat() calls accidentally broke this in 2.0.

Moshe, this would be a good one for 2.0.1 too!
2001-04-16 18:12:04 +00:00
Fred Drake a0a4ab1772 Add a test case for Weak*Dictionary.update() that would have caught a
recently reported bug; also exposed some other bugs in the implementation.
2001-04-16 17:37:27 +00:00
Fred Drake 1d9e4b7de3 Weak*Dictionary.update(): Fix calls to [].append() to only have one
parameter.

Weak*Dictionary.get():  Make the second parameter optional.

WeakKeyDictionary.has_key(), .keys():  Make these actually work!
2001-04-16 17:34:48 +00:00
Guido van Rossum 67addfe2a8 Implement Mark Favas's suggestion. There's a clear bug in _group():
its first return statement returns a single value while its caller
always expects it to return a tuple of two items.  Fix this by
returning (s, 0) instead.

This won't make the locale test on Irix succeed, but now it will fail
because of a bug in the platform's en_US locale rather than because of
a bug in the locale module.
2001-04-16 16:04:10 +00:00
Guido van Rossum 42f92da307 Change the test data to ask for class C from module __main__ rather
than from module pickletester.  Using the latter turned out to cause
the test to break when invoked as "import test.test_pickle" or "import
test.autotest".
2001-04-16 00:28:21 +00:00
Guido van Rossum b8bf3bece2 Fix SF bug [ #416231 ] urllib.basejoin fails to apply some ../.
Reported by Juan M. Bello Rivas.
2001-04-15 20:47:33 +00:00
Guido van Rossum 2b5ff073ab Get rid of the seek() method on the _Mailbox class. This was a
cut-and-paste copy of the seek() method on the _Subfile class, but it
didn't make one bit of sense: it sets self.pos, which is not used in
this class or its subclasses, and it uses self.start and self.stop,
which aren't defined on this class or its subclasses.  This is purely
my own fault -- I added this in rev 1.4 and apparently never tried to
use it.  Since it's not documented, and of very questionable use given
that there's no tell(), I'm ripping it out.

This resolves SF bug 416199 by Andrew Dalke: mailbox.py seek problems.
2001-04-15 13:32:27 +00:00
Guido van Rossum fc349862d4 In order to make this test work on Windows, the test locale has to be
set to 'en' there -- Windows does not understand the 'en_US' locale.
The test succeeds there.
2001-04-15 13:15:56 +00:00
Guido van Rossum 2d996c0704 Fix typo (missing "req." prefix on error_302_dict) found by Neil
Norwitz's PyChecker.
2001-04-15 13:08:01 +00:00
Guido van Rossum b8b45eac71 Fix typo in exception name (UnimplementedError should be
NotImplementedError) found by Neil Norwitz's PyChecker.
2001-04-15 13:06:04 +00:00