# HG changeset patch # User Paul Boddie # Date 1549126482 -3600 # Node ID 5c50586c2ece786beba78711dfc88b9a14ff916e # Parent c16c7d729f13e2aee3eeaed8e1165f2f866e9d82# Parent 2cbff01cc5866016ffc2bc9b889e0a13d987bde7 Merged changes from the default branch. diff -r c16c7d729f13 -r 5c50586c2ece deducer.py --- a/deducer.py Fri Feb 01 01:19:21 2019 +0100 +++ b/deducer.py Sat Feb 02 17:54:42 2019 +0100 @@ -2347,6 +2347,10 @@ remaining = attrnames.split(".") attrname = remaining[0] + # Special case for the ubiquitous __class__ attribute. + + ubiquitous = attrname == "__class__" + # Obtain reference, provider and provider kind information. attrs = self.reference_all_attrs[location] @@ -2375,8 +2379,8 @@ # Determine how attributes may be accessed relative to the accessor. - object_relative = class_accessor or module_accessor or provided_by_instance - class_relative = instance_accessor and provided_by_class + object_relative = ubiquitous or class_accessor or module_accessor or provided_by_instance + class_relative = not ubiquitous and instance_accessor and provided_by_class # Identify the last static attribute for context acquisition. @@ -2517,6 +2521,11 @@ first_method = "relative" + (object_relative and "-object" or "") + \ (class_relative and "-class" or "") + # Special case for the ubiquitous __class__ attribute. + + elif ubiquitous: + first_method = "relative-object" + # The fallback case is always run-time testing and access. else: diff -r c16c7d729f13 -r 5c50586c2ece templates/ops.c --- a/templates/ops.c Fri Feb 01 01:19:21 2019 +0100 +++ b/templates/ops.c Sat Feb 02 17:54:42 2019 +0100 @@ -401,11 +401,6 @@ return __test_specific_instance(obj, &__FUNCTION_TYPE); } -int __ISNULL(__attr value) -{ - return (value.value == 0); /* __NULL.value */ -} - /* Attribute codes and positions for type objects. */ unsigned int __TYPECODE(__ref obj) diff -r c16c7d729f13 -r 5c50586c2ece templates/ops.h --- a/templates/ops.h Fri Feb 01 01:19:21 2019 +0100 +++ b/templates/ops.h Sat Feb 02 17:54:42 2019 +0100 @@ -135,7 +135,8 @@ /* Type testing. */ __ref __ISFUNC(__ref obj); -int __ISNULL(__attr value); + +#define __ISNULL(__ATTR) (!__ATTR.value) /* Attribute codes and positions for type objects. */