Hi,<br><br>I made a PR with my fix:<br><br><a href="https://github.com/numpy/numpy/pull/2709">https://github.com/numpy/numpy/pull/2709</a><br><br>Frédéric<br><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, Oct 2, 2012 at 6:18 PM, Charles R Harris <span dir="ltr"><<a href="mailto:charlesr.harris@gmail.com" target="_blank">charlesr.harris@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br><div class="gmail_quote"><div class="im">On Tue, Oct 2, 2012 at 1:44 PM, Frédéric Bastien <span dir="ltr"><<a href="mailto:nouiz@nouiz.org" target="_blank">nouiz@nouiz.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
With numpy 1.6.2, it is working. So this is an interface change. Are<br>
you sure you want this? This break existing code.<br>
<br>
I do not understand what you mean by slot?<br></blockquote></div><div><br>Pythonese for structure member ;)<br> <br></div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<br>
I'm not sure is the PyArray_SWAP is a good long term idea. I would not<br>
make it if it is only for temporarily.<br></blockquote></div><div><br>The C++ stdlib provides something similar for std::vector. One common use case would be to pass in a vector by reference that gets swapped with one on the stack. When the function exits the one on the stack is cleaned up and the vector that was passed in has the new data, but it has to be the same type. <br>


<br>For PyArray_SWAP I was thinking of swapping everything: type, dims, strides, data, etc. That is what f2py does. <br><br></div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<br>
To set the base ptr, there is PyArray_SetBaseObject() fct that is new<br>
in 1.7. Is a similar fct useful in the long term for numpy? In the<br>
case where we implement differently the ndarray object, I think it<br>
won't be useful. We will also need to know how the memory is laid out<br>
by numpy for performance critical code. We we will need an attribute<br>
that tell the intern structure used.<br>
<br>
So do you want to force this interface change in numpy 1.7 so that I<br>
need to write codes now or can I wait to do it when you force the new<br>
interface?<br>
<br></blockquote></div><div><br>Well, no we don't want to force you to use the new interface. If you don't define NPY_NO_DEPRECATED_API things should still work. Although if it is defined the function returns an rvalue, so some other method needs to be provided for what you are doing.<br>


 <br></div><div class="im"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Currently the used code for PyArray_BYTES is:<br>
<br>
#define PyArray_BYTES(obj) ((char *)(((PyArrayObject_fields *)(obj))->data))<br>
<br>
if I change it to<br>
<br>
#define PyArray_BYTES(obj) ((((PyArrayObject_fields *)(obj))->data))<br>
<br>
it work! I don't understand why removing the case make it work. the<br>
data field is already an (char*), so this should not make a difference<br>
to my underderstanding. But I'm missing something here, do someone<br>
know?<br></blockquote></div><div><br>What I find strange is that it is the same macro in 1.7 and 1.6, only the name of the structure was changed. Hmm... This looks almost like some compiler subtlety, I wonder if the compiler version/optimization flags have changed? In any case, I think the second form would be more correct for the lvalue since the structure member is, as you say, already a char*.<br>


<br>We want things to work for you as they should, so we need to understand this and fix it.<br><br><snip><br><br>Chuck<br></div></div>
<br>_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
<br></blockquote></div><br></div>