Commit Graph

19899 Commits

Author SHA1 Message Date
Tim Peters 8ca177bd21 Install the new Lib/email pkg.
Create & populate the new Lib/test/data directory.
2001-09-23 07:02:29 +00:00
Tim Peters 2c9aa5ea8d Generalize file.writelines() to allow iterable objects. 2001-09-23 04:06:05 +00:00
Barry Warsaw d31db7e939 The test data (mostly example messages) for the email package test
suite.  Note that other tests can put input data in this directory.
2001-09-23 03:19:33 +00:00
Barry Warsaw 4107585a67 An extensive test suite for the email package. 2001-09-23 03:18:13 +00:00
Barry Warsaw ba92580f01 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).
2001-09-23 03:17:28 +00:00
Fred Drake d61d0d3f6d Added API information for the PyCallIter_*() and PySeqIter_*() functions.
Added signatures for some new PyType_*() functions.
2001-09-23 02:05:26 +00:00
Tim Peters 13b49d3374 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).
2001-09-23 02:00:29 +00:00
Tim Peters 42b6877293 Fix restore (difflib.restore() became a generator too). 2001-09-22 21:59:18 +00:00
Tim Peters 8a9c284437 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.
2001-09-22 21:30:22 +00:00
Guido van Rossum 380bad1b4e Add note about __getattribute__. 2001-09-22 17:10:44 +00:00
Tim Peters e0b2d7ac9a 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.
2001-09-22 06:10:55 +00:00
Tim Peters c377b16d12 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.
2001-09-22 05:31:03 +00:00
Barry Warsaw 58b072d53f {String,cString}IO.StringIO's support iteration. 2001-09-22 04:44:21 +00:00
Barry Warsaw 3e8be722d9 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()
2001-09-22 04:36:49 +00:00
Barry Warsaw bdefa0b3de __iter__(): New method so that StringIO's can participate in the
iterator protocol.
2001-09-22 04:34:54 +00:00
Fred Drake 038d26410d Note that files are iterable; describe what the iterator returns.
This closes SF bug #463738.
2001-09-22 04:34:48 +00:00
Barry Warsaw 7f8ff471f8 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.
2001-09-22 04:33:47 +00:00
Fred Drake 3208d4b387 Start of a test to make sure the profiler/tracer support in the core
interpreter is reporting what we expect to see.
2001-09-22 04:28:19 +00:00
Guido van Rossum 19c1cd5b35 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.
2001-09-21 21:24:49 +00:00
Fred Drake 56dd35bd44 Bump version number. 2001-09-21 21:18:16 +00:00
Fred Drake c69205526a Added reference to Tutorial section on user-defined exceptions for
information on defining new exceptions.
This closes SF bug #443559.
2001-09-21 21:12:30 +00:00
Fred Drake 13af42822c 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.
2001-09-21 21:10:05 +00:00
Guido van Rossum cf691935bb reportdiff(): print a "plain diff" style diff.
XXX This should really be a unified diff, but I can't be bothered.
2001-09-21 21:06:22 +00:00
Guido van Rossum 0a07639779 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.
2001-09-21 20:45:44 +00:00
Guido van Rossum 0fcca4e815 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.
2001-09-21 20:31:52 +00:00
Guido van Rossum 867a8d2e26 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.
2001-09-21 19:29:08 +00:00
Guido van Rossum dbb718fa87 Make these modules work when Python is compiled without Unicode support. 2001-09-21 19:22:34 +00:00
Guido van Rossum 11310bf867 Add tests for repr() of strings containing string quotes as well. 2001-09-21 15:46:41 +00:00
Guido van Rossum ad9744a67a Fix a bug in rendering of \\ by repr() -- it rendered as \\\ instead
of \\.
2001-09-21 15:38:17 +00:00
Guido van Rossum e4874aeab0 Test basic functioning of unicode repr(). (If this breaks Jython,
please let me know and we'll figure out how to fix the test.)
2001-09-21 15:36:41 +00:00
Guido van Rossum 8b9cc7e69e Add a small test to verify that member and getset descriptors now have
docstrings (using file.closed and file.name as examples).
2001-09-20 21:49:53 +00:00
Guido van Rossum 32d34c809f Add optional docstrings to getset descriptors. Fortunately, there's
no backwards compatibility to worry about, so I just pushed the
'closure' struct member to the back -- it's never used in the current
code base (I may eliminate it, but that's more work because the getter
and setter signatures would have to change.)

As examples, I added actual docstrings to the getset attributes of a
few types: file.closed, xxsubtype.spamdict.state.
2001-09-20 21:45:26 +00:00
Guido van Rossum a56b42b1ba Change testdescr.py to use the test_main() approach. 2001-09-20 21:39:07 +00:00
Fred Drake 2e2be3760c Change the PyUnit-based tests to use the test_main() approach. This
allows using the tests with unittest.py as a script.  The tests will
still run when run as a script themselves.
2001-09-20 21:33:42 +00:00
Guido van Rossum 6f7993765a Add optional docstrings to member descriptors. For backwards
compatibility, this required all places where an array of "struct
memberlist" structures was declared that is referenced from a type's
tp_members slot to change the type of the structure to PyMemberDef;
"struct memberlist" is now only used by old code that still calls
PyMember_Get/Set.  The code in PyObject_GenericGetAttr/SetAttr now
calls the new APIs PyMember_GetOne/SetOne, which take a PyMemberDef
argument.

As examples, I added actual docstrings to the attributes of a few
types: file, complex, instance method, super, and xxsubtype.spamlist.

Also converted the symtable to new style getattr.
2001-09-20 20:46:19 +00:00
Fred Drake e0af35eb69 Fill in a few more descriptions for xml.parsers.expat. 2001-09-20 20:43:28 +00:00
Tim Peters 2e29bfbe1a Document new file() constructor, with the body of open()'s text, plus a
"new in 2.2" blurb at the end.  Replace open()'s text by pointing back
to file().
2001-09-20 19:55:29 +00:00
Fred Drake f47d8ef683 Document all the Py*_CheckExact() functions.
Document many more of the PyLong_{As,From}*() functions.
2001-09-20 19:18:52 +00:00
Guido van Rossum 461591eb17 PyLocale_setlocale(): silence compiler warning about free() of a const
char *.
2001-09-20 19:18:30 +00:00
Marc-André Lemburg 3508e30861 Fix Unicode .join() method to raise a TypeError for sequence
elements which are not Unicode objects or strings. (This matches
the string.join() behaviour.)

Fix a memory leak in the .join() method which occurs in case
the Unicode resize fails.

Restore the test_unicode output.
2001-09-20 17:22:58 +00:00
Marc-André Lemburg 5e89bd656f Update test output after the unicode() change. 2001-09-20 16:37:23 +00:00
Jeremy Hylton fe148c80b7 Update description of Tools/compiler 2001-09-20 15:27:30 +00:00
Jeremy Hylton 5953b40442 Remove setup.py, unnecessary since compiler package is the std
library.

Update README.
2001-09-20 15:02:27 +00:00
Jeremy Hylton e54b5b4f81 Moved to Tools/compiler along with astgen.py 2001-09-20 14:59:00 +00:00
Guido van Rossum dd4d1c4f5d _PyObject_GetDictPtr(): when the offset is negative, always align --
we can't trust that tp_basicsize is aligned.  Fixes SF bug #462848.
2001-09-20 13:38:22 +00:00
Marc-André Lemburg aefd766eed Note about enhancements to unicode(). 2001-09-20 12:59:37 +00:00
Marc-André Lemburg 35b0cb09d7 Python part of the UTF-7 codec by Brian Quinlan. 2001-09-20 12:56:14 +00:00
Marc-André Lemburg 6871f6ac57 Implement the changes proposed in patch #413333. unicode(obj) now
works just like str(obj) in that it tries __str__/tp_str on the object
in case it finds that the object is not a string or buffer.
2001-09-20 12:53:16 +00:00
Marc-André Lemburg c60e6f7771 Patch #435971: UTF-7 codec by Brian Quinlan. 2001-09-20 10:35:46 +00:00
Marc-André Lemburg 26e3b681b2 Patch #462635 by Andrew Kuchling correcting bugs in the new
codecs -- the self argument does matter for Python functions (it
does not for C functions which most other codecs use).
2001-09-20 10:33:38 +00:00