Skip to content

Commit e7fa111

Browse files
committed
AbstractMethodBuiltins fix __name__ builtin (raise AttributeError if __name__ not found on the methods function)
1 parent 1d5feee commit e7fa111

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/method/AbstractMethodBuiltins.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ Object getName(VirtualFrame frame, PBuiltinMethod method,
236236
@Cached.Shared("toJavaStringNode") @Cached CastToJavaStringNode toJavaStringNode,
237237
@Cached.Shared("pol") @CachedLibrary(limit = "getCallSiteInlineCacheMaxDepth()") PythonObjectLibrary pol) {
238238
try {
239-
return toJavaStringNode.execute(pol.lookupAttribute(method.getFunction(), frame, __NAME__));
239+
return toJavaStringNode.execute(pol.lookupAttributeStrict(method.getFunction(), frame, __NAME__));
240240
} catch (CannotCastException cce) {
241241
throw CompilerDirectives.shouldNotReachHere();
242242
}
@@ -247,7 +247,7 @@ Object getName(VirtualFrame frame, PMethod method,
247247
@Cached.Shared("toJavaStringNode") @Cached CastToJavaStringNode toJavaStringNode,
248248
@Cached.Shared("pol") @CachedLibrary(limit = "getCallSiteInlineCacheMaxDepth()") PythonObjectLibrary pol) {
249249
try {
250-
return toJavaStringNode.execute(pol.lookupAttribute(method.getFunction(), frame, __NAME__));
250+
return toJavaStringNode.execute(pol.lookupAttributeStrict(method.getFunction(), frame, __NAME__));
251251
} catch (CannotCastException cce) {
252252
throw CompilerDirectives.shouldNotReachHere();
253253
}

0 commit comments

Comments
 (0)