From 236527eba8adca191172b1c1c0f353eaa4aad6e2 Mon Sep 17 00:00:00 2001 From: Daniel Abrahamsson Date: Tue, 15 Aug 2023 15:58:15 +0200 Subject: [PATCH] Fix attribute lookup for __set__ only descriptors This makes the first half of the test in test_descr.set_and_no_get pass. The second part using metaclasses still fails. See #1722. --- Src/IronPython/Runtime/Binding/MetaUserObject.Members.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Src/IronPython/Runtime/Binding/MetaUserObject.Members.cs b/Src/IronPython/Runtime/Binding/MetaUserObject.Members.cs index d7a1a1f12..323826146 100644 --- a/Src/IronPython/Runtime/Binding/MetaUserObject.Members.cs +++ b/Src/IronPython/Runtime/Binding/MetaUserObject.Members.cs @@ -104,7 +104,7 @@ public TResult Bind(CodeContext context, string name) { foundSlot = FindSlot(context, name, sdo, out systemTypeResolution, out extensionMethodResolution); _extensionMethodRestriction = extensionMethodResolution; - if (sdo.PythonType.HasDictionary && (foundSlot == null || !foundSlot.IsSetDescriptor(context, sdo.PythonType))) { + if (sdo.PythonType.HasDictionary) { MakeDictionaryAccess(); } @@ -579,7 +579,6 @@ private Dictionary GetCachedGets() { protected override FastGetBase FinishRule() { GetMemberDelegates func; if (_slot is ReflectedSlotProperty rsp) { - Debug.Assert(!_dictAccess); // properties for __slots__ are get/set descriptors so we should never access the dictionary. func = new GetMemberDelegates(OptimizedGetKind.PropertySlot, Value.PythonType, _binder, _binder.Name, _version, _slot, _getattrSlot, rsp.Getter, FallbackError(), _context.ModuleContext.ExtensionMethods); } else if (_dictAccess) { if (_slot is PythonTypeUserDescriptorSlot) {