Under certain conditions (sometimes triggered by the test suite),
"from xml.parsers import expat" succeeds but the imported expat module
is an empty shell. Make sure we don't be fooled by that.
Correct the URL for the license (only used when the LICENSE[.txt] file
is not found). Being fancy: insert the first 3 characters of
sys.version in the URL.
Tim Peters [Tue, 2 Oct 2001 03:53:41 +0000 (03:53 +0000)]
SF patch [#466616] Exclude imported items from doctest,
from Tim Hochberg. Also mucho fiddling to change the way doctest
determines whether a thing is a function, module or class. Under 2.2,
this really requires the functions in inspect.py (e.g., types.ClassType
is close to meaningless now, if not outright misleading).
Tim Peters [Mon, 1 Oct 2001 20:22:45 +0000 (20:22 +0000)]
The description of dictionary comparison was out of date. Rather than
try to explain the complex general scheme we actually use now, I decided
to spell out only what equality means (which is easy to explain and
intuitive), leaving the other outcomes unspecified beyond consistency.
Tim Peters [Mon, 1 Oct 2001 19:50:06 +0000 (19:50 +0000)]
SF patch [#466353] Py_HUGE_VAL on BeOS for Intel.
The patch repaired internal gcc compiler errors on BeOS.
This checkin repairs them in a simpler way, by explicitly casting the
platform INFINITY to double.
- SLOT1BINFULL() macro: changed this to check for __rop__ overriding
__op__, like binary_op1() in abstract.c -- the latter only calls the
slot function once if both types use the same slot function, so the
slot function must make both calls -- which it already did for the
__op__, __rop__ order, but not yet for the __rop__, __op__ order
when B.__class__ is a subclass of A.__class__.
- slot_sq_contains(), slot_nb_nonzero(): use lookup_maybe() rather
than lookup_method() which sets an exception which we then clear.
- slot_nb_coerce(): don't give up when left argument's __coerce__
returns NotImplemented, but give the right argument a chance.
binary_op1(), ternary_op(): rearrange the code so that slotw is tested
(to see whether __rop__ should go before __op__) only when slotv is
set. This saves a test+branch when only slotw is set.
Fred Drake [Mon, 1 Oct 2001 16:32:13 +0000 (16:32 +0000)]
Refer to the objects which define __len__(), __*item__(), and __iter__()
as container objects rather than as mapping objects (in the index entries).
Change the section heading and intro sentence to be a little more general,
since that's how things have actually evolved.
SF patch #462628 (Travers Naran) NNTPLib supports saving BODY to a file.
I modified nntplib so the body method can accept an
optional second parameter pointing to a filehandle or
filename (string). This way, really long body
articles can be stored to disk instead of kept in
memory. The way I made the modification should make
it easy to extend this functionality to other extended
return methods.
Martin v. Löwis [Sun, 30 Sep 2001 20:32:11 +0000 (20:32 +0000)]
Patch #462190, patch #464070: Support quoted printable in the binascii module.
Decode and encode underscores for header style encoding. Fixes bug #463996.
Tim Peters [Sun, 30 Sep 2001 06:32:59 +0000 (06:32 +0000)]
The execfile() docs imply it acts on locals same as exec. But in truth
it acts more like assigning to keys in locals(), i.e. modifications to
function locals aren't reflected in the locals when execfile() returns.
Tim Peters [Sun, 30 Sep 2001 05:58:42 +0000 (05:58 +0000)]
SF bug [#466173] unpack TypeError unclear
Replaced 3 instances of "iter() of non-sequence" with
"iteration over non-sequence".
Restored "unpack non-sequence" for stuff like "a, b = 1".
Tim Peters [Sun, 30 Sep 2001 05:09:37 +0000 (05:09 +0000)]
SF [#466125] PyLong_AsLongLong works for any integer.
Generalize PyLong_AsLongLong to accept int arguments too. The real point
is so that PyArg_ParseTuple's 'L' code does too. That code was
undocumented (AFAICT), so documented it.
Fix two typos in the text about compile(), and add two caveats from
recent user feedback: you must end the input with \n and you must use
\n, not \r\n to represent line endings.
Fred Drake [Sat, 29 Sep 2001 05:05:25 +0000 (05:05 +0000)]
Fix up whitespace in <args> elements; reduce sequences of consecutive
whitespace characters to a single space.
Small changes elsewhere, mostly to clean up the code a little.
Fred Drake [Sat, 29 Sep 2001 04:58:32 +0000 (04:58 +0000)]
For Python 2.2, do not use __getattr__(), only use computed properties.
This is probably a little bit faster, but mostly is just cleaner code.
The old-style support is still used for Python versions < 2.2 so this
source file can be shared with PyXML.
Fred Drake [Sat, 29 Sep 2001 04:54:33 +0000 (04:54 +0000)]
_dispatch(): Do no re-define the resolve_dotted_atttribute() function
every time this gets called; move it out as a global helper function.
Simplify the call to the _dispatch() method of the registered instance.
Tim Peters [Sat, 29 Sep 2001 01:08:19 +0000 (01:08 +0000)]
The list.sort() docs require a function that returns -1, 0 or +1. That's
never been true, and in particular implies cmp() can't be used(!). Get
closer to the truth.
Clarify the warning about the relative dates of Setup.dist and Setup;
Jeremy had seen the warning but not realized what he should do about
it. Add the hint "Usually, copying Setup.dist to Setup will work."
Add a few ``__dynamic__ = 0'' lines in classes that need to preserve
staticness when __dynamic__ = 1 becomes the default:
- Some classes which are used to test the difference between static
and dynamic.
- Subclasses of complex: complex uses old-style numbers and the slot
wrappers used by dynamic classes only support new-style numbers.
(Ideally, the complex type should be fixed, but that looks like a
labor-intensive job.)
It's a fact: for binary operators, *under certain circumstances*,
__rop__ now takes precendence over __op__. Those circumstances are:
- Both arguments are new-style classes
- Both arguments are new-style numbers
- Their implementation slots for tp_op differ
- Their types differ
- The right argument's type is a subtype of the left argument's type
Also did this for the ternary operator (pow) -- only the binary case
is dealt with properly though, since __rpow__ is not supported anyway.
Fred Drake [Fri, 28 Sep 2001 20:25:45 +0000 (20:25 +0000)]
Tighten up the new NodeList implementation.
Clean up a little; do not create an alias that is only used once, or store
attributes with constant values in an instance.
Tim Peters [Fri, 28 Sep 2001 20:14:46 +0000 (20:14 +0000)]
regrtest's -g option stopped working, during the changes to improve
error-reporting for the classic compare-expected-output tests.
Curiously, the bug consisted of not simplifying the logic enough!
Fred Drake [Fri, 28 Sep 2001 19:01:26 +0000 (19:01 +0000)]
Clean up circular references in the Weak*Dictionary classes; this avoids
depending on the cycle detector code in the library implementation.
This is a *slightly* different patch than SF patch #417795, but takes
the same approach. (This version avoids calling the __len__() method of
the dict in the remove() functions.)
This closes SF patch #417795.
Changes to copy() and deepcopy() in copy.py to support __reduce__ as a
fallback for objects that are neither supported by our dispatch table
nor have a __copy__ or __deepcopy__ method.
Changes to _reduce() in copy_reg.py to support reducing objects that
don't have a __dict__ -- copy.copy(complex()) now invokes _reduce().
Add tests for copy.copy() and copy.deepcopy() to test_regrtest.py.
Fred Drake [Fri, 28 Sep 2001 17:14:35 +0000 (17:14 +0000)]
Convert to string methods.
For the real document element, make sure the prolog is migrated into
the document element so it isn't left stranded.
Make fixup_trailing_whitespace() whitespace do what was really intended.
Add the *desc environments used in the C API manual to the list of
things that can exist at the paragraph level so they don't get wrapped
in <para>...</para>.
Fred Drake [Thu, 27 Sep 2001 17:01:59 +0000 (17:01 +0000)]
Do not distinguish \refmodule from \module in the generated output;
whether or not a link will be generated will depend on the link database.
Add a couple of explanatory comments for one of the stranger constructs
(giving input an empty name).
Fred Drake [Thu, 27 Sep 2001 16:28:42 +0000 (16:28 +0000)]
Change the sense of a test in how the profiler interprets exception events.
This should fix a bug in how time is allocated during exception propogation
(esp. in the presence of finally clauses).
Fred Drake [Thu, 27 Sep 2001 04:16:27 +0000 (04:16 +0000)]
Markup adjustment: \[...\] is math markup and does not translate well when
used with text as was done here. Fixed so that the typeset version wraps
the warning text and the HTML version does not create images of the warning
text.
Tim Peters [Thu, 27 Sep 2001 04:08:16 +0000 (04:08 +0000)]
docroutine() (both instances): Docstrings for class methods weren't
getting displayed, due to a special case here whose purpose I didn't
understand. So just disabled the doc suppression here.
Another special case here skips the docs when picking apart a method
and finding that the im_func is also in the class __dict__ under
the same name. That one I understood. It has a curious consequence,
though, wrt inherited properties: a static class copies inherited stuff
into the inheriting class's dict, and that affects whether or not this
special case triggers. The upshoot is that pydoc doesn't show the
function docstrings of getter/setter/deleter functions of inherited
properties in the property section when the class is static, but does
when the class is dynamic (bring up Lib/test/pydocfodder.py under
GUI pydoc to see this).
Tim Peters [Wed, 26 Sep 2001 22:39:22 +0000 (22:39 +0000)]
Removed no-longer-true comment about pydoc working under all versions of
Python since 1.5 (virtually everything I changed over the last week relies
on "modern" features, particularly nested scopes).
Tim Peters [Wed, 26 Sep 2001 21:31:51 +0000 (21:31 +0000)]
Display a class's method resolution order, if it's non-trivial. "Trivial"
here means it has no more than one base class to rummage through (in which
cases there's no potential confusion about resolution order).
Jeremy Hylton [Wed, 26 Sep 2001 20:01:13 +0000 (20:01 +0000)]
Add tests for new PyErr_NormalizeException() behavior
Add raise_exception() to the _testcapi module. It isn't a test, but
the C API exists only to support test_exceptions. raise_exception()
takes two arguments -- an exception class and an integer specifying
how many arguments it should be called with.
test_exceptions uses BadException() to test the interpreter's behavior
when there is a problem instantiating the exception. test_capi1()
calls it with too many arguments. test_capi2() causes an exception to
be raised in the Python code of the constructor.