# HG changeset patch # User Paul Boddie # Date 1489169603 -3600 # Node ID 734bddc017dbd357458ce2b9cfc4ccd46e9359d8 # Parent 6b790fb0924e93dc7d46161e83a066075deb8a38 Prevent __data__ accesses via anonymous accessors from trying to find the attribute on classes since __data__ is always provided by the immediate object and because the check_and_load_via_any operation uses a null value internally to detect failure that can be confused with a genuine __data__ attribute with a zero value (such as the integer zero). diff -r 6b790fb0924e -r 734bddc017db deducer.py --- a/deducer.py Fri Mar 10 17:57:07 2017 +0100 +++ b/deducer.py Fri Mar 10 19:13:23 2017 +0100 @@ -2474,10 +2474,15 @@ if remaining > 1 or final_method in ("access", "access-invoke", "assign"): + # Constrain instructions involving certain special + # attribute names. + + to_search = attrname == "__data__" and "object" or "any" + if assigning: - emit(("__check_and_store_via_any", accessor, attrname, "")) + emit(("__check_and_store_via_%s" % to_search, accessor, attrname, "")) else: - accessor = ("__check_and_load_via_any", accessor, attrname) + accessor = ("__check_and_load_via_%s" % to_search, accessor, attrname) remaining -= 1