diff --git a/Cython/Compiler/Nodes.py b/Cython/Compiler/Nodes.py
index 107e988394820b41f119f7cad6977294b9796dc6..36c4961c2f0ab94ae933ac8676074d820e34f354 100644
--- a/Cython/Compiler/Nodes.py
+++ b/Cython/Compiler/Nodes.py
@@ -1302,6 +1302,7 @@ class CVarDefNode(StatNode):
                 if 'staticmethod' in env.directives:
                     type.is_static_method = True
                 if create_extern_wrapper:
+                    self.entry.type.create_to_py_utility_code(env)
                     self.entry.create_wrapper = True
             else:
                 if self.directive_locals:
diff --git a/Cython/Compiler/UtilityCode.py b/Cython/Compiler/UtilityCode.py
index 09f0e2cefcca9e43ac99ab8c6b0cc7785c0b19f7..59428d8f3ccf278e3e5f6c873df91df27f5915ee 100644
--- a/Cython/Compiler/UtilityCode.py
+++ b/Cython/Compiler/UtilityCode.py
@@ -87,6 +87,18 @@ class CythonUtilityCode(Code.UtilityCodeBase):
         self.outer_module_scope = outer_module_scope
         self.compiler_directives = compiler_directives
 
+    def __eq__(self, other):
+        if isinstance(other, CythonUtilityCode):
+            return self._equality_params() == other._equality_params()
+        else:
+           return False
+
+    def _equality_params(self):
+        return self.impl, self.outer_module_scope, self.compiler_directives
+
+    def __hash__(self):
+        return hash(self.impl)
+
     def get_tree(self, entries_only=False, cython_scope=None):
         from .AnalysedTreeTransforms import AutoTestDictTransform
         # The AutoTestDictTransform creates the statement "__test__ = {}",
diff --git a/tests/run/cfunc_convert.pyx b/tests/run/cfunc_convert.pyx
index 6e137f1446cc37265e20f4a3c93f5929c3f25878..3391cd226a38b19f58b6fc961a46b0651c7aeb61 100644
--- a/tests/run/cfunc_convert.pyx
+++ b/tests/run/cfunc_convert.pyx
@@ -8,13 +8,20 @@ from libc.math cimport sqrt
 cdef void empty_cfunc():
     print "here"
 
+# same signature
+cdef void another_empty_cfunc():
+    print "there"
+
 def call_empty_cfunc():
     """
     >>> call_empty_cfunc()
     here
+    there
     """
     cdef object py_func = empty_cfunc
     py_func()
+    cdef object another_py_func = another_empty_cfunc
+    another_py_func()
 
 
 cdef double square_c(double x):