diff options
author | da-woods <dw-git@d-woods.co.uk> | 2019-10-26 10:45:48 +0100 |
---|---|---|
committer | da-woods <dw-git@d-woods.co.uk> | 2019-10-26 10:45:48 +0100 |
commit | 879774e59897b2062d5eb0ac1ca92d5e3a3e73ee (patch) | |
tree | a81e709d0d7f09dfb9b5f831431d55151174e188 | |
parent | 073f25c155d0266c97cc88a1d713924ea4e48973 (diff) | |
download | cython-879774e59897b2062d5eb0ac1ca92d5e3a3e73ee.tar.gz |
Removed try-catch
-rw-r--r-- | Cython/Compiler/ExprNodes.py | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/Cython/Compiler/ExprNodes.py b/Cython/Compiler/ExprNodes.py index 22eabb5ab..ef51b32e3 100644 --- a/Cython/Compiler/ExprNodes.py +++ b/Cython/Compiler/ExprNodes.py @@ -1962,11 +1962,10 @@ class NameNode(AtomicExprNode): entry = env.lookup(self.name) if entry and entry.is_type: if entry.type.is_fused and env.fused_to_specific: - try: + if entry.type in env.fused_to_specific: return entry.type.specialize(env.fused_to_specific) - except KeyError: - pass # lots of valid reasons why we may not be able to get a specific type - # so don't fail + # else lots of valid reasons why we may not be able to get a specific type + # so don't fail return entry.type else: return None @@ -6916,10 +6915,9 @@ class AttributeNode(ExprNode): if base_type and hasattr(base_type, 'scope') and base_type.scope is not None: tp = base_type.scope.lookup_type(self.attribute) if tp and tp.is_fused and env.fused_to_specific: - try: + if tp in env.fused_to_specific: tp = tp.specialize(env.fused_to_specific) - except KeyError: - pass # just use unspecialized type + # else just use unspecialized type return tp def analyse_as_extension_type(self, env): |