[IronPython] Inconsistency in getattr exceptions

Dino Viehland dinov at exchange.microsoft.com
Thu Jun 22 17:43:07 CEST 2006

Thanks for the bug report.  I've filed this as CodePlex bug 562.  This one sounds like it'll be trivial to fix so we should have it for the next release.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Thursday, June 22, 2006 4:41 AM
To: Discussion of IronPython
Subject: [IronPython] Inconsistency in getattr exceptions

Hello all,

getattr in IronPython raises different exceptions to CPython for invalid input.


 >>> getattr(a, None)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: getattr(): attribute name must be string  >>>


 >>> a = object()
 >>> getattr(a, None)
Traceback (most recent call last):
  File , line 0, in <stdin>##64
  File , line 0, in GetAttr##65
AttributeError: 'object' object has no attribute ''

Note also that exceptions in IronPython involving a None often print the empty string, which can be unhelpful. (Which is odd since both
repr(None) and str(None) return 'None'.)

All the best,

Michael Foord
users mailing list
users at lists.ironpython.com

More information about the Ironpython-users mailing list