[Patches] [Patch #101839] better error messages

noreply@sourceforge.net noreply@sourceforge.net
Sun, 8 Oct 2000 20:20:20 -0700


Patch #101839 has been updated. 

Project: 
Category: core (C code)
Status: Open
Summary: better error messages

Follow-Ups:

Date: 2000-Oct-08 20:20
By: ping

Comment:
This patch tries to make the feedback from error
messages more consistent and helpful.

For example:

>>> os.kf
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: 'os' module has no attribute 'kf'
>>> int(a=3)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: int() takes no keyword arguments
>>> class Foo: pass
... 
>>> Foo.spam
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: class Foo has no attribute 'spam'
>>> Foo().spam
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: Foo instance has no attribute 'spam'
>>> Foo()()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: Foo instance has no __call__ method

This isn't really a bug, but it's not a feature either.
I wanted to get it in before the Monday freeze.
If you have time, have a look; i'll leave it to your
judgement whether it's okay to check in.  I know
it's close to the wire, but it's effectively small:
there are no changes in logic, only strings edited
here and there.

The corresponding changes to the tests that
relied on specific wording of error messages
are also included.

-------------------------------------------------------

-------------------------------------------------------
For more info, visit:

http://sourceforge.net/patch/?func=detailpatch&patch_id=101839&group_id=5470