]> granicus.if.org Git - python/log
python
23 years agoDon't export generators future info
Jeremy Hylton [Wed, 26 Sep 2001 19:54:08 +0000 (19:54 +0000)]
Don't export generators future info

23 years agoPrevent a NULL pointer from being pushed onto the stack.
Jeremy Hylton [Wed, 26 Sep 2001 19:24:45 +0000 (19:24 +0000)]
Prevent a NULL pointer from being pushed onto the stack.

It's possible for PyErr_NormalizeException() to set the traceback
pointer to NULL.  I'm not sure how to provoke this directly from
Python, although it may be possible.  The error occurs when an
exception is set using PyErr_SetObject() and another exception occurs
while PyErr_NormalizeException() is creating the exception instance.

XXX As a result of this change, it's possible for an exception to
occur but sys.last_traceback to be left undefined.  Not sure if this
is a problem.

23 years agoMove the styling for the HTML version of \mailheader into the CSS file.
Fred Drake [Wed, 26 Sep 2001 18:46:36 +0000 (18:46 +0000)]
Move the styling for the HTML version of \mailheader into the CSS file.
In both the HTML and typeset versions of the documentation, add a colon
after the name of a mail header so that it is more easily distinguished
from other text.

23 years agoNote that the colon following a mail header name should not be included
Fred Drake [Wed, 26 Sep 2001 18:43:20 +0000 (18:43 +0000)]
Note that the colon following a mail header name should not be included
when using the \mailheader markup.
Change a couple of inline examples to show the markup rather than the
result.

23 years agoTypo fix.
Greg Ward [Wed, 26 Sep 2001 18:12:49 +0000 (18:12 +0000)]
Typo fix.

23 years agoMove the \mailheader description to the right place.
Fred Drake [Wed, 26 Sep 2001 17:01:58 +0000 (17:01 +0000)]
Move the \mailheader description to the right place.
Clarify the \mimetype description; it can be used to refer to a part of a
MIME type name, so \mimetype{text} or \mimetype{plain} can be used, not
just \mimetype{text/plain}.

23 years agoStart making some markup adjustments; Barry has indicated he will work on
Fred Drake [Wed, 26 Sep 2001 16:52:18 +0000 (16:52 +0000)]
Start making some markup adjustments; Barry has indicated he will work on
this before we finish the integration, along with some restructuring.

23 years agoTest case for SF bugs #463359 and #462937, added to test_grammar for lack of
Thomas Wouters [Wed, 26 Sep 2001 12:43:39 +0000 (12:43 +0000)]
Test case for SF bugs #463359 and #462937, added to test_grammar for lack of
a better place. Excessively fragile code, but at least it breaks when
something in this area changes!

23 years agoUpdate the tests for the current incarnation of the email package, and
Barry Warsaw [Wed, 26 Sep 2001 05:47:08 +0000 (05:47 +0000)]
Update the tests for the current incarnation of the email package, and
added some new tests of message/delivery-status content type messages.

23 years agoMore test messages for test_email.py
Barry Warsaw [Wed, 26 Sep 2001 05:45:17 +0000 (05:45 +0000)]
More test messages for test_email.py

23 years ago_parsebody(): Use get_boundary() and get_type().
Barry Warsaw [Wed, 26 Sep 2001 05:44:09 +0000 (05:44 +0000)]
_parsebody(): Use get_boundary() and get_type().

    Also, add a clause to the big-if to handle message/delivery-status
    content types.  These create a message with subparts that are
    Message instances, which best represent the header blocks of this
    content type.

23 years agohas_key(): Implement in terms of get().
Barry Warsaw [Wed, 26 Sep 2001 05:41:51 +0000 (05:41 +0000)]
has_key(): Implement in terms of get().

get_type(): Use a compiled regular expression, which can be shared.

_get_params_preserve(): A helper method which extracts the header's
    parameter list preserving value quoting.  I'm not sure that this
    needs to be a public method.  It's necessary because we want
    get_param() and friends to return the unquoted parameter value,
    however we want the quote-preserved form for set_boundary().

get_params(), get_param(), set_boundary(): Implement in terms of
    _get_params_preserve().

walk(): Yield ourself first, then recurse over our subparts (if any).

23 years ago__init__(): Arguments major renamed to maintype and minor renamed to
Barry Warsaw [Wed, 26 Sep 2001 05:36:36 +0000 (05:36 +0000)]
__init__(): Arguments major renamed to maintype and minor renamed to
    subtype for consistency with the rest of the package.

23 years agoUpdated docstrings. Also,
Barry Warsaw [Wed, 26 Sep 2001 05:35:47 +0000 (05:35 +0000)]
Updated docstrings.  Also,

typed_subpart_iterator(): Arguments major renamed to maintype and
    minor renamed to subtype for consistency with the rest of the
    package.

23 years agoImage.py and class Image => MIMEImage.py and MIMEImage
Barry Warsaw [Wed, 26 Sep 2001 05:34:30 +0000 (05:34 +0000)]
Image.py and class Image => MIMEImage.py and MIMEImage

Text.py and class Text => MIMEText.py and MIMEText

MessageRFC822.py and class MessageRFC822 => MIMEMessage.py and MIMEMessage

These are renamed so as to be more consistent; these are MIME specific
derived classes for when creating the object model out of whole cloth.

23 years agoIn class Generator:
Barry Warsaw [Wed, 26 Sep 2001 05:32:41 +0000 (05:32 +0000)]
In class Generator:

    _handle_text(): If the payload is None, then just return (i.e. don't
write anything).  Subparts of message/delivery-status types
will have this property since they are just blocks of headers.

Also, when raising the TypeError, include the type of the
payload in the error message.

    _handle_multipart(), _handle_message(): When creating a clone of self,
pass in our _mangle_from_ and maxheaderlen flags so the clone
has the same behavior.

    _handle_message_delivery_status(): New method to do the proper
printing of message/delivery-status type messages.  These have
to be handled differently than other message/* types because
their payloads are subparts containing just blocks of headers.

In class DecodedGenerator:

    _dispatch(): Skip over multipart/* messages since we don't care
        about them, and don't want the non-text format to appear in
        the printed results.

23 years agocosmetic
Barry Warsaw [Wed, 26 Sep 2001 05:26:22 +0000 (05:26 +0000)]
cosmetic

23 years agoThe email package documentation, currently organized the way I think
Barry Warsaw [Wed, 26 Sep 2001 05:23:47 +0000 (05:23 +0000)]
The email package documentation, currently organized the way I think
Fred prefers.  I'm not sure I like this organization, so it may change.

23 years agoSF [#463737] Add types.CallableIterType
Tim Peters [Tue, 25 Sep 2001 22:02:03 +0000 (22:02 +0000)]
SF [#463737] Add types.CallableIterType
Rather than add umpteen new obscure internal Iter types, got rid of all of
them.  See the new comment.

23 years agotest_iterator(): Don't do a type comparison to see if it's an
Barry Warsaw [Tue, 25 Sep 2001 21:40:04 +0000 (21:40 +0000)]
test_iterator(): Don't do a type comparison to see if it's an
iterator, just test to make sure it has the two required iterator
protocol methods __iter__() and next() -- actually just test
hasattr-ness.

23 years agoadd_operators(): the __floordiv__ and __truediv__ descriptors (and
Guido van Rossum [Tue, 25 Sep 2001 21:16:33 +0000 (21:16 +0000)]
add_operators(): the __floordiv__ and __truediv__ descriptors (and
their 'i' and 'r' variants) were not being generated if the
corresponding nb_ slots were present in the type object.  I bet this
is because floor and true division were introduced after I last
looked at that part of the code.

23 years agoUpdate to support \mailheader and 5-column tables.
Fred Drake [Tue, 25 Sep 2001 20:58:13 +0000 (20:58 +0000)]
Update to support \mailheader and 5-column tables.

23 years agoSimplify a helper by returning fewer values.
Fred Drake [Tue, 25 Sep 2001 20:57:36 +0000 (20:57 +0000)]
Simplify a helper by returning fewer values.

23 years agoFactor out the protect-from-exceptions helpers and make capture_events()
Fred Drake [Tue, 25 Sep 2001 20:48:14 +0000 (20:48 +0000)]
Factor out the protect-from-exceptions helpers and make capture_events()
use it.  This simplifies the individual tests a little.

Added some new tests related to exception handling.

23 years agoGuido points out that sys.__stdout__ is a bit bucket under IDLE. So keep
Tim Peters [Tue, 25 Sep 2001 20:05:11 +0000 (20:05 +0000)]
Guido points out that sys.__stdout__ is a bit bucket under IDLE.  So keep
the local save/modify/restore of sys.stdout, but add machinery so that
regrtest can tell test_support the value of sys.stdout at the time
regrtest.main() started, and test_support can pass that out later to anyone
who needs a "visible" stdout.

23 years ago_reconstructor(): there's no need for tricks with assignment to
Guido van Rossum [Tue, 25 Sep 2001 19:46:05 +0000 (19:46 +0000)]
_reconstructor(): there's no need for tricks with assignment to
__class__.  The __new__ protocol is up to this.  (Thanks to Tim for
pointing this out.)

23 years agotest_support should be imported directly, not via test.test_support.
Tim Peters [Tue, 25 Sep 2001 19:29:35 +0000 (19:29 +0000)]
test_support should be imported directly, not via test.test_support.

23 years agoGet rid of the increasingly convoluted global tricks w/ sys.stdout, in
Tim Peters [Tue, 25 Sep 2001 19:13:20 +0000 (19:13 +0000)]
Get rid of the increasingly convoluted global tricks w/ sys.stdout, in
favor of local save/modify/restore.  The test suite should run fine again.

23 years agoClarified some points about the interface to the mmap() function.
Fred Drake [Tue, 25 Sep 2001 19:00:08 +0000 (19:00 +0000)]
Clarified some points about the interface to the mmap() function.
This closes SF bug #448918.

23 years agoMinor changes.
Fred Drake [Tue, 25 Sep 2001 16:32:02 +0000 (16:32 +0000)]
Minor changes.

23 years agoRevise the example to be more resiliant in the face of continued use after
Fred Drake [Tue, 25 Sep 2001 16:29:17 +0000 (16:29 +0000)]
Revise the example to be more resiliant in the face of continued use after
the object has been pickled; don't mutate the instance dict in the
__getstate__() method.  Other minor changes for style.  Broke up the
displayed interactive session to get better page-breaking behavior for
typeset versions, and to point out an important aspect of the example.

This closes SF bug #453914.

23 years ago- Provisional support for pickling new-style objects. (*)
Guido van Rossum [Tue, 25 Sep 2001 16:25:58 +0000 (16:25 +0000)]
- Provisional support for pickling new-style objects. (*)

- Made cls.__module__ writable.

- Ensure that obj.__dict__ is returned as {}, not None, even upon first
  reference; it simply springs into life when you ask for it.

(*) The pickling support is provisional for the following reasons:

- It doesn't support classes with __slots__.

- It relies on additional support in copy_reg.py: the C method
  __reduce__, defined in the object class, really calls calling
  copy_reg._reduce(obj).  Eventually the Python code in copy_reg.py
  needs to be migrated to C, but I'd like to experiment with the
  Python implementation first.  The _reduce() code also relies on an
  additional helper function, _reconstructor(), defined in
  copy_reg.py; this should also be reimplemented in C.

23 years agoSet sys.save_stdout (to sys.stdout), so doctest-using tests can be run
Guido van Rossum [Tue, 25 Sep 2001 16:21:39 +0000 (16:21 +0000)]
Set sys.save_stdout (to sys.stdout), so doctest-using tests can be run
standalone.

23 years agoAdded documentation for the SSL interface, contributed by Gerhard Häring.
Fred Drake [Tue, 25 Sep 2001 15:48:11 +0000 (15:48 +0000)]
Added documentation for the SSL interface, contributed by Gerhard Häring.
This closes SF patch #461337.

23 years agoFix a URL (closing SF patch #462195).
Fred Drake [Tue, 25 Sep 2001 15:12:41 +0000 (15:12 +0000)]
Fix a URL (closing SF patch #462195).
Cleaned up a bunch of XXX comments containing links to additional
information, replacing them with proper references.
Replaced "MacOS" with "Mac OS", since that's what the style guide says.

23 years agoSF patch #459385 (Norman Vine): time.timezone fix for Cygwin.
Guido van Rossum [Tue, 25 Sep 2001 13:59:01 +0000 (13:59 +0000)]
SF patch #459385 (Norman Vine): time.timezone fix for Cygwin.

Also did some whitespace normalization.

23 years ago+ Display property functions in the same order they're specified to
Tim Peters [Tue, 25 Sep 2001 06:30:51 +0000 (06:30 +0000)]
+ Display property functions in the same order they're specified to
  property() (get, set, del; not set, get, del).

+ Change "Data defined/inherited in ..." header lines to
  "Data and non-method functions defined/inherited in ...".  Things like
  the value of __class__, and __new__, and class vrbls like the i in
      class C:
          i = int
  show up in this section too.  I don't think it's worth a separate
  section to distinguish them from non-callable attrs, and there's no
  obvious reliable way to distinguish callable from non-callable attrs
  anyway.

23 years agoNote a few tasks that are done now.
Guido van Rossum [Tue, 25 Sep 2001 06:20:52 +0000 (06:20 +0000)]
Note a few tasks that are done now.

23 years agoSeparate out the type/class-related news and reword some items.
Guido van Rossum [Tue, 25 Sep 2001 04:15:41 +0000 (04:15 +0000)]
Separate out the type/class-related news and reword some items.

Add news items about comparisons, repr(), __class__ assignment.

23 years agoChange repr() of a new-style class to say <class 'ClassName'> rather
Guido van Rossum [Tue, 25 Sep 2001 03:56:29 +0000 (03:56 +0000)]
Change repr() of a new-style class to say <class 'ClassName'> rather
than <type 'ClassName'>.  Exception: if it's a built-in type or an
extension type, continue to call it <type 'ClassName>.  Call me a
wimp, but I don't want to break more user code than necessary.

23 years agoMake __class__ assignment possible, when the object structures are the
Guido van Rossum [Tue, 25 Sep 2001 03:43:42 +0000 (03:43 +0000)]
Make __class__ assignment possible, when the object structures are the
same.  I hope the test for structural equivalence is stringent enough.
It only allows the assignment if the old and new types:

- have the same basic size
- have the same item size
- have the same dict offset
- have the same weaklist offset
- have the same GC flag bit
- have a common base that is the same except for maybe the dict and
  weaklist (which may have been added separately at the same offsets
  in both types)

23 years ago+ Got rid of all instances of <small>. Under IE5, GUI-mode pydoc has
Tim Peters [Tue, 25 Sep 2001 03:18:32 +0000 (03:18 +0000)]
+ Got rid of all instances of <small>.  Under IE5, GUI-mode pydoc has
  always been close to useless, because the <small>-ified docstrings
  were too small to read, even after cranking up my default font size
  just for pydoc.  Now it reads fine under my defaults (as does most
  of the web <0.5 wink>).  If it's thought important to play tricks
  with font size, tough, then someone should rework pydoc to use style
  sheets, and (more) predictable percentage-of-default size controls.

+ Tried to ensure that all <dt> and <dd> tags are closed.  I've read (but
  don't know) that some browsers get confused if they're not, and esp.
  when style sheets are in use too.

23 years agoGUI mode now displays useful stuff for properties. This is usually better
Tim Peters [Tue, 25 Sep 2001 00:01:06 +0000 (00:01 +0000)]
GUI mode now displays useful stuff for properties.  This is usually better
than text mode, since here we can hyperlink from the getter etc methods
back to their definitions.

23 years ago+ Text-mode (but not yet GUI mode) pydoc now produces useful stuff for
Tim Peters [Mon, 24 Sep 2001 22:40:47 +0000 (22:40 +0000)]
+ Text-mode (but not yet GUI mode) pydoc now produces useful stuff for
  properties:  the docstring (if any) is displayed, and the getter, setter
  and deleter (if any) functions are named.  All that is shown indented
  after the property name.

+ Text-mode pydoc class display now draws a horizontal line between
  class attribute groups (similar to GUI mode -- while visually more
  intrusive in text mode, it's still an improvement).

23 years agoMake properties discoverable from Python:
Tim Peters [Mon, 24 Sep 2001 21:17:50 +0000 (21:17 +0000)]
Make properties discoverable from Python:

- property() now takes 4 keyword arguments:  fget, fset, fdel, doc.
  Note that the real purpose of the 'f' prefix is to make fdel fit in
  ('del' is a keyword, so can't used as a keyword argument name).

- These map to visible readonly attributes 'fget', 'fset', 'fdel',
  and '__doc__' in the property object.

- fget/fset/fdel weren't discoverable from Python before.

- __doc__ is new, and allows to associate a docstring with a property.

23 years agoAdded several new tests to check the behavior with respect to doctype
Fred Drake [Mon, 24 Sep 2001 20:22:09 +0000 (20:22 +0000)]
Added several new tests to check the behavior with respect to doctype
declarations and weird markup that we used to accept & ignore that recent
versions raised an exception for; the original behavior has been restored
and augmented (the user can decide what to do if they care; the default is
to ignore it as done in early versions).

23 years agoAdapt to use the test_main() approach.
Fred Drake [Mon, 24 Sep 2001 20:19:08 +0000 (20:19 +0000)]
Adapt to use the test_main() approach.

23 years agoRe-factor the SGMLParser class to use the new markupbase.ParserBase class.
Fred Drake [Mon, 24 Sep 2001 20:15:51 +0000 (20:15 +0000)]
Re-factor the SGMLParser class to use the new markupbase.ParserBase class.
Use a new internal method, error(), consistently to raise parse errors;
the new base class also uses this.
Adjust the parse_comment() method to return the new offset into the buffer
instead of the number of characters scanned; this was the only helper
method that did it this way, so we have better consistency now.  Required
to share the new base class.
This fixes SF bug #448482 and #453706.

23 years agoRe-factor the HTMLParser class to use the new markupbase.ParserBase class.
Fred Drake [Mon, 24 Sep 2001 20:10:28 +0000 (20:10 +0000)]
Re-factor the HTMLParser class to use the new markupbase.ParserBase class.
Use a new internal method, error(), consistently to raise parse errors;
the new base class also uses this.

23 years agoBe consistent about the string module.
Fred Drake [Mon, 24 Sep 2001 20:04:29 +0000 (20:04 +0000)]
Be consistent about the string module.

23 years agoNew base class for the SGMLParser and HTMLParser classes from the sgmllib
Fred Drake [Mon, 24 Sep 2001 20:01:28 +0000 (20:01 +0000)]
New base class for the SGMLParser and HTMLParser classes from the sgmllib
and HTMLParser modules (and indirectly for the htmllib.HTMLParser class).

This has all the support for scanning over DOCTYPE declarations; it warrants
having a base class since this is a fair amount of tedious code (since it's
fairly strict), and should be in a separate module to avoid compiling many
REs that are not used (which would happen if this were placed in either then
sgmllib or HTMLParser module).

23 years agoDon't swap the arguments to PyFrame_BlockSetup when recreating the recently
Thomas Wouters [Mon, 24 Sep 2001 19:32:01 +0000 (19:32 +0000)]
Don't swap the arguments to PyFrame_BlockSetup when recreating the recently
popped frame-block. What an embarrassing bug! Especially for Jeremy, since
he accepted the patch :-)

This fixes SF bugs #463359 and #462937, and possibly other, *very* obscure
bugs with very deeply nested loops that continue the loop and then break out
of it or raise an exception.

23 years agoAnother comparison patch-up: comparing a type with a dynamic metatype
Guido van Rossum [Mon, 24 Sep 2001 18:47:40 +0000 (18:47 +0000)]
Another comparison patch-up: comparing a type with a dynamic metatype
to one with a static metatype raised an obscure error.

23 years agoAdd more tests showing the relationship between exceptions raised & caught
Fred Drake [Mon, 24 Sep 2001 18:44:11 +0000 (18:44 +0000)]
Add more tests showing the relationship between exceptions raised & caught
and the information provided to the profiler.  This stuff is a mess!

23 years agoDo the same thing to complex that I did to str: the rich comparison
Guido van Rossum [Mon, 24 Sep 2001 17:52:04 +0000 (17:52 +0000)]
Do the same thing to complex that I did to str: the rich comparison
function returns NotImplemented when comparing objects whose
tp_richcompare slot is not itself.

23 years agoStringIO patch #462596: let's [c]StringIO accept read buffers on
Marc-André Lemburg [Mon, 24 Sep 2001 17:34:52 +0000 (17:34 +0000)]
StringIO patch #462596: let's [c]StringIO accept read buffers on
input to .write() too.

23 years agoFixed old bug (caused by careless Carbonizing) that noone noticed until
Just van Rossum [Mon, 24 Sep 2001 17:29:09 +0000 (17:29 +0000)]
Fixed old bug (caused by careless Carbonizing) that noone noticed until
this week (apparently me and Bob Heeter at more or less the same time).

23 years agoPatch #463421: speed up md5 module with real memcpy/set.
Martin v. Löwis [Mon, 24 Sep 2001 17:14:40 +0000 (17:14 +0000)]
Patch #463421: speed up md5 module with real memcpy/set.

23 years agoChange string comparison so that it applies even when one (or both)
Guido van Rossum [Mon, 24 Sep 2001 16:51:54 +0000 (16:51 +0000)]
Change string comparison so that it applies even when one (or both)
arguments are subclasses of str, as long as they don't override rich
comparison.

23 years agoFix the baffler that Tim reported: sometimes the repr() of an object
Guido van Rossum [Mon, 24 Sep 2001 16:03:59 +0000 (16:03 +0000)]
Fix the baffler that Tim reported: sometimes the repr() of an object
looks like <X object at ...>, sometimes it says <X instance at ...>.
Make this uniformly say <X object at ...>.

23 years agoAdd more signature information and some descriptions for the new APIs
Fred Drake [Mon, 24 Sep 2001 15:31:50 +0000 (15:31 +0000)]
Add more signature information and some descriptions for the new APIs
introduced in Python 2.2.
Add documentation for the slice object interface (not complete).
Added version annotations for several of the Python 2.2 APIs already
documented.

23 years agoAdd more reference count information.
Fred Drake [Mon, 24 Sep 2001 15:29:47 +0000 (15:29 +0000)]
Add more reference count information.

23 years agoAdd link to Unix Review's 2.2 article
Andrew M. Kuchling [Mon, 24 Sep 2001 14:51:16 +0000 (14:51 +0000)]
Add link to Unix Review's 2.2 article
Fix two errors

23 years agostart of new config handling stuff
Steven M. Gava [Mon, 24 Sep 2001 09:43:17 +0000 (09:43 +0000)]
start of new config handling stuff

23 years agoMore work on class display:
Tim Peters [Mon, 24 Sep 2001 08:05:11 +0000 (08:05 +0000)]
More work on class display:

+ Minor code cleanup, generalization and simplification.

+ "Do something" to make the attribute aggregation more apparent:
    - In text mode, stick a "* " at the front of subgroup header lines.
    - In GUI mode, display a horizontal rule between subgroups.
   For GUI mode, this is a huge improvement, at least under IE.

23 years agoTry to do for pydoc's GUI mode what the earlier checkin did for text
Tim Peters [Mon, 24 Sep 2001 04:47:19 +0000 (04:47 +0000)]
Try to do for pydoc's GUI mode what the earlier checkin did for text
mode (identify the source class for class attrs; segregate attrs according
to source class, and whether class method, static method, property, plain
method, or data; display data attrs; display docstrings for data attrs
when possible).

Alas, this is mondo ugly, and I'm no HTML guy.  Part of the problem is
that pydoc's GUI mode has always been ugly under IE, largely because
<small> under IE renders docstrings unreadably small (while sometimes
non-docstring text is painfully large).  Another part is that these
segregated listings of attrs would *probably* look much better as bulleted
lists.  Alas, when I tried that, the bullets all ended up on lines by
themselves, before the method names; this is apparently because pydoc
(ab?)uses definition lists for format effects, and at least under IE
if a definition list is the first chunk of a list item, it gets rendered
on a line after the <li> bullet.

An HTML wizard would certainly be welcomed here.

23 years agoAdded a note about the new email package.
Barry Warsaw [Mon, 24 Sep 2001 04:28:10 +0000 (04:28 +0000)]
Added a note about the new email package.

23 years agoPart of a partial solution to SF bugs 463378, 463381, 463383, 463384.
Tim Peters [Sun, 23 Sep 2001 21:29:55 +0000 (21:29 +0000)]
Part of a partial solution to SF bugs 463378, 463381, 463383, 463384.
This almost entirely replaces how pydoc pumps out class docs, but only
in text mode (like help(whatever) from a Python shell), not in GUI mode.

A class C's attrs are now grouped by the class in which they're defined,
attrs defined by C first, then inherited attrs grouped by alphabetic order
of the defining classes' names.

Within each of those groups, the attrs are subgrouped according to whether
they're plain methods, class methods, static methods, properties, or data.
Note that pydoc never dumped class data attrs before.  If a class data
attr is implemented via a data descriptor, the data docstring (if any)
is also displayed (e.g., file.softspace).

Within a subgroup, the attrs are listed alphabetically.

This is a friggin' mess, and there are bound to be glitches.  Please
beat on it and complain!  Here are three glitches:

1. __new__ gets classifed as 'data', for some reason.  This will
   have to get fixed in inspect.py, but since the latter is already
   looking for any clue that something is a method, pydoc will
   almost certainly not know what to do with it when its classification
   changes.

2. properties are special-cased to death.  Unlike any other kind of
   function or method, they don't have a __name__ attr, so none of
   pydoc's usual code can deal with them.  Worse, the getter and
   setter and del'er methods associated with a property don't appear
   to be discoverable from Python, so there's really nothing I can
   think of to do here beyond just listing their names.

   Note that a property can't be given a docstring, either (or at least
   I've been unable to sneak one in) -- perhaps the property()
   constructor could take an optional doc argument?

3. In a nested-scopes world, pydoc still doesn't know anything about
   nesting, so e.g. classes nested in functions are effectively invisible.

23 years agoReactivate participation of expat parsers in GC. Fixes bug #462710.
Martin v. Löwis [Sun, 23 Sep 2001 10:20:10 +0000 (10:20 +0000)]
Reactivate participation of expat parsers in GC. Fixes bug #462710.

23 years agoInstall the new Lib/email pkg.
Tim Peters [Sun, 23 Sep 2001 07:02:29 +0000 (07:02 +0000)]
Install the new Lib/email pkg.
Create & populate the new Lib/test/data directory.

23 years agoGeneralize file.writelines() to allow iterable objects.
Tim Peters [Sun, 23 Sep 2001 04:06:05 +0000 (04:06 +0000)]
Generalize file.writelines() to allow iterable objects.

23 years agoThe test data (mostly example messages) for the email package test
Barry Warsaw [Sun, 23 Sep 2001 03:19:33 +0000 (03:19 +0000)]
The test data (mostly example messages) for the email package test
suite.  Note that other tests can put input data in this directory.

23 years agoAn extensive test suite for the email package.
Barry Warsaw [Sun, 23 Sep 2001 03:18:13 +0000 (03:18 +0000)]
An extensive test suite for the email package.

23 years agoThe email package version 1.0, prototyped as mimelib
Barry Warsaw [Sun, 23 Sep 2001 03:17:28 +0000 (03:17 +0000)]
The email package version 1.0, prototyped as mimelib
<http://sf.net/projects/mimelib>.  There /are/ API differences between
mimelib and email, but most of the implementations are shared (except
where cool Py2.2 stuff like generators are used).

23 years agoAdded API information for the PyCallIter_*() and PySeqIter_*() functions.
Fred Drake [Sun, 23 Sep 2001 02:05:26 +0000 (02:05 +0000)]
Added API information for the PyCallIter_*() and PySeqIter_*() functions.
Added signatures for some new PyType_*() functions.

23 years agoNew function classify_class_attrs(). As a number of SF bug reports
Tim Peters [Sun, 23 Sep 2001 02:00:29 +0000 (02:00 +0000)]
New function classify_class_attrs().  As a number of SF bug reports
point out, pydoc doesn't tell you where class attributes were defined,
gets several new 2.2 features wrong, and isn't aware of some new features
checked in on Thursday <wink>.  pydoc is hampered in part because
inspect.py has the same limitations.  Alas, I can't think of a way to
fix this within the current architecture of inspect/pydoc:  it's simply
not possible in 2.2 to figure out everything needed just from examining
the object you get back from class.attr.  You also need the class
context, and the method resolution order, and tests against various things
that simply didn't exist before.  OTOH, knowledge of how to do that is
getting quite complex, so doesn't belong in pydoc.

classify_class_attrs takes a different approach, analyzing all
the class attrs "at once", and returning the most interesting stuff for
each, all in one gulp.  pydoc needs to be reworked to use this for
classes (instead of the current "filter dir(class) umpteen times against
assorted predicates" approach).

23 years agoFix restore (difflib.restore() became a generator too).
Tim Peters [Sat, 22 Sep 2001 21:59:18 +0000 (21:59 +0000)]
Fix restore (difflib.restore() became a generator too).

23 years agoMake difflib.ndiff() and difflib.Differ.compare() generators. This
Tim Peters [Sat, 22 Sep 2001 21:30:22 +0000 (21:30 +0000)]
Make difflib.ndiff() and difflib.Differ.compare() generators.  This
restores the 2.1 ability of Tools/scripts/ndiff.py to start producing
output before the entire comparison is complete.

23 years agoAdd note about __getattribute__.
Guido van Rossum [Sat, 22 Sep 2001 17:10:44 +0000 (17:10 +0000)]
Add note about __getattribute__.

23 years agoAdd a function to compute a class's method resolution order. This is
Tim Peters [Sat, 22 Sep 2001 06:10:55 +0000 (06:10 +0000)]
Add a function to compute a class's method resolution order.  This is
easy for 2.2 new-style classes, but trickier for classic classes, and
different approaches are needed "depending".  The function will allow
later code to treat all flavors of classes uniformly.

23 years agoSince the most likely failure mode for an expected-output test is a change
Tim Peters [Sat, 22 Sep 2001 05:31:03 +0000 (05:31 +0000)]
Since the most likely failure mode for an expected-output test is a change
somewhere inside a line, use ndiff so that intraline difference marking
can point out what changed within a line.  I don't remember diff-style
abbreviations either (haven't used it since '94, except to produce
patches), so say the rest in English too.

23 years ago{String,cString}IO.StringIO's support iteration.
Barry Warsaw [Sat, 22 Sep 2001 04:44:21 +0000 (04:44 +0000)]
{String,cString}IO.StringIO's support iteration.

23 years agoI_getiter(): Function for the tp_iter slot of Itype so that
Barry Warsaw [Sat, 22 Sep 2001 04:36:49 +0000 (04:36 +0000)]
I_getiter(): Function for the tp_iter slot of Itype so that
cStringIO's can participate in the iterator protocol.

Fill the Itype.tp_iter slot with I_getiter()

23 years ago__iter__(): New method so that StringIO's can participate in the
Barry Warsaw [Sat, 22 Sep 2001 04:34:54 +0000 (04:34 +0000)]
__iter__(): New method so that StringIO's can participate in the
iterator protocol.

23 years agoNote that files are iterable; describe what the iterator returns.
Fred Drake [Sat, 22 Sep 2001 04:34:48 +0000 (04:34 +0000)]
Note that files are iterable; describe what the iterator returns.
This closes SF bug #463738.

23 years agoConverted test_StringIO.py to use unittest, so
Barry Warsaw [Sat, 22 Sep 2001 04:33:47 +0000 (04:33 +0000)]
Converted test_StringIO.py to use unittest, so
Lib/test/output/test_StringIO is no longer necessary.

Also, added a test of the iterator protocol that's just been added to
StringIO's and cStringIO's.

23 years agoStart of a test to make sure the profiler/tracer support in the core
Fred Drake [Sat, 22 Sep 2001 04:28:19 +0000 (04:28 +0000)]
Start of a test to make sure the profiler/tracer support in the core
interpreter is reporting what we expect to see.

23 years agoAdd the __getattr__ hook back. The rules are now:
Guido van Rossum [Fri, 21 Sep 2001 21:24:49 +0000 (21:24 +0000)]
Add the __getattr__ hook back.  The rules are now:
- if __getattribute__ exists, it is called first;
  if it doesn't exists, PyObject_GenericGetAttr is called first.
- if the above raises AttributeError, and __getattr__ exists,
  it is called.

23 years agoBump version number.
Fred Drake [Fri, 21 Sep 2001 21:18:16 +0000 (21:18 +0000)]
Bump version number.

23 years agoAdded reference to Tutorial section on user-defined exceptions for
Fred Drake [Fri, 21 Sep 2001 21:12:30 +0000 (21:12 +0000)]
Added reference to Tutorial section on user-defined exceptions for
information on defining new exceptions.
This closes SF bug #443559.

23 years agoExceptions in interactive examlpes did not always include the indication of
Fred Drake [Fri, 21 Sep 2001 21:10:05 +0000 (21:10 +0000)]
Exceptions in interactive examlpes did not always include the indication of
the source file using "in ?".

Added a description of the bare "raise" statement.

Added more description and examples for user-defined exceptions; this
is part of a response to SF bug #443559.

23 years agoreportdiff(): print a "plain diff" style diff.
Guido van Rossum [Fri, 21 Sep 2001 21:06:22 +0000 (21:06 +0000)]
reportdiff(): print a "plain diff" style diff.

XXX This should really be a unified diff, but I can't be bothered.

23 years agoOops. I didn't expect that some tests (test_cookie) have expected
Guido van Rossum [Fri, 21 Sep 2001 20:45:44 +0000 (20:45 +0000)]
Oops.  I didn't expect that some tests (test_cookie) have expected
output *and* doctest stuff.  Assuming the doctest stuff comes after the
expected output, this fixes that.

23 years agoChange the way unexpected output is reported: rather than stopping at
Guido van Rossum [Fri, 21 Sep 2001 20:31:52 +0000 (20:31 +0000)]
Change the way unexpected output is reported: rather than stopping at
the first difference, let the test run till completion, then gather
all the output and compare it to the expected output using difflib.

XXX Still to do: produce diff output that only shows the sections that
differ; currently it produces ndiff-style output because that's the
easiest to produce with difflib, but this becomes a liability when the
output is voluminous and there are only a few differences.

23 years agoChange the name of the __getattr__ special method for new-style
Guido van Rossum [Fri, 21 Sep 2001 19:29:08 +0000 (19:29 +0000)]
Change the name of the __getattr__ special method for new-style
classes to __getattribute__, to make it crystal-clear that it doesn't
have the same semantics as overriding __getattr__ on classic classes.

This is a halfway checkin -- I'll proceed to add a __getattr__ hook
that works the way it works in classic classes.

23 years agoMake these modules work when Python is compiled without Unicode support.
Guido van Rossum [Fri, 21 Sep 2001 19:22:34 +0000 (19:22 +0000)]
Make these modules work when Python is compiled without Unicode support.

23 years agoAdd tests for repr() of strings containing string quotes as well.
Guido van Rossum [Fri, 21 Sep 2001 15:46:41 +0000 (15:46 +0000)]
Add tests for repr() of strings containing string quotes as well.

23 years agoFix a bug in rendering of \\ by repr() -- it rendered as \\\ instead
Guido van Rossum [Fri, 21 Sep 2001 15:38:17 +0000 (15:38 +0000)]
Fix a bug in rendering of \\ by repr() -- it rendered as \\\ instead
of \\.

23 years agoTest basic functioning of unicode repr(). (If this breaks Jython,
Guido van Rossum [Fri, 21 Sep 2001 15:36:41 +0000 (15:36 +0000)]
Test basic functioning of unicode repr().  (If this breaks Jython,
please let me know and we'll figure out how to fix the test.)

23 years agoAdd a small test to verify that member and getset descriptors now have
Guido van Rossum [Thu, 20 Sep 2001 21:49:53 +0000 (21:49 +0000)]
Add a small test to verify that member and getset descriptors now have
docstrings (using file.closed and file.name as examples).