@@ -235,16 +235,16 @@ private boolean isAbstractMapping(PythonObjectLibrary thisLib) {
235
235
236
236
@ ExportMessage
237
237
public void writeMember (String key , Object value ,
238
- @ Exclusive @ Cached PInteropSubscriptAssignNode setItemNode ,
238
+ @ Shared ( "setItemNode" ) @ Cached PInteropSubscriptAssignNode setItemNode ,
239
239
@ CachedLibrary ("this" ) PythonObjectLibrary dataModelLibrary ,
240
240
@ Exclusive @ Cached KeyForAttributeAccess getAttributeKey ,
241
241
@ Exclusive @ Cached KeyForItemAccess getItemKey ,
242
- @ Cached PInteropSetAttributeNode writeNode ,
242
+ @ Cached PInteropSetAttributeNode setAttributeNode ,
243
243
@ Shared ("attributeErrorProfile" ) @ Cached IsBuiltinClassProfile attrErrorProfile ) throws UnsupportedMessageException , UnknownIdentifierException {
244
244
try {
245
245
String attrKey = getAttributeKey .execute (key );
246
246
if (attrKey != null ) {
247
- writeNode .execute (this , attrKey , value );
247
+ setAttributeNode .execute (this , attrKey , value );
248
248
return ;
249
249
}
250
250
@@ -256,14 +256,14 @@ public void writeMember(String key, Object value,
256
256
257
257
if (this instanceof PythonObject ) {
258
258
if (objectHasAttribute (this , key )) {
259
- writeNode .execute (this , key , value );
259
+ setAttributeNode .execute (this , key , value );
260
260
return ;
261
261
}
262
262
}
263
263
if (isAbstractMapping (dataModelLibrary )) {
264
264
setItemNode .execute (this , key , value );
265
265
} else {
266
- writeNode .execute (this , key , value );
266
+ setAttributeNode .execute (this , key , value );
267
267
}
268
268
} catch (PException e ) {
269
269
e .expectAttributeError (attrErrorProfile );
@@ -347,7 +347,7 @@ public Object readArrayElement(long key,
347
347
@ ExportMessage
348
348
public void writeArrayElement (long key , Object value ,
349
349
@ CachedLibrary ("this" ) PythonObjectLibrary dataModelLibrary ,
350
- @ Exclusive @ Cached PInteropSubscriptAssignNode setItemNode ) throws UnsupportedMessageException , InvalidArrayIndexException {
350
+ @ Shared ( "setItemNode" ) @ Cached PInteropSubscriptAssignNode setItemNode ) throws UnsupportedMessageException , InvalidArrayIndexException {
351
351
if (dataModelLibrary .isSequence (this )) {
352
352
try {
353
353
setItemNode .execute (this , key , value );
@@ -1867,13 +1867,14 @@ public abstract static class PInteropSubscriptAssignNode extends Node {
1867
1867
1868
1868
@ Specialization
1869
1869
static void doSpecialObject (PythonAbstractObject primary , Object key , Object value ,
1870
+ @ Cached PForeignToPTypeNode convert ,
1870
1871
@ Cached PInteropGetAttributeNode getAttributeNode ,
1871
1872
@ Cached CallBinaryMethodNode callSetItemNode ,
1872
1873
@ Cached ConditionProfile profile ) throws UnsupportedMessageException {
1873
1874
1874
1875
Object attrSetitem = getAttributeNode .execute (primary , __SETITEM__ );
1875
1876
if (profile .profile (attrSetitem != PNone .NO_VALUE )) {
1876
- callSetItemNode .executeObject (attrSetitem , key , value );
1877
+ callSetItemNode .executeObject (attrSetitem , key , convert . executeConvert ( value ) );
1877
1878
} else {
1878
1879
throw UnsupportedMessageException .create ();
1879
1880
}
@@ -1890,15 +1891,16 @@ public abstract static class PInteropSetAttributeNode extends Node {
1890
1891
public abstract void execute (Object primary , String attrName , Object value ) throws UnsupportedMessageException , UnknownIdentifierException ;
1891
1892
1892
1893
@ Specialization
1893
- public void doSpecialObject (PythonAbstractObject primary , String attrName , Object value ,
1894
+ public static void doSpecialObject (PythonAbstractObject primary , String attrName , Object value ,
1895
+ @ Cached PForeignToPTypeNode convert ,
1894
1896
@ Cached LookupInheritedAttributeNode .Dynamic lookupSetAttrNode ,
1895
1897
@ Cached CallTernaryMethodNode callSetAttrNode ,
1896
1898
@ Cached ConditionProfile profile ,
1897
1899
@ Cached IsBuiltinClassProfile attrErrorProfile ) throws UnsupportedMessageException , UnknownIdentifierException {
1898
- Object attrGetattribute = lookupSetAttrNode .execute (primary , SpecialMethodNames .__SETATTR__ );
1899
- if (profile .profile (attrGetattribute != PNone .NO_VALUE )) {
1900
+ Object attrSetattr = lookupSetAttrNode .execute (primary , SpecialMethodNames .__SETATTR__ );
1901
+ if (profile .profile (attrSetattr != PNone .NO_VALUE )) {
1900
1902
try {
1901
- callSetAttrNode .execute (null , attrGetattribute , primary , attrName , value );
1903
+ callSetAttrNode .execute (null , attrSetattr , primary , attrName , convert . executeConvert ( value ) );
1902
1904
} catch (PException e ) {
1903
1905
e .expectAttributeError (attrErrorProfile );
1904
1906
// TODO(fa) not accurate; distinguish between read-only and non-existing
@@ -2086,9 +2088,11 @@ public static int systemHashCode(Object value) {
2086
2088
}
2087
2089
2088
2090
@ ExportMessage
2089
- public TriState isIdenticalOrUndefined (Object other ,
2091
+ public TriState isIdenticalOrUndefined (Object otherInterop ,
2092
+ @ Cached PForeignToPTypeNode convert ,
2090
2093
@ CachedLibrary (limit = "3" ) InteropLibrary otherLib ,
2091
2094
@ CachedLibrary ("this" ) PythonObjectLibrary objectLib ) {
2095
+ Object other = convert .executeConvert (otherInterop );
2092
2096
if (this == other ) {
2093
2097
return TriState .TRUE ;
2094
2098
} else if (otherLib .hasIdentity (other )) {
0 commit comments