[Cython] relative_path_in_code_position_comments

2011-09-21 Thread Brett Calcott
Hi all,

The path in cython's error output is insensitive to the cwd where cython in
invoked. It seems to be based on this variable in Cython/Compiler/Main.py:

  relative_path_in_code_position_comments = True,

If I understand it right, the path output is relative to module it is in,
instead of relative to the cwd.

This plays havoc with my editor (Vim), as it attempts to try and load the
file that caused the error based on parsing the output. I've just changed
this variable to False in my install, and it works fine.

Is there a reason for this? Am I missing some easy way around this?

Thanks,
Brett
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] cython 0.15 breaks callback code.

2011-09-21 Thread Brett Calcott
Hi. I've just reverted to 0.14.1 because 0.15 breaks code that implements a
cpp callback in python. It seems to be a name-mangling problem.

I've attached a short test case that shows the problem. They both compile
fine on 14.1 and 15. But if I try and run the 15 compiled version I get
this:

Traceback (most recent call last):
  File "try_hello.py", line 1, in 
import test
ImportError:
dlopen(/Users/brett/Dropbox/Code/kli-project/cython-test/test.so, 2): Symbol
not found: __Z19callback_test_helloP7_objecti
  Referenced from: /Users/brett/Dropbox/Code/kli-project/cython-test/test.so
  Expected in: dynamic lookup

Is there anything new I should be doing?

Brett
#include "callbacks.h"

// map callback functions into cython code
// These are implemented in the pyx file 
void callback_test_hello(PyObject *object_ptr, int i);

void callback_test::hello(int i)
{
callback_test_hello(object_ptr, i);
}

#include "Python.h"


class callback
{
public:
virtual void hello(int i)=0;
};

class caller
{
callback *m_c;
public:
void set_callback(callback *c) { m_c = c; }
void say_hello(int i) { m_c->hello(i); }
};

class callback_test : public callback
{
public:
PyObject *object_ptr;
	void hello(int i);
};



test.pyx
Description: Binary data


try_hello.py
Description: Binary data
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] cython 0.15 breaks callback code.

2011-09-25 Thread Brett Calcott
> which means your declaration of callback_test_hello in callbacks.cpp
> also needs to be extern "c" to have the same (i.e. no) mangling.
>

That was it!

Thanks,
Brett
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


[Cython] Templated attributes in extensions classes in 0.17 Beta 2

2012-08-19 Thread Brett Calcott
I'm not sure if this is a bug in 0.17 beta or not. But something is not working.

Default-constructed attributes in an extension definition appear to
work (though I can't see where they are documented on the site…)

So this works:

test.h 
#include 

struct Attributes
{
std::vector v;
};

-test.pyx--
from libcpp.vector cimport vector

cdef extern from "test.h":
cdef cppclass Attributes:
vector[int] v

cdef class Test:
cdef Attributes a
def __cinit__(self, list x):
self.a.v = x


However, if I try to put the templated attribute in directly:

test2.pyx--
from libcpp.vector cimport vector

cdef class Test:
cdef vector[int] v
def __cinit__(self, list x):
self.v = x

cython compiles it fine, but I get an error in the cpp compilation:
test2.cpp:722:23: error: expected a type
  new((void*)&(p->v)) std::vector();

So it looks like it's doing the funky in place construction, but not
getting the template parameters in there…

Should this work?

Cheers,
Brett
___
cython-devel mailing list
cython-devel@python.org
http://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] OpenMP thread private variable not recognized (bug report + discussion)

2014-08-12 Thread Brett Calcott
On Tue, Aug 12, 2014 at 10:26 AM, Sturla Molden 
wrote:

> The sooner you discover you do not
> need Cython's prange, the less pain it will cause.
>
>
For someone who has bumbled around trying to use prange & openmp on the mac
(but successfully used python threading), this sounds great. Is there an
example of this somewhere that you can point us to?

Thanks
Brett
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel


Re: [Cython] OpenMP thread private variable not recognized (bug report + discussion)

2014-08-12 Thread Brett Calcott
That would be awesome (I love ipython notebook).


On Tue, Aug 12, 2014 at 11:20 AM, Sturla Molden 
wrote:

> Brett Calcott 
> wrote:
>
> > For someone who has bumbled around trying to use prange & openmp on
> the mac
> > (but successfully used python threading), this sounds great. Is there an
> > example of this somewhere that you can point us to?
>
> No, but I could make one :)
>
> ipython notebook?
>
>
> Sturla
>
> ___
> cython-devel mailing list
> cython-devel@python.org
> https://mail.python.org/mailman/listinfo/cython-devel
>
___
cython-devel mailing list
cython-devel@python.org
https://mail.python.org/mailman/listinfo/cython-devel