Commit Graph

20331 Commits

Author SHA1 Message Date
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
Tim Peters efc3a3af3b SF bug [#463093] File methods need doc strings.
Now they don't.
2001-09-20 07:55:22 +00:00
Barry Warsaw c88425e2b2 run_suite(): Oops, update a docstring. 2001-09-20 06:31:22 +00:00
Barry Warsaw c10d690744 run_suite(): Factor this out of run_unittest() for tests that build
their own test suite from a multitude of classes (like test_email.py
will be doing).

run_unittest(): Call run_suite() after making a suite from the
testclass.
2001-09-20 06:30:41 +00:00
Tim Peters 4bcfa317ee Since inspect.isfunction(obj) is a precondition for calling
inspect.getargspec(obj), test isfunction() directly in pydoc.py instead
of trying to indirectly deduce isfunction() in pydoc by virtue of
failing a combination of other tests.  This shouldn't have any visible
effect, except perhaps to squash a TypeError death if there was some path
thru this code that was inferring isfunction() by mistake.
2001-09-20 06:08:24 +00:00
Tim Peters f1d90b965e Ensure that isfunction(obj) and (the new) ismethoddescriptor(obj) never
both return true.  This restores pydoc's ability to deduce argument lists
for functions and methods coded in Python.
2001-09-20 05:47:55 +00:00
Guido van Rossum c9ed5dc81c News about compiler and pydoc. 2001-09-20 05:30:24 +00:00
Guido van Rossum ed8fa72f34 AFAICT pydoc/inspect do the right thing again. 2001-09-20 05:27:24 +00:00
Tim Peters 536d2262f7 After much thrashing, I believe this is a truly minimal patch to teach
pydoc how to do something sensible with 2.2 descriptors.  To see the
difference, browse __builtin__ via pydoc before and after the patch.
2001-09-20 05:13:38 +00:00
Tim Peters 3069d50c18 Install the compiler package under Lib. 2001-09-20 04:09:39 +00:00
Jeremy Hylton b3c569ce82 The compiler package is now part of the standard library.
Remove all these files.  All except astgen.py are moved to Lib/compiler.
2001-09-20 01:27:40 +00:00
Martin v. Löwis f6cc07cffe Patch #461321: Support None as a timeout in poll2 and poll3. 2001-09-19 17:31:47 +00:00
Martin v. Löwis 2777c021fc Patch #462849: Pass Unicode objects to file's .write method. 2001-09-19 13:47:32 +00:00
Guido van Rossum 5b5e0b9bf9 Keep tabnanny happy. 2001-09-19 13:28:25 +00:00
Marc-André Lemburg 816a1b75b7 Fixed search function error reporting in the encodings package
__init__.py module to raise errors which can be catched as LookupErrors
as well as SystemErrors.

Modified the error messages to include more information about the
failing module.
2001-09-19 11:52:07 +00:00
Marc-André Lemburg 494f2aea8e Docs and News item for the codecs.py additions. 2001-09-19 11:33:31 +00:00
Marc-André Lemburg aa32c5aa7c Added new helpers for easy access to codecs. Docs will follow. 2001-09-19 11:24:48 +00:00
Marc-André Lemburg 5e6007c5db Fix for bug #462737. 2001-09-19 11:21:03 +00:00
Martin v. Löwis 7090ed16d7 Include ctype.h after Python.h. 2001-09-19 10:37:50 +00:00