Skip to content

Commit

Permalink
Fix attribute lookup for __set__ only descriptors
Browse files Browse the repository at this point in the history
This makes the first half of the test in test_descr.set_and_no_get pass.
The second part using metaclasses still fails.

See IronLanguages#1722.
  • Loading branch information
danabr committed Aug 16, 2023
1 parent a1f06f9 commit 236527e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions Src/IronPython/Runtime/Binding/MetaUserObject.Members.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -579,7 +579,6 @@ private Dictionary<CachedGetKey, FastGetBase> 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) {
Expand Down

0 comments on commit 236527e

Please sign in to comment.