This patch backport pyrex support for 'ctypedef public api' declarations. You also have a testcase (should go to 'tests/compile', or perhaps should merged in some other testcase).
-- Lisandro Dalcín --------------- Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC) Instituto de Desarrollo Tecnológico para la Industria Química (INTEC) Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET) PTLC - Güemes 3450, (3000) Santa Fe, Argentina Tel/Fax: +54-(0)342-451.1594
diff -r b099e37aa7d2 Cython/Compiler/Parsing.py
--- a/Cython/Compiler/Parsing.py Mon Oct 06 21:12:23 2008 +0200
+++ b/Cython/Compiler/Parsing.py Mon Oct 06 18:53:55 2008 -0300
@@ -1407,8 +1407,8 @@ def p_statement(s, ctx, first_statement
if s.sy == 'ctypedef':
if ctx.level not in ('module', 'module_pxd'):
s.error("ctypedef statement not allowed here")
- if ctx.api:
- error(s.position(), "'api' not allowed with 'ctypedef'")
+ #if ctx.api:
+ # error(s.position(), "'api' not allowed with 'ctypedef'")
return p_ctypedef_statement(s, ctx)
elif s.sy == 'DEF':
return p_DEF_statement(s)
@@ -2167,7 +2167,10 @@ def p_ctypedef_statement(s, ctx):
pos = s.position()
s.next()
visibility = p_visibility(s, ctx.visibility)
+ api = p_api(s)
ctx = ctx(typedef_flag = 1, visibility = visibility)
+ if api:
+ ctx.api = 1
if s.sy == 'class':
return p_c_class_definition(s, pos, ctx)
elif s.sy == 'IDENT' and s.systring in ('struct', 'union', 'enum'):
ctypedefpubapi.pyx
Description: Binary data
_______________________________________________ Cython-dev mailing list [email protected] http://codespeak.net/mailman/listinfo/cython-dev
