Neal Norwitz [Fri, 14 Jun 2002 00:27:13 +0000 (00:27 +0000)]
Use \code{True} (or False) instead of true/false.
Not sure if code is correct, but that is what's in this file.
I've seen \constant{True} in other places.
Guido van Rossum [Thu, 13 Jun 2002 21:42:04 +0000 (21:42 +0000)]
Major cleanup operation: whenever there's a call that looks for an
optional attribute, only clear the exception when the internal getattr
operation raised AttributeError. Many places in this file already had
that policy; but just as many didn't, and there didn't seem to be any
rhyme or reason to it. Be consistently cautious.
Question: should I backport this? On the one hand it's a bugfix. On
the other hand it's a change in behavior. Certain forms of buggy or
just weird code would work in the past but raise an exception under
the new rules; e.g. if you define a __getattr__ method that raises a
non-AttributeError exception.
Guido van Rossum [Thu, 13 Jun 2002 21:32:51 +0000 (21:32 +0000)]
Fix for SF bug 532646. This is a little simpler than what Neal
suggested there, based upon a better analysis (__getattr__ is a red
herring). Will backport to 2.2.
Guido van Rossum [Thu, 13 Jun 2002 20:24:17 +0000 (20:24 +0000)]
Temporarily disable the timeout and socket tests.
They still run as standalone scripts, but when used as part of the
regression test suite, they are effectively no-ops.
(This is done by renaming test_main to main.)
Guido van Rossum [Thu, 13 Jun 2002 19:17:46 +0000 (19:17 +0000)]
Hopefully this addresses the remaining issues of SF bugs 459235 and
473985. Through a subtle rearrangement of some members in the etype
struct (!), mapping methods are now preferred over sequence methods,
which is necessary to support str.__getitem__("hello", slice(4)) etc.
Jeremy Hylton [Thu, 13 Jun 2002 17:28:18 +0000 (17:28 +0000)]
Refactor compile() method implementations.
Always use _setup_compile() to do the grunt work of processing
arguments, figuring out which files to compile, and emitting debug
messages for files that are up-to-date.
Jeremy Hylton [Thu, 13 Jun 2002 17:26:30 +0000 (17:26 +0000)]
Extend compiler() method with optional depends argument.
This change is not backwards compatible. If a compiler subclass
exists outside the distutils package, it may get called with the
unexpected keyword arg. It's easy to extend that compiler by having
it ignore the argument, and not much harder to do the right thing. If
this ends up being burdensome, we can change it before 2.3 final to
work harder at compatibility.
Also add _setup_compile() and _get_cc_args() helper functions that
factor out much of the boilerplate for each concrete compiler class.
Guido van Rossum [Thu, 13 Jun 2002 16:07:04 +0000 (16:07 +0000)]
Fix non-blocking connect() for Windows. Refactored the code
that retries the connect() call in timeout mode so it can be shared
between connect() and connect_ex(), and needs only a single #ifdef.
The test for this was doing funky stuff I don't approve of,
so I removed it in favor of a simpler test. This allowed me
to implement a simpler, "purer" form of the timeout retry code.
Hopefully that's enough (if you want to be fancy, use non-blocking
mode and decode the errors yourself, like before).
Jeremy Hylton [Thu, 13 Jun 2002 15:14:10 +0000 (15:14 +0000)]
More style changes and little cleanups.
Remove __init__ that just called base class __init__ with same args.
Fold long argument lists into fewer, shorter lines.
Remove parens in tuple unpacks.
Don't put multiple statements on one line with a semicolon.
In find_library_file() compute the library_filename() upfront.
Guido van Rossum [Thu, 13 Jun 2002 15:07:44 +0000 (15:07 +0000)]
Major overhaul of timeout sockets:
- setblocking(0) and settimeout(0) are now equivalent, and ditto for
setblocking(1) and settimeout(None).
- Don't raise an exception from internal_select(); let the final call
report the error (this means you will get an EAGAIN error instead of
an ETIMEDOUT error -- I don't care).
- Move the select to inside the Py_{BEGIN,END}_ALLOW_THREADS brackets,
so other theads can run (this was a bug in the original code).
- Redid the retry logic in connect() and connect_ex() to avoid masking
errors. This probably doesn't work for Windows yet; I'll fix that
next. It may also fail on other platforms, depending on what
retrying a connect does; I need help with this.
- Get rid of the retry logic in accept(). I don't think it was needed
at all. But I may be wrong.
Guido van Rossum [Wed, 12 Jun 2002 19:57:18 +0000 (19:57 +0000)]
Add some more basic tests to validate the argument checking of
settimeout(), test settimeout(None), and the interaction between
settimeout() and setblocking().
Guido van Rossum [Wed, 12 Jun 2002 03:45:21 +0000 (03:45 +0000)]
SF bug 567538: Generator can crash the interpreter (Finn Bock).
This was a simple typo. Strange that the compiler didn't catch it!
Instead of WHY_CONTINUE, two tests used CONTINUE_LOOP, which isn't a
why_code at all, but an opcode; but even though 'why' is declared as
an enum, comparing it to an int is apparently not even worth a
warning -- not in gcc, and not in VC++. :-(
Fred Drake [Tue, 11 Jun 2002 02:56:17 +0000 (02:56 +0000)]
Completely revise markup for the list of list methods; the new markup matches
the semantics and presentation used in the library reference.
Added an explanation of the use of [...] to denote optional arguments, since
this is the only use of this in a signature line.
Closes SF bug #567127.
Greg Ward [Mon, 10 Jun 2002 21:37:12 +0000 (21:37 +0000)]
Took initial_tab and subsequent_tab away from the fill() method and
transformed them into the initial_indent and subsequent_indent instance
attributes. Now they actually work as advertised, ie. they are
accounted for in the width of each output line. Plus you can use them
with wrap() as well as fill(), and fill() went from simple-and-broken to
trivial-and-working.
Guido van Rossum [Mon, 10 Jun 2002 21:10:27 +0000 (21:10 +0000)]
SF patch 560794 (Greg Chapman): deepcopy can't handle custom
metaclasses.
This is essentially the same problem as that reported in bug 494904
for pickle: deepcopy should treat instances of custom metaclasses the
same way it treats instances of type 'type'.
Greg Ward [Mon, 10 Jun 2002 20:26:02 +0000 (20:26 +0000)]
Make 'width' an instance attribute rather than an argument to the wrap()
and fill() methods. Keep interface of existing wrap() and fill()
functions by going back to having them construct a new TextWrapper
instance on each call, with the preferred width passed to the
constructor.
Guido van Rossum [Mon, 10 Jun 2002 15:29:03 +0000 (15:29 +0000)]
Undo the last chunk of the previous patch, putting back a useful
assert into PyType_Ready(): now that we're not clearing tp_dict, we
can assert that it's non-NULL again.
Guido van Rossum [Mon, 10 Jun 2002 15:24:42 +0000 (15:24 +0000)]
In the recent python-dev thread "Bizarre new test failure", we
discovered that subtype_traverse must traverse the type if it is a
heap type, because otherwise some cycles involving a type and its
instance would not be collected. Simplest example:
while 1:
class C(object): pass
C.ref = C()
This program grows without bounds before this fix. (It grows ever
slower since it spends ever more time in the collector.)
Simply adding the right visit() call to subtype_traverse() revealed
other problems. With MvL's help we re-learned that type_clear()
doesn't have to clear *all* references, only the ones that may not be
cleared by other means. Careful analysis (see comments in the code)
revealed that only tp_mro needs to be cleared. (The previous checkin
to this file adds a test for tp_mro==NULL to _PyType_Lookup() that's
essential to prevent crashes due to tp_mro being NULL when
subtype_dealloc() tries to look for a __del__ method.) The same kind
of analysis also revealed that subtype_clear() doesn't need to clear
the instance dict.
With this fix, a useful property of the collector is once again
guaranteed: a single gc.collect() call will clear out all garbage.
(It didn't always before, which put us on the track of this bug.)
Guido van Rossum [Mon, 10 Jun 2002 14:30:43 +0000 (14:30 +0000)]
Three's a charm: yet another fix for SF bug 551412. Thinking again
about the test case, slot_nb_power gets called on behalf of its second
argument, but with a non-None modulus it wouldn't check this, and
believes it is called on behalf of its first argument. Fix this
properly, and get rid of the code in _PyType_Lookup() that tries to
call _PyType_Ready(). But do leave a check for a NULL tp_mro there,
because this can still legitimately occur.
Jack Jansen [Sun, 9 Jun 2002 22:08:52 +0000 (22:08 +0000)]
- Better commandline interface to BuildApplet, complete with options,
verbose output to the console, etc.
- Allow Cocoa applets to be built with BuildApplet.
No full testing has been done yet to ensure OS9 operation hasn't suffered.
Greg Ward [Fri, 7 Jun 2002 21:56:16 +0000 (21:56 +0000)]
Add fix_sentence_endings option to control whether we ensure that
sentences are separated by two spaces.
Improve _fix_sentence_endings() a bit -- look for ".!?" instead of just
".", and factor out the list of sentence-ending punctuation characters
to a class attribute.