diff options
Diffstat (limited to 'Cython')
-rw-r--r-- | Cython/Compiler/ModuleNode.py | 4 | ||||
-rw-r--r-- | Cython/Compiler/Options.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/Cython/Compiler/ModuleNode.py b/Cython/Compiler/ModuleNode.py index cba8effef..79a42827b 100644 --- a/Cython/Compiler/ModuleNode.py +++ b/Cython/Compiler/ModuleNode.py @@ -1466,7 +1466,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): if scope.defines_any_special(TypeSlots.richcmp_special_methods): self.generate_richcmp_function(scope, code) - elif scope.directives.get('total_ordering'): + elif 'total_ordering' in scope.directives: # Warn if this is used when it can't have any effect. warning(scope.parent_type.pos, "total_ordering directive used, but no comparison and equality methods defined") @@ -2144,7 +2144,7 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): # need to call up into base classes as we may not know all implemented comparison methods extern_parent = cls if cls.typeptr_cname else scope.parent_type.base_type - total_ordering = scope.directives.get('total_ordering', False) + total_ordering = 'total_ordering' in scope.directives comp_entry = {} diff --git a/Cython/Compiler/Options.py b/Cython/Compiler/Options.py index 13d07b495..cd1bb0431 100644 --- a/Cython/Compiler/Options.py +++ b/Cython/Compiler/Options.py @@ -341,7 +341,7 @@ directive_types = { 'c_string_type': one_of('bytes', 'bytearray', 'str', 'unicode'), 'c_string_encoding': normalise_encoding_name, 'trashcan': bool, - 'total_ordering': bool, + 'total_ordering': None, 'dataclasses.dataclass': DEFER_ANALYSIS_OF_ARGUMENTS, 'dataclasses.field': DEFER_ANALYSIS_OF_ARGUMENTS, } @@ -405,7 +405,7 @@ immediate_decorator_directives = { 'inline', 'exceptval', 'returns', # class directives 'freelist', 'no_gc', 'no_gc_clear', 'type_version_tag', 'final', - 'auto_pickle', 'internal', 'collection_type', + 'auto_pickle', 'internal', 'collection_type', 'total_ordering', # testing directives 'test_fail_if_path_exists', 'test_assert_path_exists', } |