<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel">
    <title>gmane.comp.python.cython.devel</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3779"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3778"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3777"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3776"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3775"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3774"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3773"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3772"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3771"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3770"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3769"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3768"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3767"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3766"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3765"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3764"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3763"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3762"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3761"/>
        <rdf:li rdf:resource="http://permalink.gmane.org/gmane.comp.python.cython.devel/3760"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3779">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3779</link>
    <description>The best way of getting the context would be searching for disposal_code in the source until you find such  a case.

My situation is that I don't know how that code got there or who wrote it, I just have to adapt to it when moving the temps to code generation, preferably while making as few other changes at the same time as possible.

I can guess though .. take BoolBinopNode as an example.

def f(): return []
def g(n):
    if n == 0: return 5
    else: return f() or g(n-1)
print g(100000000)

Since the "or" can decref the result of f() inside the if-branch evaluating g(..), memory usage for the code in Cython  is O(1) rather than O(n). (Not saying that it is not O(1) in Pyrex, I wouldn't know).

I'm not 100 percent sure about this but it is what I figure.

Dag Sverre Seljebotn
-----Original Message-----
From: Greg Ewing &lt;greg.ewing-F+z8Qja7x9Xokq/tPzqvJg&lt; at &gt;public.gmane.org&gt;
Date: Tuesday, Dec 2, 2008 12:03 am
Subject: Re: [Cython] Temp allocation flow
To: cython-dev-F/1GfIIGwJsClooVUwDQFiifJy3iqPdu&lt; at &gt;public.gman</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T23:49:00</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3778">
    <title>Re: [Cython] Recursive structure, typedef</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3778</link>
    <description>

Not sure about Cython, but the following works in Pyrex:

   cdef struct foo

   ctypedef foo foo_t

   cdef struct foo:
     foo_t *f

i.e. although you can't forward-declare and typedef
in one go, you can forward declare the struct and
then typedef it.


</description>
    <dc:creator>Greg Ewing</dc:creator>
    <dc:date>2008-12-01T23:27:52</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3777">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3777</link>
    <description>

Maybe you could provide a bit more context still? I'm just
wondering why you can't generate the disposal code after
the whole if-statement, rather than duplicating it in each
branch.

</description>
    <dc:creator>Greg Ewing</dc:creator>
    <dc:date>2008-12-01T23:06:14</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3776">
    <title>Re: [Cython] Refcount safe-mode?</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3776</link>
    <description>
Right. It's something to enable while running runtests.py, in order to 
get more proper regression tests on refcounting than a segfault. (Also 
leaks are currently not regression tested as far as I know.)

It wouldn't help for leaks in end-user code, it would help ensure that 
Cython itself doesn't introduce leaks.


The former would construct a new object which is stored in a global 
stack (basically a dict of pointers-casted-to-integer to a "refcount 
that the curren function holds"), and which __Pyx_???REF would record 
information in. (Hmm. Perhaps it would be better to conditinally define 
a local variable with a fixed name. But these are details unecesarry to 
discuss at this point.)

The latter would count up everything and make sure that there was 
exactly zero references (that the function knows that it holds) to 
everything but the parameter, __pyx_r, which should have exactly one 
reference (which the function holds).

Schemes using the Python ob_refcnt could work as well, but in general I 
thoug</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T18:30:26</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3775">
    <title>Re: [Cython] Refcount safe-mode?</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3775</link>
    <description>


This is to ease development, not for end-users, right? I think this  
could be a good idea, though it's unclear exactly what  
"__Pyx_PushRefCountFrame" and "__Pyx_PopRefcountFrame" would do. And  
would __Pyx_DECREF be more useful than running under gdb?

- Robert

</description>
    <dc:creator>Robert Bradshaw</dc:creator>
    <dc:date>2008-12-01T18:06:37</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3774">
    <title>Re: [Cython] Disabled FlattenInListTransform</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3774</link>
    <description>

Sure. Your new temps framework, once it all gets shaken out, makes  
more sense for something like this anyways.

- Robert
</description>
    <dc:creator>Robert Bradshaw</dc:creator>
    <dc:date>2008-12-01T18:01:41</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3773">
    <title>Re: [Cython] Python aborts when running Cython on petsc4py sources</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3773</link>
    <description>
I would also consider that revision safe. But I agree that for releasing
software, the latest official Cython release is the safest bet.

Stefan

</description>
    <dc:creator>Stefan Behnel</dc:creator>
    <dc:date>2008-12-01T13:32:45</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3772">
    <title>Re: [Cython] Python aborts when running Cython on petsc4py sources</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3772</link>
    <description>
Opps, I was looking at the description for "Child". So this was wrong, 
but my point still stands :-)

</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T13:30:52</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3771">
    <title>Re: [Cython] Python aborts when running Cython on petsc4py sources</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3771</link>
    <description>
Yes, and that is the very commit that broke a lot of things :-) It just 
doesn't show up because the testsuite is not complete, and it only 
strikes in special circumstances.

Anything including the new dict for-loop optimizations is NOT SAFE. 
Please, use the latest stable.

It's great that you /develop/ using -devel so that bugs are found, but 
when it comes to doing a release of your software, I strongly advice to 
always go back to the latest release.

</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T13:29:22</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3770">
    <title>Re: [Cython] Python aborts when running Cython on petsc4py sources</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3770</link>
    <description>On Mon, Dec 1, 2008 at 11:03 AM, Dag Sverre Seljebotn
&lt;dagss-oe7qfRrRQff7lrOFANSjUYjpYkJvURAb&lt; at &gt;public.gmane.org&gt; wrote:

OK


No, no. This is happening with cython-devel.

BTW, I switched to the revision above (a few commits away for latest
release), and all seems to work.

Revision: 1393
Branch: default
Author: Stefan Behnel &lt;scoder-96fYSP9JRkAATYTw5x5z8w&lt; at &gt;public.gmane.org&gt;  2008-11-26 18:00:35
Committer: Stefan Behnel &lt;scoder-96fYSP9JRkAATYTw5x5z8w&lt; at &gt;public.gmane.org&gt;  2008-11-26 18:00:35
Parent: 1392:a53116f21261 (fixed typo)
Child:  1394:71d8a06957eb (make TupleNode and ListNode a NewTempExprNode)

    let types inherit from object to work around hashing problems





</description>
    <dc:creator>Lisandro Dalcin</dc:creator>
    <dc:date>2008-12-01T13:04:22</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3769">
    <title>Re: [Cython] Python aborts when running Cython on petsc4py sources</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3769</link>
    <description>

If you're in the process of releasing software, use the latest stable. 
-devel has had bugs for at least a week because of temps stuff, but the 
latest release should be safe.

Or is this happening in the latest release?

</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T13:03:25</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3768">
    <title>Re: [Cython] Recursive structure, typedef</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3768</link>
    <description>
Yes, I use 0.10.2. I upgraded because indeed, before, the following
did not work:

cdef struct foo:
    foo *foo
ctypdef foo foo_t

It works on 0.10.2. But my problem is slightly different:

cdef struct foo:
    foo_t *foo
ctypdef foo foo_t

Notice how the recursive is referenced through a typedef. In C, this
is solved by forward declaring the struct through a typedef before the
struct declaration. But AFAIK, you can't do that in cython.

My question may be stupid: I know nothing about parsing languages, and
maybe this is just a problem in my own code generator which is
"hand-built" from the AST given by gccxml.

cheers,

David
</description>
    <dc:creator>David Cournapeau</dc:creator>
    <dc:date>2008-12-01T12:40:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3767">
    <title>Re: [Cython] Recursive structure, typedef</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3767</link>
    <description>Hi, David. Did you tried latest release,
http://cython.org/Cython-0.10.2.tar.gz ? It contains fixes for
recursive typedef struct. Please, give a try a let us know of any
problem.


On Mon, Dec 1, 2008 at 4:27 AM, David Cournapeau &lt;cournape-Re5JQEeQqe8AvxtiuMwx3w&lt; at &gt;public.gmane.org&gt; wrote:



</description>
    <dc:creator>Lisandro Dalcin</dc:creator>
    <dc:date>2008-12-01T12:31:40</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3766">
    <title>[Cython] Python aborts when running Cython on petsc4py sources</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3766</link>
    <description>I've got this when running Cython to generate petsc4py sources.

cython --cleanup 9 -I. -Iinclude -w src petsc4py.PETSc.pyx -o petsc4py_PETSc.c
python: Modules/gcmodule.c:276: visit_decref: Assertion
`gc-&gt;gc.gc_refs != 0' failed.


I've tried to manually remove the Cython extension modules

$ rm `find ~/lib/python/Cython -name '*.so'`

but then (I reported this some time ago), things fails (because of
pure-python mode)

cython --cleanup 9 -I. -Iinclude -w src petsc4py.PETSc.pyx -o petsc4py_PETSc.c
Traceback (most recent call last):
  File "/u/dalcinl/bin/cython", line 7, in &lt;module&gt;
    from Cython.Compiler.Main import main
  File "/u/dalcinl/lib/python/Cython/Compiler/Main.py", line 17, in &lt;module&gt;
    import Code
  File "/u/dalcinl/lib/python/Cython/Compiler/Code.py", line 11, in &lt;module&gt;
    from Scanning import SourceDescriptor
  File "/u/dalcinl/lib/python/Cython/Compiler/Scanning.py", line 14, in &lt;module&gt;
    import cython
ImportError: No module named cython


I have no time to dive onto this. I'm in t</description>
    <dc:creator>Lisandro Dalcin</dc:creator>
    <dc:date>2008-12-01T12:20:35</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3765">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3765</link>
    <description>I don't know Pyrex that well, and weren't around at the time of the fork. I assume it is Cython-only then.

We could probably change these cases. Then again they were probably added in the first place as features/optimizations.

Anyway, now the necessary changes to support it is up in -devel.

Dag Sverre Seljebotn
-----Original Message-----
From: Greg Ewing &lt;greg.ewing-F+z8Qja7x9Xokq/tPzqvJg&lt; at &gt;public.gmane.org&gt;
Date: Monday, Dec 1, 2008 11:16 am
Subject: Re: [Cython] Temp allocation flow
To: cython-dev-F/1GfIIGwJsClooVUwDQFiifJy3iqPdu&lt; at &gt;public.gmane.org: cython-dev-F/1GfIIGwJtbRRN4PJnoQQ&lt; at &gt;public.gmane.org

Dag Sverre Seljebotn wrote:

</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T11:49:00</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3764">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3764</link>
    <description>

Are there any examples of this in Pyrex, or is this
from Cython?

</description>
    <dc:creator>Greg Ewing</dc:creator>
    <dc:date>2008-12-01T10:19:05</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3763">
    <title>[Cython] Recursive structure, typedef</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3763</link>
    <description>Hi,

I am using cython to wrap some fairly large C API, with a big numbers
of enumerations. Those API are big enough so that I got tired of
manually declaring the definitions (in particular enum), and start
working on a code generator based on gccxml. It almost works for some
non trivial headers (CoreAudio framework, Alsa headers), but I have a
problem with the following kind of C declaration:

typedef struct foo foo_t;

struct foo {
    foo_t *foo;
}

AFAIK, cython does support typedefing a struct directly, and you
should use something like that instead:

cdef struct foo:
    foo_t *foo
ctypdef foo foo_t

Which does not work as the recursive reference uses the typedef'd type
name. The following works, though:

cdef struct foo:
    foo *foo
ctypdef foo foo_t

For now, I can get away by modifying on the fly the gccxml parsed tree
when I detect a recursive reference, but this feels hackish. Is there
a better way ?

David
</description>
    <dc:creator>David Cournapeau</dc:creator>
    <dc:date>2008-12-01T06:27:42</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3762">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3762</link>
    <description>&lt;snip&gt;

Actually, this is not true. Pushing if-tests like the above to tree 
nodes would amount simply to moving the generate_disposal_code to the 
end of the C if-test.

</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T01:12:02</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3761">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3761</link>
    <description>
I didn't supply enough context. It was meant for situations like this:

self.arg.generate_evaluate_code(code)
...
code.putln("if (...) {")
...
self.arg.generate_disposal_code(code)
...
code.putln("} else {")
...
self.arg.generate_disposal_code(code)
...
code.putln("}")

Here, one can't free the temp in the first generate_disposal_code 
(because then the else-block could reuse and overwrite the temp etc.). 
As mentioned this is now solved by considering temp freeing as a 
seperate but parallell step to disposal. To make the example up-to-date, 
simply add at the end, but NOT inside the C if-blocks,

self.arg.free_temps(code)

I even found one example of the opposite construction, where 
evaluation_code was called multiple times but disposal once! (In 
TupleNode.generate_assignment_code). Luckily I was able to shuffle it a 
bit to avoid the problem.

There might be more of this stuff in Cython than in Pyrex?

This all points to a fundamental problem with the current scheme: Temp 
allocation doesn't branch whe</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-12-01T01:09:03</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3760">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3760</link>
    <description>
Rather than a free_temp parameter, I'd be more inclined
to have an owns_temp flag on the node, set according to
whether the node allocated the temp itself or it was
supplied by the parent (currently done via an optional
parameter to allocate_temps(), which would become a
parameter to generate_evaluation_code()).

</description>
    <dc:creator>Greg Ewing</dc:creator>
    <dc:date>2008-11-30T23:08:26</dc:date>
  </item>
  <item rdf:about="http://permalink.gmane.org/gmane.comp.python.cython.devel/3759">
    <title>Re: [Cython] Temp allocation flow</title>
    <link>http://permalink.gmane.org/gmane.comp.python.cython.devel/3759</link>
    <description>
I suddenly realized that this is completely wrong and won't work. I'll 
change things back and implement Stefan's proposal of a seperate 
"free_temps" call instead.

I'm sure there's a lesson to be learned from this.

</description>
    <dc:creator>Dag Sverre Seljebotn</dc:creator>
    <dc:date>2008-11-30T14:57:40</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.comp.python.cython.devel">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.comp.python.cython.devel</link>
  </textinput>
</rdf:RDF>
