Skip to content

Commit 9efcb71

Browse files
committed
Fix compilation warning in PyCFunctionWrapper
1 parent e30564b commit 9efcb71

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/objects/cext/capi/PyCFunctionWrapper.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,10 @@ protected PyCFunctionWrapper(RootCallTarget callTarget, Signature signature) {
115115
assert signature != null;
116116
this.callTarget = callTarget;
117117
this.signature = signature;
118-
this.callTargetName = PythonUtils.toTruffleStringUncached(callTarget.getRootNode().getName());
118+
String ctName = callTarget.getRootNode().getName();
119+
this.callTargetName = PythonUtils.toTruffleStringUncached(ctName);
119120
this.builtinMethodDescriptor = null;
120-
this.timing = CApiTiming.create(false, this);
121+
this.timing = CApiTiming.create(false, ctName);
121122
this.skipSelf = false;
122123
}
123124

@@ -127,7 +128,7 @@ protected PyCFunctionWrapper(BuiltinMethodDescriptor builtinMethodDescriptor) {
127128
this.signature = null;
128129
this.callTargetName = null;
129130
this.builtinMethodDescriptor = builtinMethodDescriptor;
130-
this.timing = CApiTiming.create(false, this);
131+
this.timing = CApiTiming.create(false, builtinMethodDescriptor.getName());
131132
this.skipSelf = builtinMethodDescriptor.getEnclosingType() == null && !builtinMethodDescriptor.getBuiltinAnnotation().declaresExplicitSelf();
132133
}
133134

@@ -180,12 +181,16 @@ protected long asPointer() {
180181

181182
protected abstract String getFlagsRepr();
182183

184+
@TruffleBoundary
185+
private static String toString(Object name, String flagsRepr, long pointer) {
186+
String ptr = pointer != 0 ? " at 0x" + Long.toHexString(pointer) : "";
187+
return String.format("PyCFunction(%s, %s)%s", name, flagsRepr, ptr);
188+
}
189+
183190
@Override
184191
@TruffleBoundary
185192
public String toString() {
186-
Object name = builtinMethodDescriptor != null ? builtinMethodDescriptor.getName() : callTargetName;
187-
String ptr = pointer != 0 ? " at 0x" + Long.toHexString(pointer) : "";
188-
return String.format("PyCFunction(%s, %s)%s", name, getFlagsRepr(), ptr);
193+
return PyCFunctionWrapper.toString(builtinMethodDescriptor != null ? builtinMethodDescriptor.getName() : callTargetName, getFlagsRepr(), pointer);
189194
}
190195

191196
/**

0 commit comments

Comments
 (0)