Skip to content

Commit 7abeb9c

Browse files
fniephaustimfel
authored andcommitted
Don't print TruffleObjects on AttributeError
This avoids that internal implementation details leak when an `AttributeError` is raised on TruffleObjects.
1 parent e144f47 commit 7abeb9c

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/foreign/ForeignObjectBuiltins.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -649,7 +649,7 @@ protected Object doIt(Object object, Object key,
649649
}
650650
} catch (UnknownIdentifierException | UnsupportedMessageException ignore) {
651651
}
652-
throw raise(PythonErrorType.AttributeError, "foreign object %s has no attribute %s", object, key);
652+
throw raise(PythonErrorType.AttributeError, "foreign object has no attribute %s", key);
653653
}
654654
}
655655

@@ -662,7 +662,7 @@ protected PNone doIt(Object object, String key, Object value,
662662
try {
663663
lib.writeMember(object, key, value);
664664
} catch (UnknownIdentifierException | UnsupportedMessageException | UnsupportedTypeException e) {
665-
throw raise(PythonErrorType.AttributeError, "foreign object %s has no attribute %s", object, key);
665+
throw raise(PythonErrorType.AttributeError, "foreign object has no attribute %s", key);
666666
}
667667
return PNone.NONE;
668668
}
@@ -689,7 +689,7 @@ protected PNone doIt(Object object, String key,
689689
try {
690690
lib.removeMember(object, key);
691691
} catch (UnknownIdentifierException | UnsupportedMessageException e) {
692-
throw raise(PythonErrorType.AttributeError, "foreign object %s has no attribute %s", object, key);
692+
throw raise(PythonErrorType.AttributeError, "foreign object has no attribute %s", key);
693693
}
694694
return PNone.NONE;
695695
}

0 commit comments

Comments
 (0)