|
80 | 80 | import com.oracle.graal.python.builtins.objects.cext.common.CExtContext;
|
81 | 81 | import com.oracle.graal.python.builtins.objects.cext.common.CExtContext.Store;
|
82 | 82 | import com.oracle.graal.python.builtins.objects.common.DynamicObjectStorage;
|
| 83 | +import com.oracle.graal.python.builtins.objects.common.HashingStorageNodes.HashingStorageGetItem; |
83 | 84 | import com.oracle.graal.python.builtins.objects.dict.DictBuiltins;
|
84 | 85 | import com.oracle.graal.python.builtins.objects.dict.PDict;
|
85 | 86 | import com.oracle.graal.python.builtins.objects.function.PBuiltinFunction;
|
@@ -292,12 +293,14 @@ abstract static class PyTruffleType_AddSlot extends CApi7BuiltinNode {
|
292 | 293 | @Specialization
|
293 | 294 | @TruffleBoundary
|
294 | 295 | static int addSlot(Object clazz, PDict tpDict, TruffleString memberName, Object cfunc, int flags, int wrapper, Object memberDoc) {
|
295 |
| - // create wrapper descriptor |
296 |
| - Object wrapperDescriptor = CreateFunctionNodeGen.getUncached().execute(memberName, cfunc, wrapper, clazz, flags, PythonObjectFactory.getUncached()); |
297 |
| - WriteAttributeToDynamicObjectNode.getUncached().execute(wrapperDescriptor, SpecialAttributeNames.T___DOC__, memberDoc); |
| 296 | + if (!HashingStorageGetItem.hasKeyUncached(tpDict.getDictStorage(), memberName)) { |
| 297 | + // create wrapper descriptor |
| 298 | + Object wrapperDescriptor = CreateFunctionNodeGen.getUncached().execute(memberName, cfunc, wrapper, clazz, flags, PythonObjectFactory.getUncached()); |
| 299 | + WriteAttributeToDynamicObjectNode.getUncached().execute(wrapperDescriptor, SpecialAttributeNames.T___DOC__, memberDoc); |
298 | 300 |
|
299 |
| - // add wrapper descriptor to tp_dict |
300 |
| - PyDictSetItem.executeUncached(tpDict, memberName, wrapperDescriptor); |
| 301 | + // add wrapper descriptor to tp_dict |
| 302 | + PyDictSetItem.executeUncached(tpDict, memberName, wrapperDescriptor); |
| 303 | + } |
301 | 304 | return 0;
|
302 | 305 | }
|
303 | 306 | }
|
|
0 commit comments