[IronPython] str, repr and getattr
Sanghyeon Seo
sanxiyn at gmail.com
Thu Jun 8 08:25:32 CEST 2006
2006/6/8, Dino Viehland <dinov at exchange.microsoft.com>:
Thanks for the report. We'll fix this for the next release. The fix
is actually pretty simple (wrap the Ops.Call & return true in in
OldClass.cs in OldInstance.TryGetAttr w/ a try/catch
MissingMemberException, right after the 2nd TryRawGetAttr) if you want
to work around it until then.
In case that others have similar issue, here's a patch you can apply.
Seo Sanghyeon
-------------- next part --------------
--- IronPython/Runtime/OldClass.cs.orig 2006-06-08 15:22:40.000000000 +0900
+++ IronPython/Runtime/OldClass.cs 2006-06-08 15:21:22.000000000 +0900
@@ -482,7 +482,11 @@
if (name.Id != SymbolTable.GetAttrId) {
object getattr;
if (TryRawGetAttr(SymbolTable.GetAttr, out getattr)) {
- value = Ops.Call(getattr, SymbolTable.IdToString(name));
+ try {
+ value = Ops.Call(getattr, SymbolTable.IdToString(name));
+ } catch (MissingMemberException) {
+ return false;
+ }
return true;
}
}
More information about the Ironpython-users
mailing list