From 2a912f00b623ff0686fc727124379088f1f204ad Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 13 Mar 2009 23:24:36 +0100 Subject: [PATCH] support interdependencies between utility code fragments --- Cython/Compiler/Code.py | 3 +++ Cython/Utils.py | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Cython/Compiler/Code.py b/Cython/Compiler/Code.py index aad42442..aa77a037 100644 --- a/Cython/Compiler/Code.py +++ b/Cython/Compiler/Code.py @@ -419,6 +419,9 @@ class GlobalState(object): """ if name is None: name = id(utility_code) if self.check_utility_code_needed_and_register(name): + if utility_code.requires: + for dependency in utility_code.requires: + self.use_utility_code(dependency) if utility_code.proto: self.utilprotowriter.put(utility_code.proto) if utility_code.impl: diff --git a/Cython/Utils.py b/Cython/Utils.py index a54070b2..811ad4e9 100644 --- a/Cython/Utils.py +++ b/Cython/Utils.py @@ -92,11 +92,12 @@ def long_literal(value): # a simple class that simplifies the usage of utility code class UtilityCode(object): - def __init__(self, proto=None, impl=None, init=None, cleanup=None): + def __init__(self, proto=None, impl=None, init=None, cleanup=None, requires=None): self.proto = proto self.impl = impl self.init = init self.cleanup = cleanup + self.requires = requires def write_init_code(self, writer, pos): if not self.init: -- 2.26.2