# HG changeset patch # User Paul Boddie # Date 1549126521 -3600 # Node ID 93b66cd7898506c23582c684d455a431155e269a # Parent b76b924d350a7fd3f3aed19ba9a48aac3caf7bc2# Parent 5c50586c2ece786beba78711dfc88b9a14ff916e Merged changes from trailing-data. diff -r b76b924d350a -r 93b66cd78985 deducer.py --- a/deducer.py Fri Feb 01 01:30:23 2019 +0100 +++ b/deducer.py Sat Feb 02 17:55:21 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 b76b924d350a -r 93b66cd78985 templates/ops.c --- a/templates/ops.c Fri Feb 01 01:30:23 2019 +0100 +++ b/templates/ops.c Sat Feb 02 17:55:21 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 b76b924d350a -r 93b66cd78985 templates/ops.h --- a/templates/ops.h Fri Feb 01 01:30:23 2019 +0100 +++ b/templates/ops.h Sat Feb 02 17:55:21 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. */