Hi, cython-dev
I think I found a regression in Cython 0.11. Basically, I was
attempting to follow
<http://codespeak.net/pipermail/cython-dev/2008-May/000962.html>
to export values from a public enum to python. However, after building
the following .pyx with Cython 0.11.2:
cdef public enum FOO:
BAR = 3
I found that BAR isn't exported from the resulting extension module.
According to that thread, this worked back in 0.9.6.14.
I've attached my attempt at a patch, as well as an extra test case
that reproduces the problem. (I admit I'm not exactly an expert on
what ParseTreeTransforms.py is doing :o).
--Grant
# HG changeset patch
# User Grant Baillie <[email protected]>
# Date 1251424633 25200
# Node ID 7ddb730e081dc2db0415340fe29f7e924278ef3b
# Parent 63b2853c7595bddc553b523d29e4c3378920eedc
Attempt to fix public enum values not being exported.
diff -r 63b2853c7595 -r 7ddb730e081d Cython/Compiler/ParseTreeTransforms.py
--- a/Cython/Compiler/ParseTreeTransforms.py Wed Jul 29 22:10:31 2009 +0200
+++ b/Cython/Compiler/ParseTreeTransforms.py Thu Aug 27 18:57:13 2009 -0700
@@ -677,7 +677,10 @@
return None
def visit_CEnumDefNode(self, node):
- return None
+ if node.visibility == 'public':
+ return node
+ else:
+ return None
def visit_CStructOrUnionDefNode(self, node):
return None
diff -r 63b2853c7595 -r 7ddb730e081d tests/run/public_enum.pyx
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/run/public_enum.pyx Thu Aug 27 18:57:13 2009 -0700
@@ -0,0 +1,7 @@
+__doc__ = u"""
+>>> BAR
+3
+"""
+
+cdef public enum FOO:
+ BAR = 3
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev