Return assigned values in list.__setitem__/dict.__setitem__

This commit is contained in:
K. Lange 2021-12-14 17:46:31 +09:00
parent c8b1df7056
commit 8fb1689e1d
2 changed files with 2 additions and 0 deletions

View File

@ -59,6 +59,7 @@ KRK_METHOD(dict,__getitem__,{
KRK_METHOD(dict,__setitem__,{ KRK_METHOD(dict,__setitem__,{
METHOD_TAKES_EXACTLY(2); METHOD_TAKES_EXACTLY(2);
krk_tableSet(&self->entries, argv[1], argv[2]); krk_tableSet(&self->entries, argv[1], argv[2]);
return argv[2];
}) })
KRK_METHOD(dict,__or__,{ KRK_METHOD(dict,__or__,{

View File

@ -64,6 +64,7 @@ KRK_METHOD(list,__setitem__,{
LIST_WRAP_INDEX(); LIST_WRAP_INDEX();
self->values.values[index] = argv[2]; self->values.values[index] = argv[2];
if (vm.globalFlags & KRK_GLOBAL_THREADS) pthread_rwlock_unlock(&self->rwlock); if (vm.globalFlags & KRK_GLOBAL_THREADS) pthread_rwlock_unlock(&self->rwlock);
return argv[2];
}) })
KRK_METHOD(list,__eq__,{ KRK_METHOD(list,__eq__,{