In making it possible to have runnable code in pxds, I need to make a 
choice. The problem is that interned strings, objects etc. live in 
seperate scopes and you get double copies, basically now I get the 
following code twice in my c-file:

static char __pyx_k___getbuffer__[] = "__getbuffer__";
static PyObject *__pyx_kp___getbuffer__;

which gcc isn't too thrilled about.

1) Do drastic surgery on the scopes, so that interned strings, cached 
constants etc. from the pxd "module" scope is merged over to the pyx 
module scope, then relink the pxd function scopes to the pyx scopes instead.

2) Move these things from the scopes to code.global (a global context of 
the CCodeWriter). This fits nicely with utility_code going over as well. 
This means that for now each scope simply pipe their things into code 
where they are merged, while in time then e.g. StringNode could intern a 
string during code generation rather than bothering with it during 
analysis. (I think this is a viable way forward, but may take an hour or 
three longer for me to do.)

3) I suppose, linking the pxd to the pyx during analysis. But I see this 
as a step backward, we want pxds to be reusable between pyx-es (and they 
basically are today), so I'm very against this.

4) ?

Any preferences welcome. If I don't hear anything, odds are I'll start 
on 2), but that would be a waste if people felt strongly about interned 
strings etc. belonging at analysis.

-- 
Dag Sverre
_______________________________________________
Cython-dev mailing list
[email protected]
http://codespeak.net/mailman/listinfo/cython-dev

Reply via email to