From 4ed0f663ca4569a84062ce60ec73746efd49d910 Mon Sep 17 00:00:00 2001 From: Stefan Behnel <stefan_ml@behnel.de> Date: Sun, 3 Sep 2017 09:30:45 +0200 Subject: [PATCH] Need to delay annotation typing after the "as_cfunction()" conversion in AdjustDefByDirectives transform as we do not have an 'env' yet. --- Cython/Compiler/Nodes.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py index 69b914a61..a38bcb783 100644 --- a/Cython/Compiler/Nodes.py +++ b/Cython/Compiler/Nodes.py @@ -867,8 +867,8 @@ class CArgDeclNode(Node): base_type = base_type.base_type # inject type declaration from annotations - # FIXME: this is called without 'env' by AdjustDefByDirectives transform before declaration analysis - if self.annotation and (not env or env.directives['annotation_typing']) and self.base_type.name is None: + # this is called without 'env' by AdjustDefByDirectives transform before declaration analysis + if self.annotation and env and env.directives['annotation_typing'] and self.base_type.name is None: arg_type = self.inject_type_from_annotations(env) if arg_type is not None: base_type = arg_type -- 2.30.9